Chromium Code Reviews| 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); |
| } |