aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkColorSpace_A2B.h
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-12-01 16:38:16 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-01 16:38:30 +0000
commit62458a6778bc39eea5360301a67d192b3a263df1 (patch)
tree46e3969ee23b12b9a10cc69790e358b6db0c0cb0 /src/core/SkColorSpace_A2B.h
parent51c3fcd376c5c9972d9476b5532f6164375a38d1 (diff)
Revert "Added CMYK support for ICC profiles."
This reverts commit 51c3fcd376c5c9972d9476b5532f6164375a38d1. Reason for revert: ASAN, MSAN both take issue with parse_and_load_gamma() Original change's description: > Added CMYK support for ICC profiles. > > Changed ICC parsing/SkGammas/SkColorLookUpTable to handle non-3-channel > inputs. Parsed CMYK A2B ICC profiles. Integrated this with SkJpegCodec > (the only file that supports CMYK) and SkColorSpaceXform_A2B to allow > parsing and color xforming of ICC CMYK images. > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5197 > CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD > > > Change-Id: Id6619f63f04071f79cd2d84321857dfa269ad3aa > Reviewed-on: https://skia-review.googlesource.com/5197 > Commit-Queue: Mike Klein <mtklein@chromium.org> > Reviewed-by: Matt Sarett <msarett@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> > Reviewed-by: Leon Scroggins <scroggo@google.com> > TBR=mtklein@chromium.org,mtklein@google.com,msarett@google.com,scroggo@google.com,brianosman@google.com,raftias@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ib43fef00bc233c0b4fa47ed29040d69601def267 Reviewed-on: https://skia-review.googlesource.com/5423 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core/SkColorSpace_A2B.h')
-rw-r--r--src/core/SkColorSpace_A2B.h55
1 files changed, 18 insertions, 37 deletions
diff --git a/src/core/SkColorSpace_A2B.h b/src/core/SkColorSpace_A2B.h
index b42de77137..2fb7a83cab 100644
--- a/src/core/SkColorSpace_A2B.h
+++ b/src/core/SkColorSpace_A2B.h
@@ -16,15 +16,14 @@
// is stored in an A2B0 ICC tag. This allows us to use alternative profile
// connection spaces (CIELAB instead of just CIEXYZ), use color-lookup-tables
// to do color space transformations not representable as TRC functions or
-// matrix operations, as well as have multiple TRC functions. The CLUT also
-// allows conversion between non-3-channel input color spaces ie CMYK(4) to
-// a workable PCS (ie XYZ).
+// matrix operations, as well as have multiple TRC functions. The CLUT also has
+// the potential to allow conversion from input color spaces with a different
+// number of channels such as CMYK (4) or GRAY (1), but that is not supported yet.
//
-// AtoBType, lut8Type and lut16Type A2B0 tag types are supported. There are
-// also MPET (multi-processing-elements) A2B0 tags in the standard which allow
-// you to combine these 3 primitives (TRC, CLUT, matrix) in any order/quantity.
-// MPET tags are currently unsupported by the MakeICC parser, could be supported
-// here by the nature of the design.
+// Currently AtoBType A2B0 tag types are supported. There are also lut8Type,
+// lut16Type and MPET (multi-processing-elements) A2B0 tags which allow you to
+// combine these 3 primitives (TRC, CLUT, matrix) in any order/quantitiy,
+// but support for that is not implemented.
class SkColorSpace_A2B : public SkColorSpace_Base {
public:
const SkMatrix44* toXYZD50() const override {
@@ -46,12 +45,12 @@ public:
// as destination color spaces, so an inverse matrix is never wanted.
return nullptr;
}
-
+
bool onGammaCloseToSRGB() const override {
// There is no single gamma curve in an A2B0 profile
return false;
}
-
+
bool onGammaIsLinear() const override {
// There is no single gamma curve in an A2B0 profile
return false;
@@ -72,37 +71,29 @@ public:
class Element {
public:
- Element(SkGammaNamed gammaNamed, int channelCount)
+ explicit Element(SkGammaNamed gammaNamed)
: fType(Type::kGammaNamed)
, fGammaNamed(gammaNamed)
, fMatrix(SkMatrix44::kUninitialized_Constructor)
- , fInputChannels(channelCount)
- , fOutputChannels(channelCount)
{}
explicit Element(sk_sp<SkGammas> gammas)
: fType(Type::kGammas)
, fGammas(std::move(gammas))
- , fMatrix(SkMatrix44::kUninitialized_Constructor)
- , fInputChannels(fGammas->channels())
- , fOutputChannels(fGammas->channels())
+ , fMatrix(SkMatrix44::kUninitialized_Constructor)
{}
explicit Element(sk_sp<SkColorLookUpTable> colorLUT)
: fType(Type::kCLUT)
, fCLUT(std::move(colorLUT))
, fMatrix(SkMatrix44::kUninitialized_Constructor)
- , fInputChannels(fCLUT->inputChannels())
- , fOutputChannels(fCLUT->outputChannels())
{}
explicit Element(const SkMatrix44& matrix)
: fType(Type::kMatrix)
, fMatrix(matrix)
- , fInputChannels(3)
- , fOutputChannels(3)
{}
-
+
enum class Type {
kGammaNamed,
kGammas,
@@ -132,21 +123,15 @@ public:
return fMatrix;
}
- int inputChannels() const { return fInputChannels; }
-
- int outputChannels() const { return fOutputChannels; }
-
private:
Type fType;
SkGammaNamed fGammaNamed;
sk_sp<SkGammas> fGammas;
sk_sp<SkColorLookUpTable> fCLUT;
SkMatrix44 fMatrix;
- int fInputChannels;
- int fOutputChannels;
};
- const Element& element(int i) const { return fElements[i]; }
-
+ const Element& element(size_t i) const { return fElements[i]; }
+
int count() const { return (int)fElements.size(); }
// the intermediate profile connection space that this color space
@@ -155,20 +140,16 @@ public:
kLAB, // CIELAB
kXYZ // CIEXYZ
};
-
+
PCS pcs() const { return fPCS; }
- InputColorFormat inputColorFormat() const { return fInputColorFormat; }
-
private:
- SkColorSpace_A2B(InputColorFormat inputColorFormat, std::vector<Element> elements, PCS pcs,
- sk_sp<SkData> profileData);
+ SkColorSpace_A2B(PCS pcs, sk_sp<SkData> profileData, std::vector<Element> elements);
- InputColorFormat fInputColorFormat;
- std::vector<Element> fElements;
PCS fPCS;
+ std::vector<Element> fElements;
- friend class SkColorSpace_Base;
+ friend class SkColorSpace;
friend class ColorSpaceXformTest;
typedef SkColorSpace_Base INHERITED;
};