aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPM4fPriv.h
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2016-05-13 10:04:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-13 10:04:46 -0700
commit670f01f2fc88f02ec9a6f1b47af29daeadc3b301 (patch)
tree2540624e093c7445b786d744898fe27493ddc1a1 /src/core/SkPM4fPriv.h
parent36632f46a6d87d9d9bd5e0ab65350638e8cfb65c (diff)
This has all the different source types in and working. There are many SkDiffs, but they seem to be due to better resolution.
This seems to fix all the bugs involved with make all the images produced by the codec to default to sRGB. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1967283002 Review-Url: https://codereview.chromium.org/1967283002
Diffstat (limited to 'src/core/SkPM4fPriv.h')
-rw-r--r--src/core/SkPM4fPriv.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index b75dc71654..9650646d95 100644
--- a/src/core/SkPM4fPriv.h
+++ b/src/core/SkPM4fPriv.h
@@ -62,6 +62,13 @@ static inline Sk4f Sk4f_fromS32(uint32_t src) {
return srgb_to_linear(to_4f(src) * Sk4f(1.0f/255));
}
+// Color handling:
+// SkColor has an ordering of (b, g, r, a) if cast to an Sk4f, so the code swizzles r and b to
+// produce the needed (r, g, b, a) ordering.
+static inline Sk4f Sk4f_from_SkColor(SkColor color) {
+ return swizzle_rb(gTreatSkColorAsSRGB ? Sk4f_fromS32(color) : Sk4f_fromL32(color));
+}
+
static inline uint32_t Sk4f_toL32(const Sk4f& x4) {
return to_4b(x4 * Sk4f(255) + Sk4f(0.5f));
}