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

Unified Diff: tests/PictureTest.cpp

Issue 316143003: Remove SkPicture::kUsePathBoundsForClip_RecordingFlag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index f65c8408991c1dbfa9a4ef752c572da1239fe024..e28f39935e61d3860213b9e66ab44cd9d4a909ae 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -315,7 +315,7 @@ static SkPicture* record_bitmaps(const SkBitmap bm[],
int count,
DrawBitmapProc proc) {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(1000, 1000, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(1000, 1000);
for (int i = 0; i < count; ++i) {
analytic[i].rewind();
canvas->save();
@@ -671,17 +671,17 @@ static void test_gatherpixelrefsandrects(skiatest::Reporter* reporter) {
static void test_deleting_empty_playback() {
SkPictureRecorder recorder;
// Creates an SkPictureRecord
- recorder.beginRecording(0, 0, NULL, 0);
+ recorder.beginRecording(0, 0);
// Turns that into an SkPicturePlayback
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
// Deletes the old SkPicturePlayback, and creates a new SkPictureRecord
- recorder.beginRecording(0, 0, NULL, 0);
+ recorder.beginRecording(0, 0);
}
// Ensure that serializing an empty picture does not assert. Likewise only runs in debug mode.
static void test_serializing_empty_picture() {
SkPictureRecorder recorder;
- recorder.beginRecording(0, 0, NULL, 0);
+ recorder.beginRecording(0, 0);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
SkDynamicMemoryWStream stream;
picture->serialize(&stream);
@@ -713,7 +713,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
{
SkPath path;
path.moveTo(0, 0);
@@ -735,7 +735,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL, &reason));
REPORTER_ASSERT(reporter, NULL != reason);
- canvas = recorder.beginRecording(100, 100, NULL, 0);
+ canvas = recorder.beginRecording(100, 100);
{
SkPath path;
@@ -757,7 +757,7 @@ static void test_gpu_veto(skiatest::Reporter* reporter) {
// A lot of AA concave paths currently render an SkPicture undesireable for GPU rendering
REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
- canvas = recorder.beginRecording(100, 100, NULL, 0);
+ canvas = recorder.beginRecording(100, 100);
{
SkPath path;
@@ -811,7 +811,7 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
{
SkPictureRecorder recorder;
- SkCanvas* c = recorder.beginRecording(kWidth, kHeight, NULL, 0);
+ SkCanvas* c = recorder.beginRecording(kWidth, kHeight);
// 1)
c->saveLayer(NULL, NULL);
c->restore();
@@ -979,7 +979,7 @@ public:
static SkPicture* Copy(SkPictureRecorder* recorder) {
SkPictureRecorder recorder2;
- SkCanvas* canvas = recorder2.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder2.beginRecording(10, 10);
recorder->partialReplay(canvas);
@@ -993,7 +993,7 @@ DEF_TEST(PictureRecorder_replay, reporter) {
{
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->saveLayer(NULL, NULL);
@@ -1016,7 +1016,7 @@ DEF_TEST(PictureRecorder_replay, reporter) {
{
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
SkRect r = SkRect::MakeWH(5, 5);
SkPaint p;
@@ -1057,7 +1057,7 @@ static void test_unbalanced_save_restores(skiatest::Reporter* reporter) {
{
// Create picture with 2 unbalanced saves
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
canvas->save();
canvas->translate(10, 10);
canvas->drawRect(rect, paint);
@@ -1074,7 +1074,7 @@ static void test_unbalanced_save_restores(skiatest::Reporter* reporter) {
{
// Create picture with 2 unbalanced restores
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
canvas->save();
canvas->translate(10, 10);
canvas->drawRect(rect, paint);
@@ -1094,7 +1094,7 @@ static void test_unbalanced_save_restores(skiatest::Reporter* reporter) {
set_canvas_to_save_count_4(&testCanvas);
{
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
canvas->translate(10, 10);
canvas->drawRect(rect, paint);
SkAutoTUnref<SkPicture> noSavePicture(recorder.endRecording());
@@ -1113,7 +1113,7 @@ static void test_peephole() {
for (int j = 0; j < 100; j++) {
SkRandom rand2(rand); // remember the seed
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
for (int i = 0; i < 1000; ++i) {
rand_op(canvas, rand);
@@ -1124,7 +1124,7 @@ static void test_peephole() {
}
{
- SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
SkRect rect = SkRect::MakeWH(50, 50);
for (int i = 0; i < 100; ++i) {
@@ -1147,7 +1147,7 @@ static void test_bad_bitmap() {
SkBitmap bm;
bm.setInfo(SkImageInfo::MakeN32Premul(100, 100));
SkPictureRecorder recorder;
- SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, NULL, 0);
+ SkCanvas* recordingCanvas = recorder.beginRecording(100, 100);
recordingCanvas->drawBitmap(bm, 0, 0);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
@@ -1162,7 +1162,7 @@ static SkData* encode_bitmap_to_data(size_t*, const SkBitmap& bm) {
static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(bitmap.width(), bitmap.height(), NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(bitmap.width(), bitmap.height());
canvas->drawBitmap(bitmap, 0, 0);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
@@ -1228,7 +1228,7 @@ static void test_clone_empty(skiatest::Reporter* reporter) {
// had a picture with no paints. This test passes by not crashing.
{
SkPictureRecorder recorder;
- recorder.beginRecording(1, 1, NULL, 0);
+ recorder.beginRecording(1, 1);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
SkAutoTUnref<SkPicture> destPicture(picture->clone());
REPORTER_ASSERT(reporter, NULL != destPicture);
@@ -1244,7 +1244,7 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
{
// stock SkPicture
SkPictureRecorder recorder;
- recorder.beginRecording(1, 1, NULL, 0);
+ recorder.beginRecording(1, 1);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
canvas.drawPicture(picture);
@@ -1259,7 +1259,7 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
SkTileGridFactory factory(gridInfo);
SkPictureRecorder recorder;
- recorder.beginRecording(1, 1, &factory, 0);
+ recorder.beginRecording(1, 1, &factory);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
canvas.drawPicture(picture);
@@ -1269,7 +1269,7 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
// RTree
SkRTreeFactory factory;
SkPictureRecorder recorder;
- recorder.beginRecording(1, 1, &factory, 0);
+ recorder.beginRecording(1, 1, &factory);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
canvas.drawPicture(picture);
@@ -1279,7 +1279,7 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
// quad tree
SkQuadTreeFactory factory;
SkPictureRecorder recorder;
- recorder.beginRecording(1, 1, &factory, 0);
+ recorder.beginRecording(1, 1, &factory);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
canvas.drawPicture(picture);
@@ -1307,8 +1307,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
// Minimalist test set for 100% code coverage of
// SkPictureRecord::updateClipConservativelyUsingBounds
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL,
- SkPicture::kUsePathBoundsForClip_RecordingFlag);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipPath(invPath, SkRegion::kIntersect_Op);
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
REPORTER_ASSERT(reporter, true == nonEmpty);
@@ -1318,8 +1317,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight);
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL,
- SkPicture::kUsePathBoundsForClip_RecordingFlag);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipPath(path, SkRegion::kIntersect_Op);
canvas->clipPath(invPath, SkRegion::kIntersect_Op);
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
@@ -1330,8 +1328,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight);
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL,
- SkPicture::kUsePathBoundsForClip_RecordingFlag);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipPath(path, SkRegion::kIntersect_Op);
canvas->clipPath(invPath, SkRegion::kUnion_Op);
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
@@ -1342,8 +1339,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight);
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL,
- SkPicture::kUsePathBoundsForClip_RecordingFlag);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipPath(path, SkRegion::kDifference_Op);
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
REPORTER_ASSERT(reporter, true == nonEmpty);
@@ -1353,8 +1349,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 10 == clipBounds.fRight);
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL,
- SkPicture::kUsePathBoundsForClip_RecordingFlag);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipPath(path, SkRegion::kReverseDifference_Op);
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
// True clip is actually empty in this case, but the best
@@ -1367,8 +1362,7 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 8 == clipBounds.fRight);
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL,
- SkPicture::kUsePathBoundsForClip_RecordingFlag);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipPath(path, SkRegion::kIntersect_Op);
canvas->clipPath(path2, SkRegion::kXOR_Op);
bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
@@ -1426,7 +1420,7 @@ private:
static void test_clip_expansion(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clipRect(SkRect::MakeEmpty(), SkRegion::kReplace_Op);
// The following expanding clip should not be skipped.
@@ -1450,35 +1444,35 @@ static void test_hierarchical(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
- recorder.beginRecording(10, 10, NULL, 0);
+ recorder.beginRecording(10, 10);
SkAutoTUnref<SkPicture> childPlain(recorder.endRecording());
REPORTER_ASSERT(reporter, !childPlain->willPlayBackBitmaps()); // 0
- recorder.beginRecording(10, 10, NULL, 0)->drawBitmap(bm, 0, 0);
+ recorder.beginRecording(10, 10)->drawBitmap(bm, 0, 0);
SkAutoTUnref<SkPicture> childWithBitmap(recorder.endRecording());
REPORTER_ASSERT(reporter, childWithBitmap->willPlayBackBitmaps()); // 1
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->drawPicture(childPlain);
SkAutoTUnref<SkPicture> parentPP(recorder.endRecording());
REPORTER_ASSERT(reporter, !parentPP->willPlayBackBitmaps()); // 0
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->drawPicture(childWithBitmap);
SkAutoTUnref<SkPicture> parentPWB(recorder.endRecording());
REPORTER_ASSERT(reporter, parentPWB->willPlayBackBitmaps()); // 1
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->drawBitmap(bm, 0, 0);
canvas->drawPicture(childPlain);
SkAutoTUnref<SkPicture> parentWBP(recorder.endRecording());
REPORTER_ASSERT(reporter, parentWBP->willPlayBackBitmaps()); // 1
}
{
- SkCanvas* canvas = recorder.beginRecording(10, 10, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->drawBitmap(bm, 0, 0);
canvas->drawPicture(childWithBitmap);
SkAutoTUnref<SkPicture> parentWBWB(recorder.endRecording());
@@ -1495,7 +1489,7 @@ static void test_gen_id(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
- SkCanvas* canvas = recorder.beginRecording(1, 1, NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(1, 1);
canvas->drawARGB(255, 255, 255, 255);
SkAutoTUnref<SkPicture> hasData(recorder.endRecording());
// picture should have a non-zero id after recording
@@ -1582,7 +1576,7 @@ static void test_draw_bitmaps(SkCanvas* canvas) {
DEF_TEST(Picture_EmptyBitmap, r) {
SkPictureRecorder recorder;
- test_draw_bitmaps(recorder.beginRecording(10, 10, NULL, 0));
+ test_draw_bitmaps(recorder.beginRecording(10, 10));
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
}

Powered by Google App Engine
This is Rietveld 408576698