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/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);