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

Unified Diff: src/core/SkColorSpaceXform.cpp

Issue 2338203005: Convert back to 0-255 scale before storing linear bytes (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | 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 5a6f015bff4670570907bfd4ae4908760ecd4940..de7cf85d23a553fc3a7f28511d24498744ab95c6 100644
--- a/src/core/SkColorSpaceXform.cpp
+++ b/src/core/SkColorSpaceXform.cpp
@@ -857,9 +857,9 @@ static inline void store_linear(void* dst, const uint32_t* src,
kRShift = 16;
}
- dr = sk_clamp_0_255(dr);
- dg = sk_clamp_0_255(dg);
- db = sk_clamp_0_255(db);
+ dr = sk_clamp_0_255(255.0f * dr);
+ dg = sk_clamp_0_255(255.0f * dg);
+ db = sk_clamp_0_255(255.0f * db);
Sk4i da = Sk4i::Load(src) & 0xFF000000;
@@ -874,7 +874,7 @@ template <SwapRB kSwapRB>
static inline void store_linear_1(void* dst, const uint32_t* src,
Sk4f& rgba, const Sk4f&,
const uint8_t* const[3]) {
- rgba = sk_clamp_0_255(rgba);
+ rgba = sk_clamp_0_255(255.0f * rgba);
uint32_t tmp;
SkNx_cast<uint8_t>(Sk4f_round(rgba)).store(&tmp);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698