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

Unified Diff: tests/RecordReplaceDrawTest.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/RecordOptsTest.cpp ('k') | tests/RecordingXfermodeTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecordReplaceDrawTest.cpp
diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp
index 216f1ca85d169f4b67d5dff414bce6ad6add4a24..73c66476864dc049c58d4d66df2d6a106d0e48d4 100644
--- a/tests/RecordReplaceDrawTest.cpp
+++ b/tests/RecordReplaceDrawTest.cpp
@@ -33,7 +33,7 @@ private:
// Make sure the abort callback works
DEF_TEST(RecordReplaceDraw_Abort, r) {
- SkAutoTUnref<const SkPicture> pic;
+ sk_sp<SkPicture> pic;
{
// Record two commands.
@@ -43,14 +43,14 @@ DEF_TEST(RecordReplaceDraw_Abort, r) {
canvas->drawRect(SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight)), SkPaint());
canvas->clipRect(SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight)));
- pic.reset(recorder.endRecording());
+ pic = recorder.finishRecordingAsPicture();
}
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
JustOneDraw callback;
- GrRecordReplaceDraw(pic, &canvas, nullptr, SkMatrix::I(), &callback);
+ GrRecordReplaceDraw(pic.get(), &canvas, nullptr, SkMatrix::I(), &callback);
switch (rerecord.count()) {
case 3:
@@ -68,7 +68,7 @@ DEF_TEST(RecordReplaceDraw_Abort, r) {
// Make sure GrRecordReplaceDraw balances unbalanced saves
DEF_TEST(RecordReplaceDraw_Unbalanced, r) {
- SkAutoTUnref<const SkPicture> pic;
+ sk_sp<SkPicture> pic;
{
SkPictureRecorder recorder;
@@ -77,13 +77,13 @@ DEF_TEST(RecordReplaceDraw_Unbalanced, r) {
// We won't balance this, but GrRecordReplaceDraw will for us.
canvas->save();
canvas->scale(2, 2);
- pic.reset(recorder.endRecording());
+ pic = recorder.finishRecordingAsPicture();
}
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- GrRecordReplaceDraw(pic, &canvas, nullptr, SkMatrix::I(), nullptr/*callback*/);
+ GrRecordReplaceDraw(pic.get(), &canvas, nullptr, SkMatrix::I(), nullptr/*callback*/);
// ensure rerecord is balanced (in this case by checking that the count is odd)
REPORTER_ASSERT(r, (rerecord.count() & 1) == 1);
@@ -91,7 +91,7 @@ DEF_TEST(RecordReplaceDraw_Unbalanced, r) {
// Test out the layer replacement functionality with and w/o a BBH
void test_replacements(skiatest::Reporter* r, GrContext* context, bool doReplace) {
- SkAutoTUnref<const SkPicture> pic;
+ sk_sp<SkPicture> pic;
{
SkPictureRecorder recorder;
@@ -102,7 +102,7 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool doReplace
canvas->restore();
canvas->drawRect(SkRect::MakeWH(SkIntToScalar(kWidth / 2), SkIntToScalar(kHeight / 2)),
SkPaint());
- pic.reset(recorder.endRecording());
+ pic = recorder.finishRecordingAsPicture();
}
SkAutoTUnref<GrTexture> texture;
@@ -131,7 +131,7 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool doReplace
SkRecord rerecord;
SkRecorder canvas(&rerecord, kWidth, kHeight);
- GrRecordReplaceDraw(pic, &canvas, layerCache, SkMatrix::I(), nullptr/*callback*/);
+ GrRecordReplaceDraw(pic.get(), &canvas, layerCache, SkMatrix::I(), nullptr/*callback*/);
int numLayers = count_instances_of_type<SkRecords::SaveLayer>(rerecord);
if (doReplace) {
« no previous file with comments | « tests/RecordOptsTest.cpp ('k') | tests/RecordingXfermodeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698