Revert of leave pixel memory uninitialized for opaque alpha type in SkSurface::MakeRaster (patchset #1 id:1 of https://codereview.chromium.org/2412633002/ )

Reason for revert:
Reverting while we think about skia:5854 so the bot doesn't regress further.

Original issue's description:
> leave pixel memory uninitialized for opaque alpha type in SkSurface::MakeRaster
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2412633002
>
> Committed: https://skia.googlesource.com/skia/+/c64ef3563dc8badac3d64544513b03df826cf8c3

TBR=mtklein@chromium.org,bsalomon@google.com,reed@google.com,lsalzman@mozilla.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:5854

Review-Url: https://codereview.chromium.org/2421473003
This commit is contained in:
mtklein 2016-10-13 07:46:14 -07:00 committed by Commit bot
parent 32b5e70178
commit 8f2996c59c
2 changed files with 5 additions and 13 deletions

View File

@ -51,14 +51,10 @@ public:
void* context, const SkSurfaceProps* = nullptr);
/**
* Return a new surface, with the memory for the pixels automatically allocated but respecting
* the specified rowBytes. If rowBytes==0, then a default value will be chosen. If a non-zero
* rowBytes is specified, then any images snapped off of this surface (via makeImageSnapshot())
* are guaranteed to have the same rowBytes.
*
* If the requested alpha type is not opaque, then the surface's pixel memory will be
* zero-initialized. If it is opaque, then it will be left uninitialized, and the caller is
* responsible for initially clearing the surface.
* Return a new surface, with the memory for the pixels automatically allocated and
* zero-initialized, but respecting the specified rowBytes. If rowBytes==0, then a default
* value will be chosen. If a non-zero rowBytes is specified, then any images snapped off of
* this surface (via makeImageSnapshot()) are guaranteed to have the same rowBytes.
*
* If the requested surface cannot be created, or the request is not a
* supported configuration, NULL will be returned.

View File

@ -208,11 +208,7 @@ sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
return 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));
SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, nullptr));
if (nullptr == pr.get()) {
return nullptr;
}