Refactored SkColorSpace and added in a Lab PCS GM
The refactoring breaks off A2B0 tag support into a separate
subclass of SkColorSpace_Base, while keeping the current
(besides CLUT) functionality in a XYZTRC subclass.
ICC profile loading is now aware of this and creates the A2B0
subclass when SkColorSpace::NewICC() is called on a profile
in need of the A2B0 functionality.
The LabPCSDemo GM loads a .icc profile containing a LAB PCS and
then runs a Lab->XYZ conversion on an image using it so we can
display it and test out the A2B0 SkColorSpace functionality,
sans a/b/m-curves, as well as the Lab->XYZ conversion code.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2389983002
Review-Url: https://codereview.chromium.org/2389983002
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 4b46216..2194895 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -12,7 +12,7 @@
#include "SampleCode.h"
#include "SkAnimTimer.h"
#include "SkCanvas.h"
-#include "SkColorSpace_Base.h"
+#include "SkColorSpace_XYZ.h"
#include "SkCommandLineFlags.h"
#include "SkData.h"
#include "SkDocument.h"
@@ -1676,7 +1676,9 @@
}
if (kRGBA_F16_SkColorType == gConfig[selected].fColorType) {
SkASSERT(colorSpace);
- colorSpace = as_CSB(colorSpace)->makeLinearGamma();
+ SkASSERT(SkColorSpace_Base::Type::kXYZ == as_CSB(colorSpace)->type());
+ SkColorSpace_XYZ* csXYZ = static_cast<SkColorSpace_XYZ*>(colorSpace.get());
+ colorSpace = csXYZ->makeLinearGamma();
}
this->setDeviceColorType(gConfig[selected].fColorType, colorSpace);
return true;