diff options
author | robertphillips <robertphillips@google.com> | 2016-03-17 14:31:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-17 14:31:39 -0700 |
commit | 37bd7c3aca66697fff2db79c21771a0b3cbe3b4c (patch) | |
tree | daea856d5a7804f753abb63686e1e0f11a03452f /tests/SpecialSurfaceTest.cpp | |
parent | fc0b6d1053bb56698f2844bd5ca30bced7bb389d (diff) |
Switch SkSpecialImage & SkSpecialSurface classes over to smart pointers
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1812023002
Review URL: https://codereview.chromium.org/1812023002
Diffstat (limited to 'tests/SpecialSurfaceTest.cpp')
-rw-r--r-- | tests/SpecialSurfaceTest.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp index 580d2ddc87..cd4f0ae19b 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); |