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

Unified Diff: src/core/SkPM4fPriv.h

Issue 1967283002: All source types working for linear pipeline. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use black const Created 4 years, 7 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/SkLinearBitmapPipeline_sample.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPM4fPriv.h
diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h
index b75dc71654e9a99023e43f060794186b1b89230a..9650646d95d3bcfa012fede18fd38bb7fd477e65 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));
}
« no previous file with comments | « src/core/SkLinearBitmapPipeline_sample.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698