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/SkColor.cpp

Issue 16410009: Add an option to create unpremultiplied bitmaps. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: ImageDecodeBench does no rendering. Created 7 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
Index: src/core/SkColor.cpp
diff --git a/src/core/SkColor.cpp b/src/core/SkColor.cpp
index 6fa239ff539399eb0b061348ee0f0170f014cd97..1133e53f2538d2cac83b467fd2cd8a05709c837f 100644
--- a/src/core/SkColor.cpp
+++ b/src/core/SkColor.cpp
@@ -19,6 +19,18 @@ SkPMColor SkPreMultiplyColor(SkColor c) {
SkColorGetG(c), SkColorGetB(c));
}
+/**
+ * Interprets c as an unpremultiplied color, and returns the
+ * premultiplied equivalent.
+ */
+SkPMColor SkPreMultiplyUnPMColor(SkPMColor c) {
reed1 2013/06/13 19:33:07 Since there is no header for this method, and it i
scroggo 2013/06/13 20:10:40 Done.
+ U8CPU a = SkGetPackedA32(c);
+ U8CPU r = SkGetPackedR32(c);
+ U8CPU g = SkGetPackedG32(c);
+ U8CPU b = SkGetPackedB32(c);
+ return SkPreMultiplyARGB(a, r, g, b);
+}
+
///////////////////////////////////////////////////////////////////////////////
static inline SkScalar ByteToScalar(U8CPU x) {

Powered by Google App Engine
This is Rietveld 408576698