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

Unified Diff: src/core/SkColorSpaceXform.cpp

Issue 2275563002: Fix generic color space xform, ColorSpaceXformTest (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add helper function for testing Created 4 years, 4 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 | « src/core/SkColorSpaceXform.h ('k') | tests/ColorSpaceXformTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpaceXform.cpp
diff --git a/src/core/SkColorSpaceXform.cpp b/src/core/SkColorSpaceXform.cpp
index 3795d2d8d638229c399aa74d4a1bd60835cfbf60..334acb508b18fac4fb7e1e6070eb5c07991bd907 100644
--- a/src/core/SkColorSpaceXform.cpp
+++ b/src/core/SkColorSpaceXform.cpp
@@ -950,13 +950,21 @@ static inline void store_generic(void* dst, const uint32_t* src,
static inline void store_generic_1(void* dst, const uint32_t* src,
Sk4f& rgba, const Sk4f&,
const uint8_t* const dstTables[3], SwapRB kSwapRB) {
+ int kRShift = 0;
+ int kGShift = 8;
+ int kBShift = 16;
+ if (kYes_SwapRB == kSwapRB) {
+ kBShift = 0;
+ kRShift = 16;
+ }
+
rgba = Sk4f::Min(Sk4f::Max(1023.0f * rgba, 0.0f), 1023.0f);
Sk4i indices = Sk4f_round(rgba);
- *((uint32_t*) dst) = dstTables[0][indices[0]] << 0
- | dstTables[1][indices[1]] << 8
- | dstTables[2][indices[2]] << 16
+ *((uint32_t*) dst) = dstTables[0][indices[0]] << kRShift
+ | dstTables[1][indices[1]] << kGShift
+ | dstTables[2][indices[2]] << kBShift
| (*src & 0xFF000000);
}
@@ -1197,3 +1205,9 @@ const
return;
}
}
+
+std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>& space) {
+ return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_Base
+ <SkColorSpace::kNonStandard_GammaNamed, kNone_ColorSpaceMatch>
+ (space, SkMatrix::I(), space));
+}
« no previous file with comments | « src/core/SkColorSpaceXform.h ('k') | tests/ColorSpaceXformTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698