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

Unified Diff: src/ports/SkImageDecoder_CG.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 | « src/core/SkUnPreMultiply.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkImageDecoder_CG.cpp
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index 9b93f81112d51e624470f3b4a5f9bcd1a77b5b91..beb6ed11e49b8645ac9f64c290f88613647daf5f 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -50,17 +50,6 @@ protected:
virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode);
};
-// Returns an unpremultiplied version of color. It will have the same ordering and size as an
-// SkPMColor, but the alpha will not be premultiplied.
-static SkPMColor unpremultiply_pmcolor(SkPMColor color) {
- U8CPU a = SkGetPackedA32(color);
- const SkUnPreMultiply::Scale scale = SkUnPreMultiply::GetScale(a);
- return SkPackARGB32NoCheck(a,
- SkUnPreMultiply::ApplyScale(scale, SkGetPackedR32(color)),
- SkUnPreMultiply::ApplyScale(scale, SkGetPackedG32(color)),
- SkUnPreMultiply::ApplyScale(scale, SkGetPackedB32(color)));
-}
-
#define BITMAP_INFO (kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast)
bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
@@ -118,7 +107,7 @@ bool SkImageDecoder_CG::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
uint32_t* addr = bm->getAddr32(i, j);
- *addr = unpremultiply_pmcolor(*addr);
+ *addr = SkUnPreMultiply::UnPreMultiplyPreservingByteOrder(*addr);
}
}
bm->setAlphaType(kUnpremul_SkAlphaType);
« no previous file with comments | « src/core/SkUnPreMultiply.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698