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

Unified Diff: tools/android/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: Reduce scope of local variable 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/android/SkBitmapRegionCanvas.h ('k') | tools/android/SkBitmapRegionCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/SkBitmapRegionCanvas.cpp
diff --git a/tools/android/SkBitmapRegionCanvas.cpp b/tools/android/SkBitmapRegionCanvas.cpp
index ffcab9596a95f109d577b3f47e393bac6ab7d723..bac5dc1ffc7995fa57cb954f5db2987cf99a71c1 100644
--- a/tools/android/SkBitmapRegionCanvas.cpp
+++ b/tools/android/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,11 +102,12 @@ 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) {
- bitmap->eraseColor(0);
+ SkCodec::ZeroInitialized zeroInit = allocator ? allocator->zeroInit() :
+ SkCodec::kNo_ZeroInitialized;
+ if (SkCodec::kNo_ZeroInitialized == zeroInit) {
+ bitmap->eraseColor(0);
+ }
}
// Use a canvas to crop and scale to the destination bitmap
« no previous file with comments | « tools/android/SkBitmapRegionCanvas.h ('k') | tools/android/SkBitmapRegionCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698