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

Unified Diff: tests/SkpSkGrTest.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/SkResourceCacheTest.cpp ('k') | tools/VisualBench/VisualBenchmarkStream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkpSkGrTest.cpp
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 67a6b26b2b81de622a8d5da057ba85b012c32cfb..23bec84b8f585016d82131194caf27db034b0c2f 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -378,7 +378,7 @@ static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn
}
void TestResult::testOne() {
- SkPicture* pic = nullptr;
+ sk_sp<SkPicture> pic;
{
SkString d;
d.printf(" {%d, \"%s\"},", fDirNo, fFilename);
@@ -399,7 +399,7 @@ void TestResult::testOne() {
wStream.write(&bytes[0], length);
wStream.flush();
}
- pic = SkPicture::CreateFromStream(&stream);
+ pic = SkPicture::MakeFromStream(&stream);
if (!pic) {
SkDebugf("unable to decode %s\n", fFilename);
goto finish;
@@ -436,7 +436,7 @@ void TestResult::testOne() {
if (scale >= 256) {
SkDebugf("unable to allocate bitmap for %s (w=%d h=%d) (sw=%d sh=%d)\n",
fFilename, pWidth, pHeight, dim.fX, dim.fY);
- goto finish;
+ return;
}
SkCanvas skCanvas(bitmap);
drawPict(pic, &skCanvas, fScaleOversized ? scale : 1);
@@ -450,11 +450,11 @@ void TestResult::testOne() {
if (!texture) {
SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename,
dim.fX, dim.fY);
- goto finish;
+ return;
}
SkGpuDevice grDevice(context, texture.get());
SkCanvas grCanvas(&grDevice);
- drawPict(pic, &grCanvas, fScaleOversized ? scale : 1);
+ drawPict(pic.get(), &grCanvas, fScaleOversized ? scale : 1);
SkBitmap grBitmap;
grBitmap.allocPixels(grCanvas.imageInfo());
@@ -472,8 +472,6 @@ void TestResult::testOne() {
writePict(bitmap, outSkDir, pngName);
}
}
-finish:
- delete pic;
}
static SkString makeStatusString(int dirNo) {
« no previous file with comments | « tests/SkResourceCacheTest.cpp ('k') | tools/VisualBench/VisualBenchmarkStream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698