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

Unified Diff: tests/PathOpsSkpClipTest.cpp

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rely on RVO in picturerecorder 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/ImageTest.cpp ('k') | tests/PictureBBHTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsSkpClipTest.cpp
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index 6d66a69e6dbcca09da3f8d357e22f7559b39c49f..d11f8e063418f594ca956fa9c527a17bdfca879e 100644
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -437,7 +437,7 @@ static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn
}
void TestResult::testOne() {
- SkPicture* pic = nullptr;
+ sk_sp<SkPicture> pic;
{
#if DEBUG_SHOW_TEST_NAME
if (fTestStep == kCompareBits) {
@@ -465,12 +465,12 @@ void TestResult::testOne() {
SkFILEStream stream(path.c_str());
if (!stream.isValid()) {
SkDebugf("invalid stream %s\n", path.c_str());
- goto finish;
+ return;
}
- pic = SkPicture::CreateFromStream(&stream);
+ pic = SkPicture::MakeFromStream(&stream);
if (!pic) {
SkDebugf("unable to decode %s\n", fFilename);
- goto finish;
+ return;
}
SkScalar width = pic->cullRect().width();
SkScalar height = pic->cullRect().height();
@@ -490,7 +490,7 @@ void TestResult::testOne() {
if (fScale >= 256) {
SkDebugf("unable to allocate bitmap for %s (w=%f h=%f)\n", fFilename,
width, height);
- goto finish;
+ return;
}
oldBitmap.eraseColor(SK_ColorWHITE);
SkCanvas oldCanvas(oldBitmap);
@@ -498,12 +498,12 @@ void TestResult::testOne() {
opBitmap.eraseColor(SK_ColorWHITE);
SkCanvas opCanvas(opBitmap);
opCanvas.setAllowSimplifyClip(true);
- drawPict(pic, &oldCanvas, fScale);
- drawPict(pic, &opCanvas, fScale);
+ drawPict(pic.get(), &oldCanvas, fScale);
+ drawPict(pic.get(), &opCanvas, fScale);
if (fTestStep == kCompareBits) {
fPixelError = similarBits(oldBitmap, opBitmap);
- int oldTime = timePict(pic, &oldCanvas);
- int opTime = timePict(pic, &opCanvas);
+ int oldTime = timePict(pic.get(), &oldCanvas);
+ int opTime = timePict(pic.get(), &opCanvas);
fTime = SkTMax(0, oldTime - opTime);
} else if (fTestStep == kEncodeFiles) {
SkString pngStr = make_png_name(fFilename);
@@ -512,10 +512,6 @@ void TestResult::testOne() {
writePict(opBitmap, outOpDir, pngName);
}
}
-finish:
- if (pic) {
- pic->unref();
- }
}
DEFINE_string2(match, m, "PathOpsSkpClipThreaded",
« no previous file with comments | « tests/ImageTest.cpp ('k') | tests/PictureBBHTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698