aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2016-11-04 11:49:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-04 16:55:38 +0000
commit342b7acc46550af5fbefc6f9313231ede11ed692 (patch)
tree1077b67b06a35c49e93fd9a210204c597a6239df
parentd49128ab8ec6b3aadeb650074ddd8ddbdcce15eb (diff)
tests: s/SkAutoTUnref/sk_sp/
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4394 Change-Id: I088b3c6e2adff07abed1e8a50091cc0ec4a4109c Reviewed-on: https://skia-review.googlesource.com/4394 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
-rw-r--r--tests/BlurTest.cpp4
-rw-r--r--tests/CachedDataTest.cpp2
-rw-r--r--tests/CodecPriv.h2
-rw-r--r--tests/CodecTest.cpp4
-rw-r--r--tests/CopySurfaceTest.cpp7
-rw-r--r--tests/DataRefTest.cpp4
-rw-r--r--tests/DeviceTest.cpp2
-rw-r--r--tests/DiscardableMemoryPoolTest.cpp2
-rw-r--r--tests/DrawBitmapRectTest.cpp2
-rw-r--r--tests/DrawFilterTest.cpp4
-rw-r--r--tests/EGLImageTest.cpp7
-rw-r--r--tests/FlattenDrawableTest.cpp66
-rw-r--r--tests/FlattenableCustomFactory.cpp18
-rw-r--r--tests/FloatingPointTextureTest.cpp2
-rw-r--r--tests/FontMgrTest.cpp10
-rw-r--r--tests/FontNamesTest.cpp8
-rw-r--r--tests/GLProgramsTest.cpp12
-rw-r--r--tests/GifTest.cpp2
-rw-r--r--tests/GpuSampleLocationsTest.cpp4
-rw-r--r--tests/GrPorterDuffTest.cpp9
-rw-r--r--tests/GradientTest.cpp2
-rw-r--r--tests/ImageCacheTest.cpp3
-rw-r--r--tests/ImageFilterCacheTest.cpp10
-rw-r--r--tests/ImageTest.cpp16
-rw-r--r--tests/MallocPixelRefTest.cpp18
-rw-r--r--tests/MipMapTest.cpp6
-rw-r--r--tests/PackedConfigsTextureTest.cpp2
-rw-r--r--tests/PixelRefTest.cpp2
-rw-r--r--tests/PrimitiveProcessorTest.cpp10
-rw-r--r--tests/ReadWriteAlphaTest.cpp4
-rw-r--r--tests/RectangleTextureTest.cpp12
-rw-r--r--tests/ResourceCacheTest.cpp30
-rw-r--r--tests/SRGBMipMapTest.cpp4
-rw-r--r--tests/SRGBReadWritePixelsTest.cpp17
-rw-r--r--tests/SVGDeviceTest.cpp9
-rw-r--r--tests/SerializationTest.cpp15
-rw-r--r--tests/SkResourceCacheTest.cpp7
-rw-r--r--tests/SkpSkGrTest.cpp2
-rw-r--r--tests/SurfaceTest.cpp2
-rw-r--r--tests/TextBlobCacheTest.cpp4
-rw-r--r--tests/UtilsTest.cpp8
41 files changed, 171 insertions, 183 deletions
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 4ecc934915..2893a0c937 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -281,8 +281,8 @@ static bool gpu_blur_path(GrContext* context, const SkPath& path,
desc.fHeight = 30;
desc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> texture(grContext->createTexture(desc, false, nullptr, 0));
- SkAutoTUnref<SkGpuDevice> device(new SkGpuDevice (grContext, texture.get()));
+ sk_sp<GrTexture> texture(grContext->createTexture(desc, false, nullptr, 0));
+ sk_sp<SkGpuDevice> device(new SkGpuDevice(grContext, texture.get()));
SkCanvas canvas(device.get());
blur_path(&canvas, path, gaussianSigma);
diff --git a/tests/CachedDataTest.cpp b/tests/CachedDataTest.cpp
index 25024806de..b2d47855bd 100644
--- a/tests/CachedDataTest.cpp
+++ b/tests/CachedDataTest.cpp
@@ -72,7 +72,7 @@ static SkCachedData* test_locking(skiatest::Reporter* reporter,
* and when the cache is.
*/
DEF_TEST(CachedData, reporter) {
- SkAutoTUnref<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(1000));
+ sk_sp<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(1000));
for (int useDiscardable = 0; useDiscardable <= 1; ++useDiscardable) {
const size_t size = 100;
diff --git a/tests/CodecPriv.h b/tests/CodecPriv.h
index e9ea24261d..515dbdec2a 100644
--- a/tests/CodecPriv.h
+++ b/tests/CodecPriv.h
@@ -16,7 +16,7 @@ inline bool decode_memory(const void* mem, size_t size, SkBitmap* bm) {
}
// Construct a color table for the decode if necessary
- SkAutoTUnref<SkColorTable> colorTable(nullptr);
+ sk_sp<SkColorTable> colorTable(nullptr);
SkPMColor* colorPtr = nullptr;
int* colorCountPtr = nullptr;
int maxColors = 256;
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index c8b573a668..32ad959693 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -1091,7 +1091,7 @@ static bool alpha_type_match(SkAlphaType origAlphaType, SkAlphaType codecAlphaTy
static void check_round_trip(skiatest::Reporter* r, SkCodec* origCodec, const SkImageInfo& info) {
SkBitmap bm1;
SkPMColor colors[256];
- SkAutoTUnref<SkColorTable> colorTable1(new SkColorTable(colors, 256));
+ sk_sp<SkColorTable> colorTable1(new SkColorTable(colors, 256));
bm1.allocPixels(info, nullptr, colorTable1.get());
int numColors;
SkCodec::Result result = origCodec->getPixels(info, bm1.getPixels(), bm1.rowBytes(), nullptr,
@@ -1109,7 +1109,7 @@ static void check_round_trip(skiatest::Reporter* r, SkCodec* origCodec, const Sk
REPORTER_ASSERT(r, alpha_type_match(info.alphaType(), codec->getInfo().alphaType()));
SkBitmap bm2;
- SkAutoTUnref<SkColorTable> colorTable2(new SkColorTable(colors, 256));
+ sk_sp<SkColorTable> colorTable2(new SkColorTable(colors, 256));
bm2.allocPixels(info, nullptr, colorTable2.get());
result = codec->getPixels(info, bm2.getPixels(), bm2.rowBytes(), nullptr,
const_cast<SkPMColor*>(colorTable2->readColors()), &numColors);
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index 540d013c60..053b456f57 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -68,11 +68,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
dstDesc.fOrigin = dOrigin;
dstDesc.fFlags = dFlags;
- SkAutoTUnref<GrTexture> src(
+ sk_sp<GrTexture> src(
context->textureProvider()->createTexture(srcDesc, SkBudgeted::kNo,
srcPixels.get(),
kRowBytes));
- SkAutoTUnref<GrTexture> dst(
+ sk_sp<GrTexture> dst(
context->textureProvider()->createTexture(dstDesc, SkBudgeted::kNo,
dstPixels.get(),
kRowBytes));
@@ -82,7 +82,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
continue;
}
- bool result = context->copySurface(dst, src, srcRect, dstPoint);
+ bool result
+ = context->copySurface(dst.get(), src.get(), srcRect, dstPoint);
bool expectedResult = true;
SkIPoint dstOffset = { dstPoint.fX - srcRect.fLeft,
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 72bad6f948..ab33d8c09c 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -339,8 +339,8 @@ DEF_TEST(RWBuffer_size, r) {
SkRWBuffer buffer;
buffer.append(gABC, 26);
- SkAutoTUnref<SkROBuffer> roBuffer(buffer.newRBufferSnapshot());
- SkROBuffer::Iter iter(roBuffer);
+ sk_sp<SkROBuffer> roBuffer(buffer.newRBufferSnapshot());
+ SkROBuffer::Iter iter(roBuffer.get());
REPORTER_ASSERT(r, iter.data());
REPORTER_ASSERT(r, iter.size() == 26);
diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp
index f7d855a266..34140a7488 100644
--- a/tests/DeviceTest.cpp
+++ b/tests/DeviceTest.cpp
@@ -38,7 +38,7 @@ DEF_TEST(SpecialImage_BitmapDevice, reporter) {
SkImageInfo ii = SkImageInfo::MakeN32Premul(2*kWidth, 2*kHeight);
- SkAutoTUnref<SkBaseDevice> bmDev(SkBitmapDevice::Create(ii));
+ sk_sp<SkBaseDevice> bmDev(SkBitmapDevice::Create(ii));
SkBitmap bm;
bm.tryAllocN32Pixels(kWidth, kHeight);
diff --git a/tests/DiscardableMemoryPoolTest.cpp b/tests/DiscardableMemoryPoolTest.cpp
index d1ba38a857..79b257d1b0 100644
--- a/tests/DiscardableMemoryPoolTest.cpp
+++ b/tests/DiscardableMemoryPoolTest.cpp
@@ -9,7 +9,7 @@
#include "Test.h"
DEF_TEST(DiscardableMemoryPool, reporter) {
- SkAutoTUnref<SkDiscardableMemoryPool> pool(
+ sk_sp<SkDiscardableMemoryPool> pool(
SkDiscardableMemoryPool::Create(1, nullptr));
pool->setRAMBudget(3);
REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 2fbe1908c1..221f0c9b91 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -32,7 +32,7 @@ protected:
//
static void test_faulty_pixelref(skiatest::Reporter* reporter) {
// need a cache, but don't expect to use it, so the budget is not critical
- SkAutoTUnref<SkDiscardableMemoryPool> pool(
+ sk_sp<SkDiscardableMemoryPool> pool(
SkDiscardableMemoryPool::Create(10 * 1000, nullptr));
SkBitmap bm;
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
index ed23b701e5..27c9659e43 100644
--- a/tests/DrawFilterTest.cpp
+++ b/tests/DrawFilterTest.cpp
@@ -30,12 +30,12 @@ static void test_saverestore(skiatest::Reporter* reporter) {
auto surface(SkSurface::MakeRasterN32Premul(10, 10));
SkCanvas* canvas = surface->getCanvas();
- SkAutoTUnref<TestFilter> df(new TestFilter);
+ sk_sp<TestFilter> df(new TestFilter);
REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
canvas->save();
- canvas->setDrawFilter(df);
+ canvas->setDrawFilter(df.get());
REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter());
canvas->restore();
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 3d2ee05a8b..6301c51c82 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -75,10 +75,9 @@ static void test_copy_surface(skiatest::Reporter* reporter, GrContext* context,
copyDesc.fWidth = externalTexture->width();
copyDesc.fHeight = externalTexture->height();
copyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(
- copyDesc, SkBudgeted::kYes));
- context->copySurface(copy, externalTexture);
- test_read_pixels(reporter, context, copy, expectedPixelValues);
+ sk_sp<GrTexture> copy(context->textureProvider()->createTexture(copyDesc, SkBudgeted::kYes));
+ context->copySurface(copy.get(), externalTexture);
+ test_read_pixels(reporter, context, copy.get(), expectedPixelValues);
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
diff --git a/tests/FlattenDrawableTest.cpp b/tests/FlattenDrawableTest.cpp
index e70404b639..b4a551f259 100644
--- a/tests/FlattenDrawableTest.cpp
+++ b/tests/FlattenDrawableTest.cpp
@@ -102,17 +102,17 @@ public:
{}
void flatten(SkWriteBuffer& buffer) const override {
- buffer.writeFlattenable(fIntDrawable);
- buffer.writeFlattenable(fPaintDrawable);
+ buffer.writeFlattenable(fIntDrawable.get());
+ buffer.writeFlattenable(fPaintDrawable.get());
}
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer) {
- SkAutoTUnref<SkFlattenable> intDrawable(
+ sk_sp<SkFlattenable> intDrawable(
buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
SkASSERT(intDrawable);
SkASSERT(!strcmp("IntDrawable", intDrawable->getTypeName()));
- SkAutoTUnref<SkFlattenable> paintDrawable(
+ sk_sp<SkFlattenable> paintDrawable(
buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
SkASSERT(paintDrawable);
SkASSERT(!strcmp("PaintDrawable", paintDrawable->getTypeName()));
@@ -123,8 +123,8 @@ public:
Factory getFactory() const override { return CreateProc; }
- IntDrawable* intDrawable() const { return fIntDrawable; }
- PaintDrawable* paintDrawable() const { return fPaintDrawable; }
+ IntDrawable* intDrawable() const { return fIntDrawable.get(); }
+ PaintDrawable* paintDrawable() const { return fPaintDrawable.get(); }
const char* getTypeName() const override { return "CompoundDrawable"; }
@@ -133,8 +133,8 @@ protected:
void onDraw(SkCanvas*) override {}
private:
- SkAutoTUnref<IntDrawable> fIntDrawable;
- SkAutoTUnref<PaintDrawable> fPaintDrawable;
+ sk_sp<IntDrawable> fIntDrawable;
+ sk_sp<PaintDrawable> fPaintDrawable;
};
class RootDrawable : public SkDrawable {
@@ -154,23 +154,23 @@ public:
{}
void flatten(SkWriteBuffer& buffer) const override {
- buffer.writeFlattenable(fCompoundDrawable);
- buffer.writeFlattenable(fIntDrawable);
- buffer.writeFlattenable(fDrawable);
+ buffer.writeFlattenable(fCompoundDrawable.get());
+ buffer.writeFlattenable(fIntDrawable.get());
+ buffer.writeFlattenable(fDrawable.get());
}
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer) {
- SkAutoTUnref<SkFlattenable> compoundDrawable(
+ sk_sp<SkFlattenable> compoundDrawable(
buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
SkASSERT(compoundDrawable);
SkASSERT(!strcmp("CompoundDrawable", compoundDrawable->getTypeName()));
- SkAutoTUnref<SkFlattenable> intDrawable(
+ sk_sp<SkFlattenable> intDrawable(
buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
SkASSERT(intDrawable);
SkASSERT(!strcmp("IntDrawable", intDrawable->getTypeName()));
- SkAutoTUnref<SkFlattenable> drawable(
+ sk_sp<SkFlattenable> drawable(
buffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
SkASSERT(drawable);
@@ -181,9 +181,9 @@ public:
Factory getFactory() const override { return CreateProc; }
- CompoundDrawable* compoundDrawable() const { return fCompoundDrawable; }
- IntDrawable* intDrawable() const { return fIntDrawable; }
- SkDrawable* drawable() const { return fDrawable; }
+ CompoundDrawable* compoundDrawable() const { return fCompoundDrawable.get(); }
+ IntDrawable* intDrawable() const { return fIntDrawable.get(); }
+ SkDrawable* drawable() const { return fDrawable.get(); }
const char* getTypeName() const override { return "RootDrawable"; }
@@ -192,9 +192,9 @@ protected:
void onDraw(SkCanvas*) override {}
private:
- SkAutoTUnref<CompoundDrawable> fCompoundDrawable;
- SkAutoTUnref<IntDrawable> fIntDrawable;
- SkAutoTUnref<SkDrawable> fDrawable;
+ sk_sp<CompoundDrawable> fCompoundDrawable;
+ sk_sp<IntDrawable> fIntDrawable;
+ sk_sp<SkDrawable> fDrawable;
};
static void register_test_drawables(SkReadBuffer& buffer) {
@@ -206,12 +206,12 @@ static void register_test_drawables(SkReadBuffer& buffer) {
DEF_TEST(FlattenDrawable, r) {
// Create and serialize the test drawable
- SkAutoTUnref<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
+ sk_sp<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
SkPaint paint;
paint.setColor(SK_ColorBLUE);
- SkAutoTUnref<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable));
+ sk_sp<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable.get()));
SkBinaryWriteBuffer writeBuffer;
- writeBuffer.writeFlattenable(root);
+ writeBuffer.writeFlattenable(root.get());
// Copy the contents of the write buffer into a read buffer
sk_sp<SkData> data = SkData::MakeUninitialized(writeBuffer.bytesWritten());
@@ -220,8 +220,7 @@ DEF_TEST(FlattenDrawable, r) {
register_test_drawables(readBuffer);
// Deserialize and verify the drawable
- SkAutoTUnref<SkDrawable> out((SkDrawable*)
- readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
+ sk_sp<SkDrawable> out((SkDrawable*)readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
REPORTER_ASSERT(r, out);
REPORTER_ASSERT(r, !strcmp("RootDrawable", out->getTypeName()));
@@ -260,13 +259,13 @@ DEF_TEST(FlattenRecordedDrawable, r) {
canvas->drawText("TEXT", 4, 467.0f, 100.0f, textPaint);
// Draw some drawables as well
- SkAutoTUnref<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
- SkAutoTUnref<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable));
- canvas->drawDrawable(root, 747.0f, 242.0f);
- SkAutoTUnref<PaintDrawable> paintDrawable(new PaintDrawable(paint));
- canvas->drawDrawable(paintDrawable, 500.0, 500.0f);
- SkAutoTUnref<CompoundDrawable> comDrawable(new CompoundDrawable(13, 14, 15, 16, textPaint));
- canvas->drawDrawable(comDrawable, 10.0f, 10.0f);
+ sk_sp<SkDrawable> drawable(new IntDrawable(1, 2, 3, 4));
+ sk_sp<RootDrawable> root(new RootDrawable(5, 6, 7, 8, paint, 9, 10, 11, 12, drawable.get()));
+ canvas->drawDrawable(root.get(), 747.0f, 242.0f);
+ sk_sp<PaintDrawable> paintDrawable(new PaintDrawable(paint));
+ canvas->drawDrawable(paintDrawable.get(), 500.0, 500.0f);
+ sk_sp<CompoundDrawable> comDrawable(new CompoundDrawable(13, 14, 15, 16, textPaint));
+ canvas->drawDrawable(comDrawable.get(), 10.0f, 10.0f);
// Serialize the recorded drawable
sk_sp<SkDrawable> recordedDrawable = recorder.finishRecordingAsDrawable();
@@ -280,8 +279,7 @@ DEF_TEST(FlattenRecordedDrawable, r) {
register_test_drawables(readBuffer);
// Deserialize and verify the drawable
- SkAutoTUnref<SkDrawable> out((SkDrawable*)
- readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
+ sk_sp<SkDrawable> out((SkDrawable*)readBuffer.readFlattenable(SkFlattenable::kSkDrawable_Type));
REPORTER_ASSERT(r, out);
REPORTER_ASSERT(r, !strcmp("SkRecordedDrawable", out->getTypeName()));
}
diff --git a/tests/FlattenableCustomFactory.cpp b/tests/FlattenableCustomFactory.cpp
index 567331c892..e83311b398 100644
--- a/tests/FlattenableCustomFactory.cpp
+++ b/tests/FlattenableCustomFactory.cpp
@@ -53,12 +53,12 @@ static sk_sp<SkFlattenable> custom_create_proc(SkReadBuffer& buffer) {
DEF_TEST(UnflattenWithCustomFactory, r) {
// Create and flatten the test flattenable
SkBinaryWriteBuffer writeBuffer;
- SkAutoTUnref<SkFlattenable> flattenable1(new IntFlattenable(1, 2, 3, 4));
- writeBuffer.writeFlattenable(flattenable1);
- SkAutoTUnref<SkFlattenable> flattenable2(new IntFlattenable(2, 3, 4, 5));
- writeBuffer.writeFlattenable(flattenable2);
- SkAutoTUnref<SkFlattenable> flattenable3(new IntFlattenable(3, 4, 5, 6));
- writeBuffer.writeFlattenable(flattenable3);
+ sk_sp<SkFlattenable> flattenable1(new IntFlattenable(1, 2, 3, 4));
+ writeBuffer.writeFlattenable(flattenable1.get());
+ sk_sp<SkFlattenable> flattenable2(new IntFlattenable(2, 3, 4, 5));
+ writeBuffer.writeFlattenable(flattenable2.get());
+ sk_sp<SkFlattenable> flattenable3(new IntFlattenable(3, 4, 5, 6));
+ writeBuffer.writeFlattenable(flattenable3.get());
// Copy the contents of the write buffer into a read buffer
sk_sp<SkData> data = SkData::MakeUninitialized(writeBuffer.bytesWritten());
@@ -69,7 +69,7 @@ DEF_TEST(UnflattenWithCustomFactory, r) {
readBuffer.setCustomFactory(SkString("IntFlattenable"), &custom_create_proc);
// Unflatten and verify the flattenables
- SkAutoTUnref<IntFlattenable> out1((IntFlattenable*) readBuffer.readFlattenable(
+ sk_sp<IntFlattenable> out1((IntFlattenable*) readBuffer.readFlattenable(
SkFlattenable::kSkUnused_Type));
REPORTER_ASSERT(r, out1);
REPORTER_ASSERT(r, 2 == out1->a());
@@ -77,7 +77,7 @@ DEF_TEST(UnflattenWithCustomFactory, r) {
REPORTER_ASSERT(r, 4 == out1->c());
REPORTER_ASSERT(r, 5 == out1->d());
- SkAutoTUnref<IntFlattenable> out2((IntFlattenable*) readBuffer.readFlattenable(
+ sk_sp<IntFlattenable> out2((IntFlattenable*) readBuffer.readFlattenable(
SkFlattenable::kSkUnused_Type));
REPORTER_ASSERT(r, out2);
REPORTER_ASSERT(r, 3 == out2->a());
@@ -85,7 +85,7 @@ DEF_TEST(UnflattenWithCustomFactory, r) {
REPORTER_ASSERT(r, 5 == out2->c());
REPORTER_ASSERT(r, 6 == out2->d());
- SkAutoTUnref<IntFlattenable> out3((IntFlattenable*) readBuffer.readFlattenable(
+ sk_sp<IntFlattenable> out3((IntFlattenable*) readBuffer.readFlattenable(
SkFlattenable::kSkUnused_Type));
REPORTER_ASSERT(r, out3);
REPORTER_ASSERT(r, 4 == out3->a());
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 2e79c35d10..fe0368d55a 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -45,7 +45,7 @@ void runFPTest(skiatest::Reporter* reporter, GrContext* context,
desc.fConfig = config;
desc.fOrigin = 0 == origin ?
kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
- SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
+ sk_sp<GrTexture> fpTexture(context->textureProvider()->createTexture(
desc, SkBudgeted::kNo, controlPixelData.begin(), 0));
// Floating point textures are NOT supported everywhere
if (nullptr == fpTexture) {
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 172bff3a06..50e2d5a606 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -82,15 +82,15 @@ static void test_alias_names(skiatest::Reporter* reporter) {
}
static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
- SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+ sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
int count = fm->countFamilies();
for (int i = 0; i < count; ++i) {
SkString fname;
fm->getFamilyName(i, &fname);
- SkAutoTUnref<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str()));
- SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
+ sk_sp<SkFontStyleSet> fnset(fm->matchFamily(fname.c_str()));
+ sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
REPORTER_ASSERT(reporter, fnset->count() == set->count());
if (verbose) {
@@ -103,7 +103,7 @@ static void test_fontiter(skiatest::Reporter* reporter, bool verbose) {
set->getStyle(j, &fs, &sname);
// REPORTER_ASSERT(reporter, sname.size() > 0);
- SkAutoTUnref<SkTypeface> face(set->createTypeface(j));
+ sk_sp<SkTypeface> face(set->createTypeface(j));
// REPORTER_ASSERT(reporter, face.get());
if (verbose) {
@@ -691,7 +691,7 @@ static void test_matchStyleCSS3(skiatest::Reporter* reporter) {
for (StyleSetTest& test : tests) {
for (const StyleSetTest::Case& testCase : test.cases) {
- SkAutoTUnref<SkTypeface> typeface(test.styleSet.matchStyle(testCase.pattern));
+ sk_sp<SkTypeface> typeface(test.styleSet.matchStyle(testCase.pattern));
if (typeface) {
REPORTER_ASSERT(reporter, typeface->fontStyle() == testCase.expectedResult);
} else {
diff --git a/tests/FontNamesTest.cpp b/tests/FontNamesTest.cpp
index 5c314e4e7e..e5dce32a1a 100644
--- a/tests/FontNamesTest.cpp
+++ b/tests/FontNamesTest.cpp
@@ -142,16 +142,16 @@ static void test_synthetic(skiatest::Reporter* reporter, bool verbose) {
static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
static const SkFontTableTag nameTag = SkSetFourByteTag('n','a','m','e');
- SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+ sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
int count = SkMin32(fm->countFamilies(), MAX_FAMILIES);
for (int i = 0; i < count; ++i) {
- SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
+ sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
for (int j = 0; j < set->count(); ++j) {
SkString sname;
SkFontStyle fs;
set->getStyle(j, &fs, &sname);
- SkAutoTUnref<SkTypeface> typeface(set->createTypeface(j));
+ sk_sp<SkTypeface> typeface(set->createTypeface(j));
SkString familyName;
typeface->getFamilyName(&familyName);
@@ -159,7 +159,7 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
SkDebugf("[%s]\n", familyName.c_str());
}
- SkAutoTUnref<SkTypeface::LocalizedStrings> familyNamesIter(
+ sk_sp<SkTypeface::LocalizedStrings> familyNamesIter(
typeface->createFamilyNameIterator());
SkTypeface::LocalizedString familyNameLocalized;
while (familyNamesIter->next(&familyNameLocalized)) {
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 94afec1cc8..12a5b5cba6 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -298,13 +298,13 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
dummyDesc.fWidth = 34;
dummyDesc.fHeight = 18;
- SkAutoTUnref<GrTexture> dummyTexture1(
+ sk_sp<GrTexture> dummyTexture1(
context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nullptr, 0));
dummyDesc.fFlags = kNone_GrSurfaceFlags;
dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
dummyDesc.fWidth = 16;
dummyDesc.fHeight = 22;
- SkAutoTUnref<GrTexture> dummyTexture2(
+ sk_sp<GrTexture> dummyTexture2(
context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nullptr, 0));
if (!dummyTexture1 || ! dummyTexture2) {
@@ -330,7 +330,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
GrPaint grPaint;
- SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
+ sk_sp<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
GrProcessorTestData ptd(&random, context, context->caps(),
@@ -340,7 +340,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
bool snapToCenters = set_random_state(&grPaint, &random);
const GrUserStencilSettings* uss = get_random_stencil(&random);
- renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch, uss, snapToCenters);
+ renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get(), uss, snapToCenters);
}
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
drawingManager->flush();
@@ -361,7 +361,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
for (int i = 0; i < fpFactoryCnt; ++i) {
// Since FP factories internally randomize, call each 10 times.
for (int j = 0; j < 10; ++j) {
- SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
+ sk_sp<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
GrProcessorTestData ptd(&random, context, context->caps(),
renderTargetContext.get(), dummyTextures);
@@ -374,7 +374,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
BlockInputFragmentProcessor::Make(std::move(fp)));
grPaint.addColorFragmentProcessor(std::move(blockFP));
- renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get());
drawingManager->flush();
}
}
diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp
index 4e8fa2bce5..b06d3ead1c 100644
--- a/tests/GifTest.cpp
+++ b/tests/GifTest.cpp
@@ -205,7 +205,7 @@ DEF_TEST(Gif_Sampled, r) {
}
// Construct a color table for the decode if necessary
- SkAutoTUnref<SkColorTable> colorTable(nullptr);
+ sk_sp<SkColorTable> colorTable(nullptr);
SkPMColor* colorPtr = nullptr;
int* colorCountPtr = nullptr;
int maxColors = 256;
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index 275951b932..31ada9d968 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -205,8 +205,8 @@ private:
DEF_GPUTEST(GLSampleLocations, reporter, /*factory*/) {
GLTestSampleLocationsInterface testInterface;
- SkAutoTUnref<GrContext> ctx(GrContext::Create(kOpenGL_GrBackend, testInterface));
- test_sampleLocations(reporter, &testInterface, ctx);
+ sk_sp<GrContext> ctx(GrContext::Create(kOpenGL_GrBackend, testInterface));
+ test_sampleLocations(reporter, &testInterface, ctx.get());
}
#endif
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index ec57377a58..eb3c9bc186 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -70,12 +70,12 @@ public:
XPInfo(skiatest::Reporter* reporter, SkBlendMode xfermode, const GrCaps& caps,
const GrPipelineOptimizations& optimizations) {
sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(xfermode));
- SkAutoTUnref<GrXferProcessor> xp(
+ sk_sp<GrXferProcessor> xp(
xpf->createXferProcessor(optimizations, false, nullptr, caps));
TEST_ASSERT(!xpf->willNeedDstTexture(caps, optimizations));
xpf->getInvariantBlendedColor(optimizations.fColorPOI, &fBlendedColor);
fOptFlags = xp->getOptimizations(optimizations, false, nullptr, caps);
- GetXPOutputTypes(xp, &fPrimaryOutputType, &fSecondaryOutputType);
+ GetXPOutputTypes(xp.get(), &fPrimaryOutputType, &fSecondaryOutputType);
xp->getBlendInfo(&fBlendInfo);
TEST_ASSERT(!xp->willReadDstColor());
TEST_ASSERT(xp->hasSecondaryOutput() == GrBlendCoeffRefsSrc2(fBlendInfo.fDstBlend));
@@ -1124,8 +1124,7 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(SkBlendMode::kSrcOver));
TEST_ASSERT(!xpf->willNeedDstTexture(caps, opts));
- SkAutoTUnref<GrXferProcessor> xp(
- xpf->createXferProcessor(opts, false, nullptr, caps));
+ sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(opts, false, nullptr, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP with LCD coverage.");
return;
@@ -1199,7 +1198,7 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
sk_sp<GrXPFactory> xpf(GrPorterDuffXPFactory::Make(xfermode));
GrXferProcessor::DstTexture* dstTexture =
xpf->willNeedDstTexture(caps, optimizations) ? &fakeDstTexture : 0;
- SkAutoTUnref<GrXferProcessor> xp(
+ sk_sp<GrXferProcessor> xp(
xpf->createXferProcessor(optimizations, false, dstTexture, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP without dual source blending.");
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index 1e8f3936b3..ee776e3651 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -73,7 +73,7 @@ static void none_gradproc(skiatest::Reporter* reporter, const GradRec&, const Gr
}
static void color_gradproc(skiatest::Reporter* reporter, const GradRec& rec, const GradRec&) {
- SkAutoTUnref<SkShader> s(new SkColorShader(rec.fColors[0]));
+ sk_sp<SkShader> s(new SkColorShader(rec.fColors[0]));
REPORTER_ASSERT(reporter, SkShader::kColor_GradientType == s->asAGradient(nullptr));
SkShader::GradientInfo info;
diff --git a/tests/ImageCacheTest.cpp b/tests/ImageCacheTest.cpp
index c2cf2d9999..6d1e1ac86c 100644
--- a/tests/ImageCacheTest.cpp
+++ b/tests/ImageCacheTest.cpp
@@ -121,8 +121,7 @@ DEF_TEST(ImageCache, reporter) {
test_cache(reporter, cache, true);
}
{
- SkAutoTUnref<SkDiscardableMemoryPool> pool(
- SkDiscardableMemoryPool::Create(defLimit, nullptr));
+ sk_sp<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(defLimit, nullptr));
gPool = pool.get();
SkResourceCache cache(pool_factory);
test_cache(reporter, cache, true);
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 7ab64f5c0c..ebd3186e01 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -30,7 +30,7 @@ static void test_find_existing(skiatest::Reporter* reporter,
const sk_sp<SkSpecialImage>& image,
const sk_sp<SkSpecialImage>& subset) {
static const size_t kCacheSize = 1000000;
- SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+ sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
SkIRect clip = SkIRect::MakeWH(100, 100);
SkImageFilterCacheKey key1(0, SkMatrix::I(), clip, image->uniqueID(), image->subset());
@@ -54,7 +54,7 @@ static void test_dont_find_if_diff_key(skiatest::Reporter* reporter,
const sk_sp<SkSpecialImage>& image,
const sk_sp<SkSpecialImage>& subset) {
static const size_t kCacheSize = 1000000;
- SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+ sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
SkIRect clip1 = SkIRect::MakeWH(100, 100);
SkIRect clip2 = SkIRect::MakeWH(200, 200);
@@ -79,7 +79,7 @@ static void test_dont_find_if_diff_key(skiatest::Reporter* reporter,
static void test_internal_purge(skiatest::Reporter* reporter, const sk_sp<SkSpecialImage>& image) {
SkASSERT(image->getSize());
const size_t kCacheSize = image->getSize() + 10;
- SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+ sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
SkIRect clip = SkIRect::MakeWH(100, 100);
SkImageFilterCacheKey key1(0, SkMatrix::I(), clip, image->uniqueID(), image->subset());
@@ -104,7 +104,7 @@ static void test_explicit_purging(skiatest::Reporter* reporter,
const sk_sp<SkSpecialImage>& image,
const sk_sp<SkSpecialImage>& subset) {
static const size_t kCacheSize = 1000000;
- SkAutoTUnref<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
+ sk_sp<SkImageFilterCache> cache(SkImageFilterCache::Create(kCacheSize));
SkIRect clip = SkIRect::MakeWH(100, 100);
SkImageFilterCacheKey key1(0, SkMatrix::I(), clip, image->uniqueID(), image->subset());
@@ -191,7 +191,7 @@ static GrTexture* create_texture(GrContext* context) {
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
- SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.grContext()));
+ sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.grContext()));
if (!srcTexture) {
return;
}
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index f348ac4fcd..0acb428d7a 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -110,7 +110,7 @@ static sk_sp<SkImage> create_image_ct() {
SkPreMultiplyARGB(0x80, 0x00, 0xA0, 0xFF),
SkPreMultiplyARGB(0xFF, 0xBB, 0x00, 0xBB)
};
- SkAutoTUnref<SkColorTable> colorTable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
+ sk_sp<SkColorTable> colorTable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
uint8_t data[] = {
0, 0, 0, 0, 0,
0, 1, 1, 1, 0,
@@ -119,7 +119,7 @@ static sk_sp<SkImage> create_image_ct() {
0, 0, 0, 0, 0
};
SkImageInfo info = SkImageInfo::Make(5, 5, kIndex_8_SkColorType, kPremul_SkAlphaType);
- return SkImage::MakeRasterCopy(SkPixmap(info, data, 5, colorTable));
+ return SkImage::MakeRasterCopy(SkPixmap(info, data, 5, colorTable.get()));
}
static sk_sp<SkImage> create_picture_image() {
SkPictureRecorder recorder;
@@ -307,14 +307,14 @@ DEF_TEST(Image_NewRasterCopy, reporter) {
const SkPMColor green = SkPackARGB32(0xFF, 0, 0xFF, 0);
const SkPMColor blue = SkPackARGB32(0xFF, 0, 0, 0xFF);
SkPMColor colors[] = { red, green, blue, 0 };
- SkAutoTUnref<SkColorTable> ctable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
+ sk_sp<SkColorTable> ctable(new SkColorTable(colors, SK_ARRAY_COUNT(colors)));
// The colortable made a copy, so we can trash the original colors
memset(colors, 0xFF, sizeof(colors));
const SkImageInfo srcInfo = SkImageInfo::Make(2, 2, kIndex_8_SkColorType, kPremul_SkAlphaType);
const size_t srcRowBytes = 2 * sizeof(uint8_t);
uint8_t indices[] = { 0, 1, 2, 3 };
- sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(srcInfo, indices, srcRowBytes, ctable)));
+ auto image = SkImage::MakeRasterCopy(SkPixmap(srcInfo, indices, srcRowBytes, ctable.get()));
// The image made a copy, so we can trash the original indices
memset(indices, 0xFF, sizeof(indices));
@@ -556,11 +556,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_drawAbandonedGpuImage, reporter, c
DEF_TEST(ImageFromIndex8Bitmap, r) {
SkPMColor pmColors[1] = {SkPreMultiplyColor(SK_ColorWHITE)};
SkBitmap bm;
- SkAutoTUnref<SkColorTable> ctable(
- new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
- SkImageInfo info =
- SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType);
- bm.allocPixels(info, nullptr, ctable);
+ sk_sp<SkColorTable> ctable( new SkColorTable(pmColors, SK_ARRAY_COUNT(pmColors)));
+ SkImageInfo info = SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType);
+ bm.allocPixels(info, nullptr, ctable.get());
SkAutoLockPixels autoLockPixels(bm);
*bm.getAddr8(0, 0) = 0;
sk_sp<SkImage> img(SkImage::MakeFromBitmap(bm));
diff --git a/tests/MallocPixelRefTest.cpp b/tests/MallocPixelRefTest.cpp
index adc69148b0..09e1b934e9 100644
--- a/tests/MallocPixelRefTest.cpp
+++ b/tests/MallocPixelRefTest.cpp
@@ -24,7 +24,7 @@ DEF_TEST(MallocPixelRef, reporter) {
REPORTER_ASSERT(reporter, true);
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13);
{
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewAllocate(info, info.minRowBytes() - 1, nullptr));
// rowbytes too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
@@ -33,7 +33,7 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t rowBytes = info.minRowBytes() - 1;
size_t size = info.getSafeSize(rowBytes);
sk_sp<SkData> data(SkData::MakeUninitialized(size));
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
// rowbytes too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
@@ -42,7 +42,7 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t rowBytes = info.minRowBytes() + 2;
size_t size = info.getSafeSize(rowBytes) - 1;
sk_sp<SkData> data(SkData::MakeUninitialized(size));
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
// data too small.
REPORTER_ASSERT(reporter, nullptr == pr.get());
@@ -51,20 +51,20 @@ DEF_TEST(MallocPixelRef, reporter) {
size_t size = info.getSafeSize(rowBytes) + 9;
{
SkAutoMalloc memory(size);
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, memory.get() == pr->pixels());
}
{
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewAllocate(info, rowBytes, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
REPORTER_ASSERT(reporter, pr->pixels());
}
{
void* addr = static_cast<void*>(new uint8_t[size]);
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, pr.get() != nullptr);
@@ -73,7 +73,7 @@ DEF_TEST(MallocPixelRef, reporter) {
{
int x = 0;
SkAutoMalloc memory(size);
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr,
memory.get(), set_to_one_proc,
static_cast<void*>(&x)));
@@ -87,7 +87,7 @@ DEF_TEST(MallocPixelRef, reporter) {
{
void* addr = static_cast<void*>(new uint8_t[size]);
REPORTER_ASSERT(reporter, addr != nullptr);
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithProc(info, rowBytes, nullptr, addr,
delete_uint8_proc, nullptr));
REPORTER_ASSERT(reporter, addr == pr->pixels());
@@ -96,7 +96,7 @@ DEF_TEST(MallocPixelRef, reporter) {
sk_sp<SkData> data(SkData::MakeUninitialized(size));
SkData* dataPtr = data.get();
REPORTER_ASSERT(reporter, dataPtr->unique());
- SkAutoTUnref<SkMallocPixelRef> pr(
+ sk_sp<SkMallocPixelRef> pr(
SkMallocPixelRef::NewWithData(info, rowBytes, nullptr, data.get()));
REPORTER_ASSERT(reporter, !(dataPtr->unique()));
data.reset(nullptr);
diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp
index 2c0b61d596..4bcbb69697 100644
--- a/tests/MipMapTest.cpp
+++ b/tests/MipMapTest.cpp
@@ -23,7 +23,7 @@ DEF_TEST(MipMap, reporter) {
int width = 1 + rand.nextU() % 1000;
int height = 1 + rand.nextU() % 1000;
make_bitmap(&bm, width, height);
- SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
+ sk_sp<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
REPORTER_ASSERT(reporter, mm->countLevels() == SkMipMap::ComputeLevelCount(width, height));
REPORTER_ASSERT(reporter, !mm->extractLevel(SkSize::Make(SK_Scalar1, SK_Scalar1),
@@ -60,7 +60,7 @@ static void test_mipmap_generation(int width, int height, int expectedMipLevelCo
SkBitmap bm;
bm.allocN32Pixels(width, height);
bm.eraseColor(SK_ColorWHITE);
- SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
+ sk_sp<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
const int mipLevelCount = mm->countLevels();
REPORTER_ASSERT(reporter, mipLevelCount == expectedMipLevelCount);
@@ -90,7 +90,7 @@ DEF_TEST(MipMap_DirectLevelAccess, reporter) {
SkBitmap bm;
bm.allocN32Pixels(1, 1);
bm.eraseColor(SK_ColorWHITE);
- SkAutoTUnref<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
+ sk_sp<SkMipMap> mm(SkMipMap::Build(bm, SkSourceGammaTreatment::kIgnore, nullptr));
REPORTER_ASSERT(reporter, mm == nullptr);
}
diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp
index 89ca6acfcc..429f8afd14 100644
--- a/tests/PackedConfigsTextureTest.cpp
+++ b/tests/PackedConfigsTextureTest.cpp
@@ -116,7 +116,7 @@ void runTest(skiatest::Reporter* reporter, GrContext* context,
desc.fConfig = config;
desc.fOrigin = 0 == origin ?
kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
- SkAutoTUnref<GrTexture> fpTexture(context->textureProvider()->createTexture(
+ sk_sp<GrTexture> fpTexture(context->textureProvider()->createTexture(
desc, SkBudgeted::kNo, controlPixelData.begin(), 0));
SkASSERT(fpTexture);
fpTexture->readPixels(0, 0, DEV_W, DEV_H, kRGBA_8888_GrPixelConfig, readBuffer.begin(), 0);
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index 01e2ce5c0b..487e5195f3 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -69,7 +69,7 @@ private:
DEF_TEST(PixelRef_GenIDChange, r) {
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10);
- SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, nullptr));
+ sk_sp<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, nullptr));
// Register a listener.
int count = 0;
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index b48d5ea211..4900ed6e84 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -87,12 +87,12 @@ private:
private:
SkTArray<SkString> fAttribNames;
};
- SkAutoTUnref<GrGeometryProcessor> gp(new GP(fNumAttribs));
+ sk_sp<GrGeometryProcessor> gp(new GP(fNumAttribs));
QuadHelper helper;
size_t vertexStride = gp->getVertexStride();
SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, vertexStride, 1));
vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride);
- helper.recordDraw(target, gp);
+ helper.recordDraw(target, gp.get());
}
int fNumAttribs;
@@ -123,11 +123,11 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
#endif
- SkAutoTUnref<GrDrawBatch> batch;
+ sk_sp<GrDrawBatch> batch;
GrPaint grPaint;
// This one should succeed.
batch.reset(new Batch(attribCnt));
- renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get());
context->flush();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
@@ -136,7 +136,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
context->resetGpuStats();
// This one should fail.
batch.reset(new Batch(attribCnt+1));
- renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->priv().testingOnly_drawBatch(grPaint, batch.get());
context->flush();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 228277a7fb..c0b7e94854 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -50,7 +50,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
// We are initializing the texture with zeros here
memset(alphaData, 0, X_SIZE * Y_SIZE);
- SkAutoTUnref<GrTexture> texture(
+ sk_sp<GrTexture> texture(
ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo, alphaData,
0));
if (!texture) {
@@ -152,7 +152,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
rgbaData[y * X_SIZE + x] = GrColorPackRGBA(6, 7, 8, alphaData[y * X_SIZE + x]);
}
}
- SkAutoTUnref<GrTexture> texture(
+ sk_sp<GrTexture> texture(
ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo,
rgbaData, 0));
if (!texture) {
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index b542986b24..21540d99c0 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -59,10 +59,10 @@ static void test_copy_surface_src(skiatest::Reporter* reporter, GrContext* conte
copyDstDesc.fWidth = rectangleTexture->width();
copyDstDesc.fHeight = rectangleTexture->height();
copyDstDesc.fFlags = flags;
- SkAutoTUnref<GrTexture> dst(context->textureProvider()->createTexture(
- copyDstDesc, SkBudgeted::kYes));
- context->copySurface(dst, rectangleTexture);
- test_read_pixels(reporter, context, dst, expectedPixelValues);
+ sk_sp<GrTexture> dst(
+ context->textureProvider()->createTexture(copyDstDesc, SkBudgeted::kYes));
+ context->copySurface(dst.get(), rectangleTexture);
+ test_read_pixels(reporter, context, dst.get(), expectedPixelValues);
}
}
@@ -81,10 +81,10 @@ static void test_copy_surface_dst(skiatest::Reporter* reporter, GrContext* conte
copySrcDesc.fWidth = rectangleTexture->width();
copySrcDesc.fHeight = rectangleTexture->height();
copySrcDesc.fFlags = flags;
- SkAutoTUnref<GrTexture> src(context->textureProvider()->createTexture(
+ sk_sp<GrTexture> src(context->textureProvider()->createTexture(
copySrcDesc, SkBudgeted::kYes, pixels.get(), 0));
- context->copySurface(rectangleTexture, src);
+ context->copySurface(rectangleTexture, src.get());
test_read_pixels(reporter, context, rectangleTexture, pixels.get());
}
}
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 5a0f7e0124..6c55f8a1a4 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -103,12 +103,12 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
GrTextureProvider* cache = context->textureProvider();
GrResourceProvider* resourceProvider = context->resourceProvider();
// Test that two budgeted RTs with the same desc share a stencil buffer.
- SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, SkBudgeted::kYes));
+ sk_sp<GrTexture> smallRT0(cache->createTexture(smallDesc, SkBudgeted::kYes));
if (smallRT0 && smallRT0->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget());
}
- SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, SkBudgeted::kYes));
+ sk_sp<GrTexture> smallRT1(cache->createTexture(smallDesc, SkBudgeted::kYes));
if (smallRT1 && smallRT1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget());
}
@@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget()));
// An unbudgeted RT with the same desc should also share.
- SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, SkBudgeted::kNo));
+ sk_sp<GrTexture> smallRT2(cache->createTexture(smallDesc, SkBudgeted::kNo));
if (smallRT2 && smallRT2->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallRT2->asRenderTarget());
}
@@ -137,7 +137,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
bigDesc.fWidth = 400;
bigDesc.fHeight = 200;
bigDesc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, SkBudgeted::kNo));
+ sk_sp<GrTexture> bigRT(cache->createTexture(bigDesc, SkBudgeted::kNo));
if (bigRT && bigRT->asRenderTarget()) {
resourceProvider->attachStencilAttachment(bigRT->asRenderTarget());
}
@@ -151,7 +151,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
// An RT with a different sample count should not share.
GrSurfaceDesc smallMSAADesc = smallDesc;
smallMSAADesc.fSampleCnt = 4;
- SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+ sk_sp<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
if (smallMSAART0 && smallMSAART0->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget());
}
@@ -167,7 +167,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) !=
resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()));
// A second MSAA RT should share with the first MSAA RT.
- SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
+ sk_sp<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
}
@@ -184,7 +184,7 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl
smallMSAART0->asRenderTarget()->numColorSamples() < 8) {
smallMSAADesc.fSampleCnt = 8;
smallMSAART1.reset(cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
- SkAutoTUnref<GrTexture> smallMSAART1(
+ sk_sp<GrTexture> smallMSAART1(
cache->createTexture(smallMSAADesc, SkBudgeted::kNo));
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget());
@@ -360,10 +360,10 @@ public:
GrResourceCache* cache() { return fContext->getResourceCache(); }
- GrContext* context() { return fContext; }
+ GrContext* context() { return fContext.get(); }
private:
- SkAutoTUnref<GrContext> fContext;
+ sk_sp<GrContext> fContext;
};
static void test_no_key(skiatest::Reporter* reporter) {
@@ -881,7 +881,7 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
{
GrUniqueKey key2;
make_unique_key<0>(&key2, 0);
- SkAutoTUnref<TestResource> d(new TestResource(context->getGpu()));
+ sk_sp<TestResource> d(new TestResource(context->getGpu()));
int foo = 4132;
key2.setCustomData(SkData::MakeWithCopy(&foo, sizeof(foo)));
d->resourcePriv().setUniqueKey(key2);
@@ -889,7 +889,7 @@ static void test_duplicate_unique_key(skiatest::Reporter* reporter) {
GrUniqueKey key3;
make_unique_key<0>(&key3, 0);
- SkAutoTUnref<GrGpuResource> d2(cache->findAndRefUniqueResource(key3));
+ sk_sp<GrGpuResource> d2(cache->findAndRefUniqueResource(key3));
REPORTER_ASSERT(reporter, *(int*) d2->getUniqueKey().getCustomData()->data() == 4132);
}
@@ -1019,10 +1019,10 @@ static void test_resource_size_changed(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 200 == cache->getResourceBytes());
REPORTER_ASSERT(reporter, 2 == cache->getResourceCount());
{
- SkAutoTUnref<TestResource> find2(
+ sk_sp<TestResource> find2(
static_cast<TestResource*>(cache->findAndRefUniqueResource(key2)));
find2->setSize(200);
- SkAutoTUnref<TestResource> find1(
+ sk_sp<TestResource> find1(
static_cast<TestResource*>(cache->findAndRefUniqueResource(key1)));
find1->setSize(50);
}
@@ -1051,7 +1051,7 @@ static void test_resource_size_changed(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 2 == cache->getResourceCount());
{
- SkAutoTUnref<TestResource> find2(static_cast<TestResource*>(
+ sk_sp<TestResource> find2(static_cast<TestResource*>(
cache->findAndRefUniqueResource(key2)));
find2->setSize(201);
}
@@ -1300,7 +1300,7 @@ static void test_custom_data(skiatest::Reporter* reporter) {
static void test_abandoned(skiatest::Reporter* reporter) {
Mock mock(10, 300);
GrContext* context = mock.context();
- SkAutoTUnref<GrGpuResource> resource(new TestResource(context->getGpu()));
+ sk_sp<GrGpuResource> resource(new TestResource(context->getGpu()));
context->abandonContext();
REPORTER_ASSERT(reporter, resource->wasDestroyed());
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index b22e0b94b7..4261796001 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -117,7 +117,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
desc.fHeight = texS;
GrTextureProvider* texProvider = context->textureProvider();
- SkAutoTUnref<GrTexture> texture(texProvider->createTexture(desc, SkBudgeted::kNo, texData, 0));
+ sk_sp<GrTexture> texture(texProvider->createTexture(desc, SkBudgeted::kNo, texData, 0));
// Create two render target contexts (L32 and S32)
sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
@@ -131,7 +131,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
GrTextureParams mipMapParams(SkShader::kRepeat_TileMode, GrTextureParams::kMipMap_FilterMode);
- paint.addColorTextureProcessor(texture, nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
+ paint.addColorTextureProcessor(texture.get(), nullptr, SkMatrix::MakeScale(0.5f), mipMapParams);
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
paint.setGammaCorrect(true);
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 840575a1c4..429516710a 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -162,8 +162,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
desc.fConfig = kSRGBA_8888_GrPixelConfig;
if (context->caps()->isConfigRenderable(desc.fConfig, false) &&
context->caps()->isConfigTexturable(desc.fConfig)) {
- SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(
- desc, SkBudgeted::kNo));
+ sk_sp<GrTexture> tex(context->textureProvider()->createTexture(desc, SkBudgeted::kNo));
if (!tex) {
ERRORF(reporter, "Could not create SRGBA texture.");
return;
@@ -178,10 +177,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
// the shader.
float smallError = context->caps()->shaderCaps()->floatPrecisionVaries() ? 1.f :
0.0f;
- read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
check_srgb_to_linear_to_srgb_conversion, smallError,
"write/read srgba to srgba texture");
- read_and_check_pixels(reporter, tex, origData, kRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kRGBA_8888_GrPixelConfig,
check_srgb_to_linear_conversion, error,
"write srgba/read rgba with srgba texture");
} else {
@@ -191,10 +190,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
// Now verify that we can write linear data
if (tex->writePixels(0, 0, kW, kH, kRGBA_8888_GrPixelConfig, origData)) {
// We allow more error on GPUs with lower precision shader variables.
- read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
check_linear_to_srgb_conversion, error,
"write rgba/read srgba with srgba texture");
- read_and_check_pixels(reporter, tex, origData, kRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kRGBA_8888_GrPixelConfig,
check_linear_to_srgb_to_linear_conversion, error,
"write/read rgba with srgba texture");
} else {
@@ -210,10 +209,10 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
// Write srgba data to a rgba texture and read back as srgba and rgba
if (tex->writePixels(0, 0, kW, kH, kSRGBA_8888_GrPixelConfig, origData)) {
- read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
check_srgb_to_linear_to_srgb_conversion, error,
"write/read srgba to rgba texture");
- read_and_check_pixels(reporter, tex, origData, kRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kRGBA_8888_GrPixelConfig,
check_srgb_to_linear_conversion, error,
"write srgba/read rgba to rgba texture");
} else {
@@ -222,7 +221,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
// Write rgba data to a rgba texture and read back as srgba
if (tex->writePixels(0, 0, kW, kH, kRGBA_8888_GrPixelConfig, origData)) {
- read_and_check_pixels(reporter, tex, origData, kSRGBA_8888_GrPixelConfig,
+ read_and_check_pixels(reporter, tex.get(), origData, kSRGBA_8888_GrPixelConfig,
check_linear_to_srgb_conversion, 1.2f,
"write rgba/read srgba to rgba texture");
} else {
diff --git a/tests/SVGDeviceTest.cpp b/tests/SVGDeviceTest.cpp
index 494efbb3e7..b010e57909 100644
--- a/tests/SVGDeviceTest.cpp
+++ b/tests/SVGDeviceTest.cpp
@@ -91,8 +91,7 @@ void test_whitespace_pos(skiatest::Reporter* reporter,
{
SkXMLParserWriter writer(dom.beginParsing());
- SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100),
- &writer));
+ sk_sp<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100), &writer));
svgCanvas->drawText(txt, len, offset.x(), offset.y(), paint);
}
check_text_node(reporter, dom, dom.finishParsing(), offset, 0, expected);
@@ -104,8 +103,7 @@ void test_whitespace_pos(skiatest::Reporter* reporter,
}
SkXMLParserWriter writer(dom.beginParsing());
- SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100),
- &writer));
+ sk_sp<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100), &writer));
svgCanvas->drawPosTextH(txt, len, xpos, offset.y(), paint);
}
check_text_node(reporter, dom, dom.finishParsing(), offset, 1, expected);
@@ -117,8 +115,7 @@ void test_whitespace_pos(skiatest::Reporter* reporter,
}
SkXMLParserWriter writer(dom.beginParsing());
- SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100),
- &writer));
+ sk_sp<SkCanvas> svgCanvas(SkSVGCanvas::Create(SkRect::MakeWH(100, 100), &writer));
svgCanvas->drawPosText(txt, len, pos, paint);
}
check_text_node(reporter, dom, dom.finishParsing(), offset, 2, expected);
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 0e5e8ec4fa..3de422b969 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -290,7 +290,7 @@ static void TestXfermodeSerialization(skiatest::Reporter* reporter) {
}
auto mode(SkXfermode::Make(static_cast<SkXfermode::Mode>(i)));
REPORTER_ASSERT(reporter, mode);
- SkAutoTUnref<SkXfermode> copy(
+ sk_sp<SkXfermode> copy(
TestFlattenableSerialization<SkXfermode>(mode.get(), true, reporter));
}
}
@@ -301,7 +301,7 @@ static void TestColorFilterSerialization(skiatest::Reporter* reporter) {
table[i] = (i * 41) % 256;
}
auto colorFilter(SkTableColorFilter::Make(table));
- SkAutoTUnref<SkColorFilter> copy(
+ sk_sp<SkColorFilter> copy(
TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, reporter));
}
@@ -612,22 +612,22 @@ DEF_TEST(Serialization, reporter) {
sk_sp<SkShader> lightingShader = SkLightingShader::Make(diffuseShader,
normalSource,
fLights);
- SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+ sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
lightingShader = SkLightingShader::Make(std::move(diffuseShader),
nullptr,
fLights);
- SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+ sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
lightingShader = SkLightingShader::Make(nullptr,
std::move(normalSource),
fLights);
- SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+ sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
lightingShader = SkLightingShader::Make(nullptr,
nullptr,
fLights);
- SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
+ sk_sp<SkShader>(TestFlattenableSerialization(lightingShader.get(), true, reporter));
}
// Test NormalBevelSource serialization
@@ -635,8 +635,7 @@ DEF_TEST(Serialization, reporter) {
sk_sp<SkNormalSource> bevelSource = SkNormalSource::MakeBevel(
SkNormalSource::BevelType::kLinear, 2.0f, 5.0f);
- SkAutoTUnref<SkNormalSource>(TestFlattenableSerialization(bevelSource.get(), true,
- reporter));
+ sk_sp<SkNormalSource>(TestFlattenableSerialization(bevelSource.get(), true, reporter));
// TODO test equality?
}
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 615c7b4cd7..9275dff7d2 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -23,8 +23,8 @@ static void make_bitmap(SkBitmap* bitmap, const SkImageInfo& info, SkBitmap::All
bitmap->setInfo(info);
SkPMColor ctStorage[256];
memset(ctStorage, 0xFF, sizeof(ctStorage)); // init with opaque-white for the moment
- SkAutoTUnref<SkColorTable> ctable(new SkColorTable(ctStorage, 256));
- bitmap->allocPixels(allocator, ctable);
+ sk_sp<SkColorTable> ctable(new SkColorTable(ctStorage, 256));
+ bitmap->allocPixels(allocator, ctable.get());
} else if (allocator) {
bitmap->setInfo(info);
allocator->allocPixelRef(bitmap, 0);
@@ -260,8 +260,7 @@ DEF_TEST(BitmapCache_discarded_bitmap, reporter) {
testBitmapCache_discarded_bitmap(reporter, &cache, nullptr);
}
{
- SkAutoTUnref<SkDiscardableMemoryPool> pool(
- SkDiscardableMemoryPool::Create(byteLimit, nullptr));
+ sk_sp<SkDiscardableMemoryPool> pool(SkDiscardableMemoryPool::Create(byteLimit, nullptr));
gPool = pool.get();
SkResourceCache::DiscardableFactory factory = pool_factory;
SkResourceCache cache(factory);
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index d850daaf7f..c87926ecf8 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -444,7 +444,7 @@ void TestResult::testOne() {
desc.fWidth = dim.fX;
desc.fHeight = dim.fY;
desc.fSampleCnt = 0;
- SkAutoTUnref<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0));
+ sk_sp<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0));
if (!texture) {
SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename,
dim.fX, dim.fY);
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 9866358dff..b755a7ed77 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -764,7 +764,7 @@ static void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> su
std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
sk_memset32(pixels.get(), ~expectedValue, w * h);
- SkAutoTUnref<GrSurface> grSurface(SkSafeRef(grSurfaceGetter(surface.get())));
+ sk_sp<GrSurface> grSurface(SkSafeRef(grSurfaceGetter(surface.get())));
if (!grSurface) {
ERRORF(reporter, "Could access render target of GPU SkSurface.");
return;
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index 964a64ff29..995328d26d 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -66,7 +66,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContext* conte
SkCanvas* canvas = surface->getCanvas();
- SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+ sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
int count = SkMin32(fm->countFamilies(), maxFamilies);
@@ -85,7 +85,7 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContext* conte
SkString familyName;
fm->getFamilyName(i, &familyName);
- SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
+ sk_sp<SkFontStyleSet> set(fm->createStyleSet(i));
for (int j = 0; j < set->count(); ++j) {
SkFontStyle fs;
set->getStyle(j, &fs, nullptr);
diff --git a/tests/UtilsTest.cpp b/tests/UtilsTest.cpp
index b38bb9f90b..b6f90e03b5 100644
--- a/tests/UtilsTest.cpp
+++ b/tests/UtilsTest.cpp
@@ -29,7 +29,7 @@ static void test_autounref(skiatest::Reporter* reporter) {
RefClass obj(0);
REPORTER_ASSERT(reporter, obj.unique());
- SkAutoTUnref<RefClass> tmp(&obj);
+ sk_sp<RefClass> tmp(&obj);
REPORTER_ASSERT(reporter, &obj == tmp.get());
REPORTER_ASSERT(reporter, obj.unique());
@@ -41,7 +41,7 @@ static void test_autounref(skiatest::Reporter* reporter) {
obj.ref();
REPORTER_ASSERT(reporter, !obj.unique());
{
- SkAutoTUnref<RefClass> tmp2(&obj);
+ sk_sp<RefClass> tmp2(&obj);
}
REPORTER_ASSERT(reporter, obj.unique());
}
@@ -53,7 +53,7 @@ static void test_autostarray(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, obj1.unique());
{
- SkAutoSTArray<2, SkAutoTUnref<RefClass> > tmp;
+ SkAutoSTArray<2, sk_sp<RefClass> > tmp;
REPORTER_ASSERT(reporter, 0 == tmp.count());
tmp.reset(0); // test out reset(0) when already at 0
@@ -82,7 +82,7 @@ static void test_autostarray(skiatest::Reporter* reporter) {
{
// test out allocating ctor (this should allocate new memory)
- SkAutoSTArray<2, SkAutoTUnref<RefClass> > tmp(4);
+ SkAutoSTArray<2, sk_sp<RefClass> > tmp(4);
REPORTER_ASSERT(reporter, 4 == tmp.count());
tmp[0].reset(SkRef(&obj0));