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

Unified Diff: tests/CanvasTest.cpp

Issue 214953003: split SkPictureRecorder out of SkPicture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: update to ToT (again) Created 6 years, 8 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
Index: tests/CanvasTest.cpp
===================================================================
--- tests/CanvasTest.cpp (revision 14159)
+++ tests/CanvasTest.cpp (working copy)
@@ -495,12 +495,13 @@
static void DrawPictureTestStep(SkCanvas* canvas,
skiatest::Reporter*,
CanvasTestStep*) {
- SkPicture* testPicture = SkNEW_ARGS(SkPicture, ());
- SkAutoUnref aup(testPicture);
- SkCanvas* testCanvas = testPicture->beginRecording(kWidth, kHeight);
+ SkPictureRecorder recorder;
+ SkCanvas* testCanvas = recorder.beginRecording(kWidth, kHeight);
testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1));
testCanvas->clipRect(kTestRect);
testCanvas->drawRect(kTestRect, kTestPaint);
+ SkAutoTUnref<SkPicture> testPicture(recorder.endRecording());
+
canvas->drawPicture(*testPicture);
}
TEST_STEP(DrawPicture, DrawPictureTestStep);
@@ -722,24 +723,23 @@
// Verify that when a test step is executed twice, no extra resources
// are flattened during the second execution
testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat);
- SkPicture referencePicture;
- SkCanvas* referenceCanvas = referencePicture.beginRecording(kWidth,
- kHeight, recordFlags);
+ SkPictureRecorder referenceRecorder;
+ SkCanvas* referenceCanvas = referenceRecorder.beginRecording(kWidth,
+ kHeight, recordFlags);
testStep->draw(referenceCanvas, reporter);
- SkPicture testPicture;
- SkCanvas* testCanvas = testPicture.beginRecording(kWidth,
- kHeight, recordFlags);
+
+ SkPictureRecorder testRecorder;
+ SkCanvas* testCanvas = testRecorder.beginRecording(kWidth,
+ kHeight, recordFlags);
testStep->draw(testCanvas, reporter);
testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat);
testStep->draw(testCanvas, reporter);
- SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(
- referenceCanvas);
- SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(
- testCanvas);
+ SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(referenceCanvas);
+ SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(testCanvas);
testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat);
AssertFlattenedObjectsEqual(referenceRecord, testRecord,
- reporter, testStep);
+ reporter, testStep);
}
};

Powered by Google App Engine
This is Rietveld 408576698