Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Unified Diff: tests/SpecialSurfaceTest.cpp

Issue 1812023002: Switch SkSpecialImage & SkSpecialSurface classes over to smart pointers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/SpecialImageTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SpecialSurfaceTest.cpp
diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp
index 580d2ddc87e865c07f327fad481aa7b6098749bc..cd4f0ae19b6376dcfc4d911f07bdfa5e1f6af1f0 100644
--- a/tests/SpecialSurfaceTest.cpp
+++ b/tests/SpecialSurfaceTest.cpp
@@ -33,9 +33,11 @@ static const int kPad = 5;
static const int kFullSize = kSmallerSize + 2 * kPad;
// Exercise the public API of SkSpecialSurface (e.g., getCanvas, newImageSnapshot)
-static void test_surface(SkSpecialSurface* surf, skiatest::Reporter* reporter, int offset) {
+static void test_surface(const sk_sp<SkSpecialSurface>& surf,
+ skiatest::Reporter* reporter,
+ int offset) {
- const SkIRect surfSubset = TestingSpecialSurfaceAccess::Subset(surf);
+ const SkIRect surfSubset = TestingSpecialSurfaceAccess::Subset(surf.get());
REPORTER_ASSERT(reporter, offset == surfSubset.fLeft);
REPORTER_ASSERT(reporter, offset == surfSubset.fTop);
REPORTER_ASSERT(reporter, kSmallerSize == surfSubset.width());
@@ -46,10 +48,10 @@ static void test_surface(SkSpecialSurface* surf, skiatest::Reporter* reporter, i
canvas->clear(SK_ColorRED);
- SkAutoTUnref<SkSpecialImage> img(surf->newImageSnapshot());
+ sk_sp<SkSpecialImage> img(surf->makeImageSnapshot());
REPORTER_ASSERT(reporter, img);
- const SkIRect imgSubset = TestingSpecialSurfaceAccess::Subset(img);
+ const SkIRect imgSubset = TestingSpecialSurfaceAccess::Subset(img.get());
REPORTER_ASSERT(reporter, surfSubset == imgSubset);
// the canvas was invalidated by the newImageSnapshot call
@@ -59,7 +61,7 @@ static void test_surface(SkSpecialSurface* surf, skiatest::Reporter* reporter, i
DEF_TEST(SpecialSurface_Raster, reporter) {
SkImageInfo info = SkImageInfo::MakeN32(kSmallerSize, kSmallerSize, kOpaque_SkAlphaType);
- SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewRaster(nullptr, info));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRaster(nullptr, info));
test_surface(surf, reporter, 0);
}
@@ -71,7 +73,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) {
const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewFromBitmap(nullptr, subset, bm));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(nullptr, subset, bm));
test_surface(surf, reporter, kPad);
@@ -87,7 +89,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, context) {
desc.fWidth = kSmallerSize;
desc.fHeight = kSmallerSize;
- SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewRenderTarget(nullptr, context, desc));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(nullptr, context, desc));
test_surface(surf, reporter, 0);
}
@@ -105,7 +107,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, context) {
const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
- SkAutoTUnref<SkSpecialSurface> surf(SkSpecialSurface::NewFromTexture(nullptr, subset, temp));
+ sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(nullptr, subset, temp));
test_surface(surf, reporter, kPad);
« no previous file with comments | « tests/SpecialImageTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698