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

Unified Diff: tools/codec/SkBitmapRegionCanvas.cpp

Issue 1420053010: Make BRD take advantage of zero initialized memory (Closed) Base URL: https://skia.googlesource.com/skia.git@zero-init
Patch Set: Rebase on new folder Created 5 years, 1 month 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 | « tools/codec/SkBitmapRegionCanvas.h ('k') | tools/codec/SkBitmapRegionCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/codec/SkBitmapRegionCanvas.cpp
diff --git a/tools/codec/SkBitmapRegionCanvas.cpp b/tools/codec/SkBitmapRegionCanvas.cpp
index ffcab9596a95f109d577b3f47e393bac6ab7d723..f0dcf6a19cdbb833aa11478c966089a5be9beb50 100644
--- a/tools/codec/SkBitmapRegionCanvas.cpp
+++ b/tools/codec/SkBitmapRegionCanvas.cpp
@@ -15,7 +15,7 @@ SkBitmapRegionCanvas::SkBitmapRegionCanvas(SkCodec* decoder)
, fDecoder(decoder)
{}
-bool SkBitmapRegionCanvas::decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator,
+bool SkBitmapRegionCanvas::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator,
const SkIRect& desiredSubset, int sampleSize, SkColorType dstColorType,
bool requireUnpremul) {
// Reject color types not supported by this method
@@ -102,10 +102,10 @@ bool SkBitmapRegionCanvas::decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* a
// TODO (msarett): Can we make this faster by implementing it to only
// zero parts of the image that we won't overwrite with
// pixels?
- // TODO (msarett): This could be skipped if memory is zero initialized.
- // This would matter if this code is moved to Android and
- // uses Android bitmaps.
- if (SubsetType::kPartiallyInside_SubsetType == type) {
+ SkCodec::ZeroInitialized zeroInit = allocator ? allocator->zeroInit() :
scroggo 2015/11/10 22:31:14 It looks like we only care about the variable zero
msarett 2015/11/10 22:49:59 Done.
+ SkCodec::kNo_ZeroInitialized;
+ if (SubsetType::kPartiallyInside_SubsetType == type &&
+ SkCodec::kNo_ZeroInitialized == zeroInit) {
bitmap->eraseColor(0);
}
« no previous file with comments | « tools/codec/SkBitmapRegionCanvas.h ('k') | tools/codec/SkBitmapRegionCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698