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

Unified Diff: dm/DMSrcSink.cpp

Issue 1577853004: Add CodecZeroInit test to DMSrcSink (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 4 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 | « dm/DMSrcSink.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index c9bdcf6706771a6b253756ed7827d8d354eb3c56..bbfa5199e61f06bead0549fad66d11fa40313a23 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -316,14 +316,22 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
}
SkBitmap bitmap;
- if (!bitmap.tryAllocPixels(decodeInfo, nullptr, colorTable.get())) {
+ SkPixelRefFactory* factory = nullptr;
+ SkMallocPixelRef::ZeroedPRFactory zeroFactory;
+ SkCodec::Options options;
+ if (kCodecZeroInit_Mode == fMode) {
+ factory = &zeroFactory;
+ options.fZeroInitialized = SkCodec::kYes_ZeroInitialized;
+ }
+ if (!bitmap.tryAllocPixels(decodeInfo, factory, colorTable.get())) {
return SkStringPrintf("Image(%s) is too large (%d x %d)", fPath.c_str(),
decodeInfo.width(), decodeInfo.height());
}
switch (fMode) {
+ case kCodecZeroInit_Mode:
case kCodec_Mode: {
- switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), nullptr,
+ switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), &options,
colorPtr, colorCountPtr)) {
case SkCodec::kSuccess:
// We consider incomplete to be valid, since we should still decode what is
« no previous file with comments | « dm/DMSrcSink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698