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

Unified Diff: dm/DMWriteTask.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 | « no previous file | include/core/SkUnPreMultiply.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMWriteTask.cpp
diff --git a/dm/DMWriteTask.cpp b/dm/DMWriteTask.cpp
index f64600f9c4c9dd6f06e8a1b15cd0965647cc7b2f..f51663b2dfedb563065c95e0a535fe4daa594183 100644
--- a/dm/DMWriteTask.cpp
+++ b/dm/DMWriteTask.cpp
@@ -137,17 +137,11 @@ bool WriteTask::Expectations::check(const Task& task, SkBitmap bitmap) const {
unpremul.setConfig(info);
unpremul.allocPixels();
- // Unpremultiply without changing native byte order.
SkAutoLockPixels lockSrc(bitmap), lockDst(unpremul);
const SkPMColor* src = (SkPMColor*)bitmap.getPixels();
uint32_t* dst = (uint32_t*)unpremul.getPixels();
for (size_t i = 0; i < bitmap.getSize()/4; i++) {
- const U8CPU a = SkGetPackedA32(src[i]);
- const SkUnPreMultiply::Scale s = SkUnPreMultiply::GetScale(a);
- dst[i] = SkPackARGB32NoCheck(a,
- SkUnPreMultiply::ApplyScale(s, SkGetPackedR32(src[i])),
- SkUnPreMultiply::ApplyScale(s, SkGetPackedG32(src[i])),
- SkUnPreMultiply::ApplyScale(s, SkGetPackedB32(src[i])));
+ dst[i] = SkUnPreMultiply::UnPreMultiplyPreservingByteOrder(src[i]);
}
bitmap.swap(unpremul);
}
« no previous file with comments | « no previous file | include/core/SkUnPreMultiply.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698