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

Issue 130303005: Factor out UnPreMultiplyPreservingByteOrder (Closed) Base URL: https://skia.googlesource.com/skia.git@dm-r
Patch Set: Created 6 years, 11 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 | « include/core/SkUnPreMultiply.h ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkUnPreMultiply.cpp
diff --git a/src/core/SkUnPreMultiply.cpp b/src/core/SkUnPreMultiply.cpp
index ad87f8af1442060e6a42d9cadc357a2e0d3c9b76..6245e96429cd3e00751855d60a21a16f33a55a70 100644
--- a/src/core/SkUnPreMultiply.cpp
+++ b/src/core/SkUnPreMultiply.cpp
@@ -17,6 +17,15 @@ SkColor SkUnPreMultiply::PMColorToColor(SkPMColor c) {
ApplyScale(scale, SkGetPackedB32(c)));
}
+uint32_t SkUnPreMultiply::UnPreMultiplyPreservingByteOrder(SkPMColor c) {
+ const U8CPU a = SkGetPackedA32(c);
+ const Scale scale = GetScale(a);
+ return SkPackARGB32NoCheck(a,
+ ApplyScale(scale, SkGetPackedR32(c)),
+ ApplyScale(scale, SkGetPackedG32(c)),
+ ApplyScale(scale, SkGetPackedB32(c)));
+}
+
const uint32_t SkUnPreMultiply::gTable[] = {
0x00000000, 0xFF000000, 0x7F800000, 0x55000000, 0x3FC00000, 0x33000000, 0x2A800000, 0x246DB6DB,
0x1FE00000, 0x1C555555, 0x19800000, 0x172E8BA3, 0x15400000, 0x139D89D9, 0x1236DB6E, 0x11000000,
« no previous file with comments | « include/core/SkUnPreMultiply.h ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698