aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-04-01 17:21:42 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-01 17:21:52 +0000
commitb14131c1851eea6acbd34cc42a8f860daed36b21 (patch)
tree39e74b29ec1a34ff63fc347ba9b616186f435ff6 /src
parent9920b10f5292838f00600f676c4578cd11705e60 (diff)
Revert "Revert[2] "clean up (partially) colortable api"""
This reverts commit 9920b10f5292838f00600f676c4578cd11705e60. Reason for revert: trying to get details on w2k failure https://chromium-swarm.appspot.com/task?id=354345d34ba3b310&refresh=10 Caught exception 3221225477 EXCEPTION_ACCESS_VIOLATION, was running: unit test HugeBlurImageFilter unit test FontNames unit test Codec_PngRoundTrip unit test ClampRange unit test FontHost unit test ColorMatrixFilter f16 image scaled_codec_premul abnormal.wbmp 565 image brd_android_codec_divisor_0.167 interlaced3.png_0.167 unit test Codec_png unit test ImageFilterBlurLargeImage unit test FontObj unit test DrawText unit test GrShape 565 image brd_android_codec_divisor_0.333 interlaced2.png_0.333 unit test PathOpsOpCubicsThreaded unit test PathOpsOpLoopsThreaded unit test FontMgr unit test ColorToHSVRoundTrip unit test Image_Serialize_Encoding_Failure Likely culprit: unit test Image_Serialize_Encoding_Failure step returned non-zero exit code: -1073741819 Original change's description: > Revert[2] "clean up (partially) colortable api"" > > This reverts commit 1d1165ca6575e082b892c5460492c411618783ad. > > Bug: skia: > Change-Id: Idbc0634ae3cec2e79f592d252de8751b077e6408 > Reviewed-on: https://skia-review.googlesource.com/11024 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ia4e73434b083224baa36092c69526c2f59bb16aa Reviewed-on: https://skia-review.googlesource.com/11025 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmap.cpp35
-rw-r--r--src/core/SkBitmapDevice.cpp5
-rw-r--r--src/core/SkColorTable.cpp22
-rw-r--r--src/core/SkImageCacherator.cpp2
-rw-r--r--src/core/SkMallocPixelRef.cpp126
-rw-r--r--src/core/SkSpecialSurface.cpp4
-rw-r--r--src/effects/gradients/SkGradientShader.cpp10
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h5
-rw-r--r--src/image/SkSurface_Raster.cpp2
9 files changed, 112 insertions, 99 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index df3b24ed11..0a999cee42 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -300,7 +300,8 @@ void SkBitmap::setPixels(void* p, SkColorTable* ctable) {
return;
}
- this->setPixelRef(SkMallocPixelRef::MakeDirect(fInfo, p, fRowBytes, sk_ref_sp(ctable)), 0, 0);
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewDirect(fInfo, p, fRowBytes, ctable));
+ this->setPixelRef(std::move(pr), 0, 0);
if (!fPixelRef) {
return;
}
@@ -333,7 +334,9 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
// setInfo may have computed a valid rowbytes if 0 were passed in
rowBytes = this->rowBytes();
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeAllocate(correctedInfo, rowBytes, nullptr);
+ SkMallocPixelRef::PRFactory defaultFactory;
+
+ sk_sp<SkPixelRef> pr(defaultFactory.create(correctedInfo, rowBytes, nullptr));
if (!pr) {
return reset_return_false(this);
}
@@ -347,8 +350,8 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, size_t rowBytes)
return true;
}
-bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, sk_sp<SkColorTable> ctable,
- uint32_t allocFlags) {
+bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, SkPixelRefFactory* factory,
+ SkColorTable* ctable) {
if (kIndex_8_SkColorType == requestedInfo.colorType() && nullptr == ctable) {
return reset_return_false(this);
}
@@ -359,14 +362,18 @@ bool SkBitmap::tryAllocPixels(const SkImageInfo& requestedInfo, sk_sp<SkColorTab
// setInfo may have corrected info (e.g. 565 is always opaque).
const SkImageInfo& correctedInfo = this->info();
- sk_sp<SkPixelRef> pr = (allocFlags & kZeroPixels_AllocFlag) ?
- SkMallocPixelRef::MakeZeroed(correctedInfo, correctedInfo.minRowBytes(), ctable) :
- SkMallocPixelRef::MakeAllocate(correctedInfo, correctedInfo.minRowBytes(), ctable);
+ SkMallocPixelRef::PRFactory defaultFactory;
+ if (nullptr == factory) {
+ factory = &defaultFactory;
+ }
+
+ sk_sp<SkPixelRef> pr(factory->create(correctedInfo, correctedInfo.minRowBytes(), ctable));
if (!pr) {
return reset_return_false(this);
}
this->setPixelRef(std::move(pr), 0, 0);
+ // TODO: lockPixels could/should return bool or void*/nullptr
this->lockPixels();
if (nullptr == this->getPixels()) {
return reset_return_false(this);
@@ -396,8 +403,8 @@ bool SkBitmap::installPixels(const SkImageInfo& requestedInfo, void* pixels, siz
// setInfo may have corrected info (e.g. 565 is always opaque).
const SkImageInfo& correctedInfo = this->info();
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeWithProc(correctedInfo, rb, sk_ref_sp(ct),
- pixels, releaseProc, context);
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewWithProc(correctedInfo, rb, ct, pixels, releaseProc,
+ context));
if (!pr) {
this->reset();
return false;
@@ -466,7 +473,7 @@ bool SkBitmap::HeapAllocator::allocPixelRef(SkBitmap* dst,
return false;
}
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeAllocate(info, dst->rowBytes(), sk_ref_sp(ctable));
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, dst->rowBytes(), ctable));
if (!pr) {
return false;
}
@@ -1007,7 +1014,7 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
sk_sp<SkColorTable> ctable;
if (buffer->readBool()) {
- ctable = SkColorTable::Create(*buffer);
+ ctable.reset(SkColorTable::Create(*buffer));
if (!ctable) {
return false;
}
@@ -1031,9 +1038,9 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
}
}
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeWithData(info, info.minRowBytes(),
- std::move(ctable), std::move(data));
- if (!pr) {
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowBytes(),
+ ctable.get(), data.get()));
+ if (!pr.get()) {
return false;
}
bitmap->setInfo(pr->info());
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 95ea45c29d..3be63ba66b 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -121,8 +121,9 @@ SkBitmapDevice* SkBitmapDevice::Create(const SkImageInfo& origInfo,
}
} else {
// This bitmap has transparency, so we'll zero the pixels (to transparent).
- // We use the flag as a faster alloc-then-eraseColor(SK_ColorTRANSPARENT).
- if (!bitmap.tryAllocPixels(info, nullptr/*colortable*/, SkBitmap::kZeroPixels_AllocFlag)) {
+ // We use a ZeroedPRFactory as a faster alloc-then-eraseColor(SK_ColorTRANSPARENT).
+ SkMallocPixelRef::ZeroedPRFactory factory;
+ if (!bitmap.tryAllocPixels(info, &factory, nullptr/*color table*/)) {
return nullptr;
}
}
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 928f5158d4..97103463db 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -23,7 +23,11 @@ void SkColorTable::init(const SkPMColor colors[], int count) {
SkColorTable::SkColorTable(const SkPMColor colors[], int count) {
SkASSERT(0 == count || colors);
- SkASSERT(count >= 0 && count <= 256);
+ if (count < 0) {
+ count = 0;
+ } else if (count > 256) {
+ count = 256;
+ }
this->init(colors, count);
}
@@ -52,16 +56,6 @@ const uint16_t* SkColorTable::read16BitCache() const {
return f16BitCache;
}
-sk_sp<SkColorTable> SkColorTable::Make(const SkPMColor colors[], int count) {
- if (count < 0 || count > 256) {
- return nullptr;
- }
- if (count && !colors) {
- return nullptr;
- }
- return sk_make_sp<SkColorTable>(colors, count);
-}
-
///////////////////////////////////////////////////////////////////////////////
#if 0
@@ -91,14 +85,14 @@ void SkColorTable::writeToBuffer(SkWriteBuffer& buffer) const {
buffer.writeColorArray(fColors, fCount);
}
-sk_sp<SkColorTable> SkColorTable::Create(SkReadBuffer& buffer) {
+SkColorTable* SkColorTable::Create(SkReadBuffer& buffer) {
if (buffer.isVersionLT(SkReadBuffer::kRemoveColorTableAlpha_Version)) {
/*fAlphaType = */buffer.readUInt();
}
const int count = buffer.getArrayCount();
if (0 == count) {
- return sk_sp<SkColorTable>(new SkColorTable(nullptr, 0));
+ return new SkColorTable(nullptr, 0);
}
if (count < 0 || count > 256) {
@@ -112,5 +106,5 @@ sk_sp<SkColorTable> SkColorTable::Create(SkReadBuffer& buffer) {
return nullptr;
}
- return sk_sp<SkColorTable>(new SkColorTable(colors.release(), count, kAllocatedWithMalloc));
+ return new SkColorTable(colors.release(), count, kAllocatedWithMalloc);
}
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index e3c97d390b..76da0e762e 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -157,7 +157,7 @@ bool SkImageCacherator::generateBitmap(SkBitmap* bitmap, const SkImageInfo& deco
allocator)) {
return false;
}
- if (!bitmap->tryAllocPixels(decodeInfo, sk_ref_sp(full.getColorTable()))) {
+ if (!bitmap->tryAllocPixels(decodeInfo, nullptr, full.getColorTable())) {
return false;
}
return full.readPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes(),
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index 7197aebae5..0d758fcb3d 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -37,23 +37,22 @@ static bool is_valid(const SkImageInfo& info, SkColorTable* ctable) {
return true;
}
-sk_sp<SkPixelRef> SkMallocPixelRef::MakeDirect(const SkImageInfo& info,
- void* addr,
- size_t rowBytes,
- sk_sp<SkColorTable> ctable) {
- if (!is_valid(info, ctable.get())) {
+SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info,
+ void* addr,
+ size_t rowBytes,
+ SkColorTable* ctable) {
+ if (!is_valid(info, ctable)) {
return nullptr;
}
- return sk_sp<SkPixelRef>(new SkMallocPixelRef(info, addr, rowBytes, std::move(ctable),
- nullptr, nullptr));
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, nullptr, nullptr);
}
- sk_sp<SkPixelRef> SkMallocPixelRef::MakeUsing(void*(*alloc)(size_t),
- const SkImageInfo& info,
- size_t requestedRowBytes,
- sk_sp<SkColorTable> ctable) {
- if (!is_valid(info, ctable.get())) {
+ SkMallocPixelRef* SkMallocPixelRef::NewUsing(void*(*alloc)(size_t),
+ const SkImageInfo& info,
+ size_t requestedRowBytes,
+ SkColorTable* ctable) {
+ if (!is_valid(info, ctable)) {
return nullptr;
}
@@ -85,59 +84,62 @@ sk_sp<SkPixelRef> SkMallocPixelRef::MakeDirect(const SkImageInfo& info,
return nullptr;
}
- return sk_sp<SkPixelRef>(new SkMallocPixelRef(info, addr, rowBytes, std::move(ctable),
- sk_free_releaseproc, nullptr));
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, sk_free_releaseproc, nullptr);
}
-sk_sp<SkPixelRef> SkMallocPixelRef::MakeAllocate(const SkImageInfo& info,
+SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
size_t rowBytes,
- sk_sp<SkColorTable> ctable) {
+ SkColorTable* ctable) {
auto sk_malloc_nothrow = [](size_t size) { return sk_malloc_flags(size, 0); };
- return MakeUsing(sk_malloc_nothrow, info, rowBytes, std::move(ctable));
+ return NewUsing(sk_malloc_nothrow, info, rowBytes, ctable);
}
-sk_sp<SkPixelRef> SkMallocPixelRef::MakeZeroed(const SkImageInfo& info,
- size_t rowBytes,
- sk_sp<SkColorTable> ctable) {
- return MakeUsing(sk_calloc, info, rowBytes, std::move(ctable));
+SkMallocPixelRef* SkMallocPixelRef::NewZeroed(const SkImageInfo& info,
+ size_t rowBytes,
+ SkColorTable* ctable) {
+ return NewUsing(sk_calloc, info, rowBytes, ctable);
}
-static void sk_data_releaseproc(void*, void* dataPtr) {
- (static_cast<SkData*>(dataPtr))->unref();
-}
-
-sk_sp<SkPixelRef> SkMallocPixelRef::MakeWithProc(const SkImageInfo& info,
- size_t rowBytes,
- sk_sp<SkColorTable> ctable,
- void* addr,
- SkMallocPixelRef::ReleaseProc proc,
- void* context) {
- if (!is_valid(info, ctable.get())) {
+SkMallocPixelRef* SkMallocPixelRef::NewWithProc(const SkImageInfo& info,
+ size_t rowBytes,
+ SkColorTable* ctable,
+ void* addr,
+ SkMallocPixelRef::ReleaseProc proc,
+ void* context) {
+ if (!is_valid(info, ctable)) {
if (proc) {
proc(addr, context);
}
return nullptr;
}
- return sk_sp<SkPixelRef>(new SkMallocPixelRef(info, addr, rowBytes, std::move(ctable),
- proc, context));
+ return new SkMallocPixelRef(info, addr, rowBytes, ctable, proc, context);
}
-sk_sp<SkPixelRef> SkMallocPixelRef::MakeWithData(const SkImageInfo& info,
+static void sk_data_releaseproc(void*, void* dataPtr) {
+ (static_cast<SkData*>(dataPtr))->unref();
+}
+
+SkMallocPixelRef* SkMallocPixelRef::NewWithData(const SkImageInfo& info,
size_t rowBytes,
- sk_sp<SkColorTable> ctable,
- sk_sp<SkData> data) {
+ SkColorTable* ctable,
+ SkData* data) {
SkASSERT(data != nullptr);
- if (!is_valid(info, ctable.get())) {
+ if (!is_valid(info, ctable)) {
return nullptr;
}
if ((rowBytes < info.minRowBytes())
|| (data->size() < info.getSafeSize(rowBytes))) {
return nullptr;
}
- SkPixelRef* pr = new SkMallocPixelRef(info, const_cast<void*>(data->data()), rowBytes,
- std::move(ctable), sk_data_releaseproc, data.release());
- pr->setImmutable(); // since we were created with (immutable) data
- return sk_sp<SkPixelRef>(pr);
+ data->ref();
+ SkMallocPixelRef* pr =
+ new SkMallocPixelRef(info, const_cast<void*>(data->data()), rowBytes, ctable,
+ sk_data_releaseproc, static_cast<void*>(data));
+ SkASSERT(pr != nullptr);
+ // We rely on the immutability of the pixels to make the
+ // const_cast okay.
+ pr->setImmutable();
+ return pr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -146,47 +148,50 @@ SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
size_t rowBytes, SkColorTable* ctable,
bool ownsPixels)
: INHERITED(info)
- , fCTable(sk_ref_sp(ctable))
, fReleaseProc(ownsPixels ? sk_free_releaseproc : nullptr)
, fReleaseProcContext(nullptr) {
// This constructor is now DEPRICATED.
- SkASSERT(is_valid(info, fCTable.get()));
+ SkASSERT(is_valid(info, ctable));
SkASSERT(rowBytes >= info.minRowBytes());
if (kIndex_8_SkColorType != info.colorType()) {
- fCTable = nullptr;
+ ctable = nullptr;
}
fStorage = storage;
+ fCTable = ctable;
fRB = rowBytes;
+ SkSafeRef(ctable);
- this->setPreLocked(fStorage, rowBytes, fCTable.get());
+ this->setPreLocked(fStorage, rowBytes, fCTable);
}
SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
- size_t rowBytes, sk_sp<SkColorTable> ctable,
+ size_t rowBytes, SkColorTable* ctable,
SkMallocPixelRef::ReleaseProc proc,
void* context)
: INHERITED(info)
, fReleaseProc(proc)
, fReleaseProcContext(context)
{
- SkASSERT(is_valid(info, ctable.get()));
+ SkASSERT(is_valid(info, ctable));
SkASSERT(rowBytes >= info.minRowBytes());
if (kIndex_8_SkColorType != info.colorType()) {
- ctable.reset(nullptr);
+ ctable = nullptr;
}
fStorage = storage;
- fCTable = std::move(ctable);
+ fCTable = ctable;
fRB = rowBytes;
+ SkSafeRef(ctable);
- this->setPreLocked(fStorage, rowBytes, fCTable.get());
+ this->setPreLocked(fStorage, rowBytes, fCTable);
}
SkMallocPixelRef::~SkMallocPixelRef() {
+ SkSafeUnref(fCTable);
if (fReleaseProc != nullptr) {
fReleaseProc(fStorage, fReleaseProcContext);
}
@@ -195,7 +200,7 @@ SkMallocPixelRef::~SkMallocPixelRef() {
bool SkMallocPixelRef::onNewLockPixels(LockRec* rec) {
rec->fPixels = fStorage;
rec->fRowBytes = fRB;
- rec->fColorTable = fCTable.get();
+ rec->fColorTable = fCTable;
return true;
}
@@ -207,11 +212,14 @@ size_t SkMallocPixelRef::getAllocatedSizeInBytes() const {
return this->info().getSafeSize(fRB);
}
-#ifdef SK_SUPPORT_LEGACY_PIXELREFFACTORY
-SkMallocPixelRef* SkMallocPixelRef::NewWithData(const SkImageInfo& info,
- size_t rowBytes,
- SkColorTable* ctable,
- SkData* data) {
- return (SkMallocPixelRef*)MakeWithData(info, rowBytes, sk_ref_sp(ctable), sk_ref_sp(data)).release();
+///////////////////////////////////////////////////////////////////////////////
+
+SkPixelRef* SkMallocPixelRef::PRFactory::create(const SkImageInfo& info, size_t rowBytes,
+ SkColorTable* ctable) {
+ return SkMallocPixelRef::NewAllocate(info, rowBytes, ctable);
+}
+
+SkPixelRef* SkMallocPixelRef::ZeroedPRFactory::create(const SkImageInfo& info, size_t rowBytes,
+ SkColorTable* ctable) {
+ return SkMallocPixelRef::NewZeroed(info, rowBytes, ctable);
}
-#endif
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 40afb57cec..1f396a7ac2 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -98,8 +98,8 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeFromBitmap(const SkIRect& subset,
sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(const SkImageInfo& info,
const SkSurfaceProps* props) {
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeZeroed(info, 0, nullptr);
- if (!pr) {
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, 0, nullptr));
+ if (nullptr == pr.get()) {
return nullptr;
}
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index be60dee15e..0840d7c55e 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -10,7 +10,6 @@
#include "SkGradientShaderPriv.h"
#include "SkHalf.h"
#include "SkLinearGradient.h"
-#include "SkMallocPixelRef.h"
#include "SkRadialGradient.h"
#include "SkTwoPointConicalGradient.h"
#include "SkSweepGradient.h"
@@ -411,9 +410,12 @@ SkGradientShaderBase::GradientShaderCache::GradientShaderCache(
{
// Only initialize the cache in getCache32.
fCache32 = nullptr;
+ fCache32PixelRef = nullptr;
}
-SkGradientShaderBase::GradientShaderCache::~GradientShaderCache() {}
+SkGradientShaderBase::GradientShaderCache::~GradientShaderCache() {
+ SkSafeUnref(fCache32PixelRef);
+}
/*
* r,g,b used to be SkFixed, but on gcc (4.2.1 mac and 4.6.3 goobuntu) in
@@ -582,8 +584,8 @@ void SkGradientShaderBase::GradientShaderCache::initCache32(GradientShaderCache*
const SkImageInfo info = SkImageInfo::MakeN32Premul(kCache32Count, kNumberOfDitherRows);
SkASSERT(nullptr == cache->fCache32PixelRef);
- cache->fCache32PixelRef = SkMallocPixelRef::MakeAllocate(info, 0, nullptr);
- cache->fCache32 = (SkPMColor*)cache->fCache32PixelRef->pixels();
+ cache->fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, nullptr);
+ cache->fCache32 = (SkPMColor*)cache->fCache32PixelRef->getAddr();
if (cache->fShader.fColorCount == 2) {
Build32bitCache(cache->fCache32, cache->fShader.fOrigColors[0],
cache->fShader.fOrigColors[1], kCache32Count, cache->fCacheAlpha,
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index ec75bdc05a..f64b4396c2 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -16,6 +16,7 @@
#include "SkClampRange.h"
#include "SkColorPriv.h"
#include "SkColorSpace.h"
+#include "SkMallocPixelRef.h"
#include "SkOnce.h"
#include "SkReadBuffer.h"
#include "SkShader.h"
@@ -128,7 +129,7 @@ public:
const SkPMColor* getCache32();
- SkPixelRef* getCache32PixelRef() const { return fCache32PixelRef.get(); }
+ SkMallocPixelRef* getCache32PixelRef() const { return fCache32PixelRef; }
unsigned getAlpha() const { return fCacheAlpha; }
bool getDither() const { return fCacheDither; }
@@ -137,7 +138,7 @@ public:
// Working pointer. If it's nullptr, we need to recompute the cache values.
SkPMColor* fCache32;
- sk_sp<SkPixelRef> fCache32PixelRef;
+ SkMallocPixelRef* fCache32PixelRef;
const unsigned fCacheAlpha; // The alpha value we used when we computed the cache.
// Larger than 8bits so we can store uninitialized
// value.
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 92f5301061..4fae0f03c0 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -209,7 +209,7 @@ sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
return nullptr;
}
- sk_sp<SkPixelRef> pr = SkMallocPixelRef::MakeZeroed(info, rowBytes, nullptr);
+ sk_sp<SkPixelRef> pr(SkMallocPixelRef::NewZeroed(info, rowBytes, nullptr));
if (!pr) {
return nullptr;
}