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

Unified Diff: src/core/SkPM4f.h

Issue 2091923003: Fix incorrect swizzle on BGRA platforms in filterColor4f path (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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/SkColorFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPM4f.h
diff --git a/src/core/SkPM4f.h b/src/core/SkPM4f.h
index e99ddccd8effac93898897df523042ac38a7ccba..f983101f41f573b2fccfed31209b56bc790f3f0e 100644
--- a/src/core/SkPM4f.h
+++ b/src/core/SkPM4f.h
@@ -50,6 +50,13 @@ struct SkPM4f {
Sk4f to4f_bgra() const { return swizzle_rb(this->to4f()); }
Sk4f to4f_pmorder() const { return swizzle_rb_if_bgra(this->to4f()); }
+ SkPMColor toPMColor() const {
+ Sk4f value = swizzle_rb_if_bgra(this->to4f());
+ SkPMColor result;
+ SkNx_cast<uint8_t>(value * Sk4f(255) + Sk4f(0.5f)).store(&result);
+ return result;
+ }
+
void toF16(uint16_t[4]) const;
uint64_t toF16() const; // 4 float16 values packed into uint64_t
« no previous file with comments | « src/core/SkColorFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698