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

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: Respond to comments 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) {
bsalomon 2013/06/13 12:24:59 Should we have a new type, SkUPMColor? It wouldn't
reed1 2013/06/13 13:51:39 Who calls this? Is it declared in a public header?
scroggo 2013/06/13 19:04:49 It is called by tests/ImageDecodingTest.cpp and sa
+ 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