Remove DEPRECATED_beginRecording().
This removes:
1) ability to record old pictures with SkPictureRecorder;
2) a couple tests specific to the old backend.
The functionality of DEPRECATED_beginRecording() now lives in
(private) SkPicture::Backport(), which is the only place we
need it now.
BUG=skia:
TBR=reed@google.com
Review URL: https://codereview.chromium.org/618303002
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 216a408..5ec0b8f 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -121,10 +121,6 @@
static const char* const kDefaultAssertMessageFormat = "%s";
static const char* const kCanvasDrawAssertMessageFormat =
"Drawing test step %s with SkCanvas";
-static const char* const kPictureDrawAssertMessageFormat =
- "Drawing test step %s with SkPicture";
-static const char* const kPictureSecondDrawAssertMessageFormat =
- "Duplicate draw of test step %s with SkPicture";
static const char* const kDeferredDrawAssertMessageFormat =
"Drawing test step %s with SkDeferredCanvas";
static const char* const kProxyDrawAssertMessageFormat =
@@ -137,8 +133,6 @@
"test step %s, SkDeferredCanvas playback canvas state consistency after flush";
static const char* const kDeferredPostSilentFlushPlaybackAssertMessageFormat =
"test step %s, SkDeferredCanvas playback canvas state consistency after silent flush";
-static const char* const kPictureResourceReuseMessageFormat =
- "test step %s, SkPicture duplicate flattened object test";
static const char* const kProxyStateAssertMessageFormat =
"test step %s, SkProxyCanvas state consistency";
static const char* const kProxyIndirectStateAssertMessageFormat =
@@ -463,7 +457,7 @@
skiatest::Reporter*,
CanvasTestStep*) {
SkPictureRecorder recorder;
- SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntToScalar(kHeight),
+ SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntToScalar(kHeight),
NULL, 0);
testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1));
testCanvas->clipRect(kTestRect);
@@ -678,37 +672,6 @@
*/
}
-
-public:
-
- static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter,
- CanvasTestStep* testStep,
- uint32_t recordFlags) {
- // Verify that when a test step is executed twice, no extra resources
- // are flattened during the second execution
- testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat);
- SkPictureRecorder referenceRecorder;
- SkCanvas* referenceCanvas =
- referenceRecorder.DEPRECATED_beginRecording(SkIntToScalar(kWidth),
- SkIntToScalar(kHeight),
- NULL, recordFlags);
- testStep->draw(referenceCanvas, reporter);
-
- SkPictureRecorder testRecorder;
- SkCanvas* testCanvas =
- testRecorder.DEPRECATED_beginRecording(SkIntToScalar(kWidth),
- SkIntToScalar(kHeight),
- NULL, recordFlags);
- testStep->draw(testCanvas, reporter);
- testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat);
- testStep->draw(testCanvas, reporter);
-
- SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(referenceCanvas);
- SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(testCanvas);
- testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat);
- AssertFlattenedObjectsEqual(referenceRecord, testRecord,
- reporter, testStep);
- }
};
static void TestPdfDevice(skiatest::Reporter* reporter,
@@ -908,8 +871,6 @@
for (int testStep = 0; testStep < testStepArray().count(); testStep++) {
TestOverrideStateConsistency(reporter, testStepArray()[testStep]);
- SkPictureTester::TestPictureFlattenedObjectReuse(reporter,
- testStepArray()[testStep], 0);
if (testStepArray()[testStep]->enablePdfTesting()) {
TestPdfDevice(reporter, testStepArray()[testStep]);
}
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 9cd63df..c41b327 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -579,22 +579,18 @@
}
}
-#define GENERATE_CANVAS(recorder, x) \
- (x) ? recorder.EXPERIMENTAL_beginRecording(100, 100) \
- : recorder. DEPRECATED_beginRecording(100,100);
-
/* Hit a few SkPicture::Analysis cases not handled elsewhere. */
-static void test_analysis(skiatest::Reporter* reporter, bool useNewPath) {
+static void test_analysis(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
- SkCanvas* canvas = GENERATE_CANVAS(recorder, useNewPath);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
{
canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ());
}
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
REPORTER_ASSERT(reporter, !picture->willPlayBackBitmaps());
- canvas = GENERATE_CANVAS(recorder, useNewPath);
+ canvas = recorder.beginRecording(100, 100);
{
SkPaint paint;
// CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader
@@ -745,12 +741,10 @@
#if SK_SUPPORT_GPU
-static void test_gpu_veto(skiatest::Reporter* reporter,
- bool useNewPath) {
-
+static void test_gpu_veto(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
- SkCanvas* canvas = GENERATE_CANVAS(recorder, useNewPath);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
{
SkPath path;
path.moveTo(0, 0);
@@ -772,7 +766,7 @@
REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reason));
REPORTER_ASSERT(reporter, reason);
- canvas = GENERATE_CANVAS(recorder, useNewPath);
+ canvas = recorder.beginRecording(100, 100);
{
SkPath path;
@@ -794,7 +788,7 @@
// A lot of AA concave paths currently render an SkPicture undesireable for GPU rendering
REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
- canvas = GENERATE_CANVAS(recorder, useNewPath);
+ canvas = recorder.beginRecording(100, 100);
{
SkPath path;
@@ -818,7 +812,7 @@
// hairline stroked AA concave paths are fine for GPU rendering
REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
- canvas = GENERATE_CANVAS(recorder, useNewPath);
+ canvas = recorder.beginRecording(100, 100);
{
SkPaint paint;
SkScalar intervals [] = { 10, 20 };
@@ -832,7 +826,7 @@
// fast-path dashed effects are fine for GPU rendering ...
REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
- canvas = GENERATE_CANVAS(recorder, useNewPath);
+ canvas = recorder.beginRecording(100, 100);
{
SkPaint paint;
SkScalar intervals [] = { 10, 20 };
@@ -846,19 +840,14 @@
REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
// Nest the previous picture inside a new one.
- // This doesn't work in the old backend.
- if (useNewPath) {
- canvas = GENERATE_CANVAS(recorder, useNewPath);
- {
- canvas->drawPicture(picture.get());
- }
- picture.reset(recorder.endRecording());
- REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
+ canvas = recorder.beginRecording(100, 100);
+ {
+ canvas->drawPicture(picture.get());
}
+ picture.reset(recorder.endRecording());
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
}
-#undef GENERATE_CANVAS
-
static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
GrContextFactory* factory) {
for (int i= 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
@@ -1072,12 +1061,10 @@
#endif
-static void test_has_text(skiatest::Reporter* reporter, bool useNewPath) {
+static void test_has_text(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
-#define BEGIN_RECORDING useNewPath ? recorder.EXPERIMENTAL_beginRecording(100, 100) \
- : recorder. DEPRECATED_beginRecording(100, 100)
- SkCanvas* canvas = BEGIN_RECORDING;
+ SkCanvas* canvas = recorder.beginRecording(100,100);
{
canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint());
}
@@ -1085,28 +1072,28 @@
REPORTER_ASSERT(reporter, !picture->hasText());
SkPoint point = SkPoint::Make(10, 10);
- canvas = BEGIN_RECORDING;
+ canvas = recorder.beginRecording(100,100);
{
canvas->drawText("Q", 1, point.fX, point.fY, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = BEGIN_RECORDING;
+ canvas = recorder.beginRecording(100,100);
{
canvas->drawPosText("Q", 1, &point, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = BEGIN_RECORDING;
+ canvas = recorder.beginRecording(100,100);
{
canvas->drawPosTextH("Q", 1, &point.fX, point.fY, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = BEGIN_RECORDING;
+ canvas = recorder.beginRecording(100,100);
{
SkPath path;
path.moveTo(0, 0);
@@ -1117,7 +1104,7 @@
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = BEGIN_RECORDING;
+ canvas = recorder.beginRecording(100,100);
{
SkPath path;
path.moveTo(0, 0);
@@ -1129,16 +1116,12 @@
REPORTER_ASSERT(reporter, picture->hasText());
// Nest the previous picture inside a new one.
- // This doesn't work in the old backend.
- if (useNewPath) {
- canvas = BEGIN_RECORDING;
- {
- canvas->drawPicture(picture.get());
- }
- picture.reset(recorder.endRecording());
- REPORTER_ASSERT(reporter, picture->hasText());
+ canvas = recorder.beginRecording(100,100);
+ {
+ canvas->drawPicture(picture.get());
}
-#undef BEGIN_RECORDING
+ picture.reset(recorder.endRecording());
+ REPORTER_ASSERT(reporter, picture->hasText());
}
static void set_canvas_to_save_count_4(SkCanvas* canvas) {
@@ -1775,13 +1758,10 @@
test_unbalanced_save_restores(reporter);
test_peephole();
#if SK_SUPPORT_GPU
- test_gpu_veto(reporter, false);
- test_gpu_veto(reporter, true);
+ test_gpu_veto(reporter);
#endif
- test_has_text(reporter, false);
- test_has_text(reporter, true);
- test_analysis(reporter, false);
- test_analysis(reporter, true);
+ test_has_text(reporter);
+ test_analysis(reporter);
test_gatherpixelrefs(reporter);
test_gatherpixelrefsandrects(reporter);
test_bitmap_with_encoded_data(reporter);