| Index: src/image/SkSurface_Raster.cpp
|
| diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
|
| index f2cb94a04f75f48501a362cf840e3d9fee741504..2b2bf645260e2b3fc983ba1b6d0f638627b27849 100644
|
| --- a/src/image/SkSurface_Raster.cpp
|
| +++ b/src/image/SkSurface_Raster.cpp
|
| @@ -208,7 +208,11 @@ sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
|
| return nullptr;
|
| }
|
|
|
| - SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, nullptr));
|
| + // If the requested alpha type is opaque, then leave the pixels uninitialized.
|
| + // Alpha formats can be safely initialiezd to zero.
|
| + SkAutoTUnref<SkPixelRef> pr(info.isOpaque()
|
| + ? SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr)
|
| + : SkMallocPixelRef::NewZeroed(info, rowBytes, nullptr));
|
| if (nullptr == pr.get()) {
|
| return nullptr;
|
| }
|
|
|