Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: gm/labpcsdemo.cpp

Issue 2444553002: Refactored SkColorSpace_A2B to allow arbitrary ordering of elements (Closed)
Patch Set: responding to comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkColorSpace_A2B.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/labpcsdemo.cpp
diff --git a/gm/labpcsdemo.cpp b/gm/labpcsdemo.cpp
index 4bd9ed8140f43790397637c48843fcacfb2126c1..730f0dde0df5fe70ae7796df84cfa9007aa86d36 100644
--- a/gm/labpcsdemo.cpp
+++ b/gm/labpcsdemo.cpp
@@ -175,14 +175,27 @@ protected:
if (convertLabToXYZ) {
SkASSERT(SkColorSpace_Base::Type::kA2B == as_CSB(colorSpace)->type());
SkColorSpace_A2B& cs = *static_cast<SkColorSpace_A2B*>(colorSpace.get());
+ const SkColorLookUpTable* colorLUT = nullptr;
bool printConversions = false;
- SkASSERT(cs.colorLUT());
// We're skipping evaluating the TRCs and the matrix here since they aren't
// in the ICC profile initially used here.
- SkASSERT(kLinear_SkGammaNamed == cs.aCurveNamed());
- SkASSERT(kLinear_SkGammaNamed == cs.mCurveNamed());
- SkASSERT(kLinear_SkGammaNamed == cs.bCurveNamed());
- SkASSERT(cs.matrix().isIdentity());
+ for (size_t e = 0; e < cs.count(); ++e) {
+ switch (cs.element(e).type()) {
+ case SkColorSpace_A2B::Element::Type::kGammaNamed:
+ SkASSERT(kLinear_SkGammaNamed == cs.element(e).gammaNamed());
+ break;
+ case SkColorSpace_A2B::Element::Type::kGammas:
+ SkASSERT(false);
+ break;
+ case SkColorSpace_A2B::Element::Type::kCLUT:
+ colorLUT = &cs.element(e).colorLUT();
+ break;
+ case SkColorSpace_A2B::Element::Type::kMatrix:
+ SkASSERT(cs.element(e).matrix().isIdentity());
+ break;
+ }
+ }
+ SkASSERT(colorLUT);
for (int y = 0; y < imageHeight; ++y) {
for (int x = 0; x < imageWidth; ++x) {
uint32_t& p = *bitmap.getAddr32(x, y);
@@ -195,7 +208,7 @@ protected:
float lab[4] = { r * (1.f/255.f), g * (1.f/255.f), b * (1.f/255.f), 1.f };
- interp_3d_clut(lab, lab, cs.colorLUT());
+ interp_3d_clut(lab, lab, colorLUT);
// Lab has ranges [0,100] for L and [-128,127] for a and b
// but the ICC profile loader stores as [0,1]. The ICC
« no previous file with comments | « no previous file | src/core/SkColorSpace_A2B.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698