aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPM4fPriv.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-07-13 13:18:56 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-13 13:19:04 +0000
commit4a17501f5bbd5e45a49d76d7a733393fec9701ee (patch)
treecfef179372e83944b91c183133cc4ccde6e103ac /src/core/SkPM4fPriv.h
parentbc8133b4adf481edf62158f07951e06e20c2f92a (diff)
Revert "update SkColor4f::FromColor() to preserve transfer function"
This reverts commit 9e229233a67b36a508d3c753a5b93a022369c5f7. Reason for revert: See if blocking Android roll Original change's description: > update SkColor4f::FromColor() to preserve transfer function > > This kills off some sRGB tables, > and lots of call sites can now use SkColor4f::FromColor(). > > It doesn't seem important to keep this test. > > Change-Id: Ia79ec8ace45e80bbc7a1e33f560f59289e61b2fb > Reviewed-on: https://skia-review.googlesource.com/141046 > Commit-Queue: Mike Klein <mtklein@chromium.org> > Reviewed-by: Brian Osman <brianosman@google.com> TBR=mtklein@chromium.org,brianosman@google.com Change-Id: I9d76e4ccf8a101853a7404abb33bdab9e0c64c25 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/141181 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/core/SkPM4fPriv.h')
-rw-r--r--src/core/SkPM4fPriv.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index 4a288feb98..f5e9aa02e6 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -53,16 +53,25 @@ static inline SkPM4f premul_in_dst_colorspace(SkColor4f color4f,
return {{color4f.fR, color4f.fG, color4f.fB, color4f.fA}};
}
-static inline SkPM4f premul_in_dst_colorspace(SkColor color, SkColorSpace* dstCS) {
+static inline SkPM4f premul_in_dst_colorspace(SkColor c, SkColorSpace* dstCS) {
+ SkColor4f color4f;
+ swizzle_rb(Sk4f_fromL32(c)).store(color4f.vec());
+
// SkColors are always sRGB.
- return premul_in_dst_colorspace(SkColor4f::FromColor(color),
- SkColorSpace::MakeSRGB().get(), dstCS);
+ return premul_in_dst_colorspace(color4f, SkColorSpace::MakeSRGB().get(), dstCS);
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Functions below this line are probably totally broken as far as color space management goes.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+static inline Sk4f Sk4f_fromS32(uint32_t px) {
+ return { sk_linear_from_srgb[(px >> 0) & 0xff],
+ sk_linear_from_srgb[(px >> 8) & 0xff],
+ sk_linear_from_srgb[(px >> 16) & 0xff],
+ (1/255.0f) * (px >> 24) };
+}
+
static inline uint32_t Sk4f_toS32(const Sk4f& px) {
Sk4i rgb = sk_linear_to_srgb(px),
srgb = { rgb[0], rgb[1], rgb[2], (int)(255.0f * px[3] + 0.5f) };