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

Unified Diff: dm/DMWriteTask.cpp

Issue 171723007: add new copyTo version to SkBitmap, which takes SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | gm/bitmapcopy.cpp » ('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 dc31d292a397d47d31715905dce47bf75e35398c..5adb1d043780979686b1a66d81fd9474067abc4e 100644
--- a/dm/DMWriteTask.cpp
+++ b/dm/DMWriteTask.cpp
@@ -113,12 +113,10 @@ bool WriteTask::Expectations::check(const Task& task, SkBitmap bitmap) const {
return false;
}
- SkImageInfo info;
- SkAssertResult(bitmap.asImageInfo(&info));
+ const SkImageInfo info = bitmap.info();
SkBitmap expected;
- expected.setConfig(info);
- expected.allocPixels();
+ expected.allocPixels(info);
// expected will be unpremultiplied.
decoder->setRequireUnpremultipliedColors(true);
@@ -128,19 +126,18 @@ bool WriteTask::Expectations::check(const Task& task, SkBitmap bitmap) const {
}
// We always seem to decode to 8888. This puts 565 back in 565.
- if (expected.config() != bitmap.config()) {
+ if (expected.colorType() != bitmap.colorType()) {
SkBitmap converted;
- SkAssertResult(expected.copyTo(&converted, bitmap.config()));
+ SkAssertResult(expected.copyTo(&converted, bitmap.colorType()));
expected.swap(converted);
}
SkASSERT(expected.config() == bitmap.config());
// Manually unpremultiply 8888 bitmaps to match expected.
// Their pixels are shared, concurrently even, so we must copy them.
- if (info.fColorType == kPMColor_SkColorType) {
+ if (info.colorType() == kPMColor_SkColorType) {
SkBitmap unpremul;
- unpremul.setConfig(info);
- unpremul.allocPixels();
+ unpremul.allocPixels(info);
SkAutoLockPixels lockSrc(bitmap), lockDst(unpremul);
const SkPMColor* src = (SkPMColor*)bitmap.getPixels();
« no previous file with comments | « no previous file | gm/bitmapcopy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698