aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-29 16:52:40 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-29 16:52:40 +0000
commita095041f5148dd1e71f38d0546335ed94199104b (patch)
tree63730963cc5cb4be0430263ed195b217e0341e04 /tests
parentcac02e52cda552fc792b0035a8b03b08c33ed35d (diff)
Remove SkRecorder's kWriteOnly mode.
I'm soon going to have SkRecorder start calling getTotalMatrix(), which would be broken in write-only mode. That change is big and nebulous, but it's clear kWriteOnly needs to go, so we might as well kill it now. My notes in bench_playback about kWriteOnly mode being important were probably overly cautious. I now think this is a fair enough comparison even re-recording into a read-write canvas. BUG=skia:2378 R=fmalita@chromium.org, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/290653004 git-svn-id: http://skia.googlecode.com/svn/trunk@14963 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/RecordDrawTest.cpp10
-rw-r--r--tests/RecordOptsTest.cpp16
-rw-r--r--tests/RecordPatternTest.cpp14
-rw-r--r--tests/RecorderTest.cpp4
4 files changed, 22 insertions, 22 deletions
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index b0e55a6fdb..b13b3a1acf 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -29,14 +29,14 @@ static void draw_pos_text_h(SkCanvas* canvas, const char* text, SkScalar y) {
// Rerecord into another SkRecord using full SkCanvas semantics,
// tracking clips and allowing SkRecordDraw's quickReject() calls to work.
static void record_clipped(const SkRecord& record, SkRect clip, SkRecord* clipped) {
- SkRecorder recorder(SkRecorder::kReadWrite_Mode, clipped, W, H);
+ SkRecorder recorder(clipped, W, H);
recorder.clipRect(clip);
SkRecordDraw(record, &recorder);
}
DEF_TEST(RecordDraw_PosTextHQuickReject, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
draw_pos_text_h(&recorder, "This will draw.", 20);
draw_pos_text_h(&recorder, "This won't.", 5000);
@@ -53,7 +53,7 @@ DEF_TEST(RecordDraw_PosTextHQuickReject, r) {
DEF_TEST(RecordDraw_Culling, r) {
// Record these 7 drawing commands verbatim.
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
recorder.pushCull(SkRect::MakeWH(100, 100));
recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint());
@@ -78,14 +78,14 @@ DEF_TEST(RecordDraw_Culling, r) {
DEF_TEST(RecordDraw_SetMatrixClobber, r) {
// Set up an SkRecord that just scales by 2x,3x.
SkRecord scaleRecord;
- SkRecorder scaleCanvas(SkRecorder::kReadWrite_Mode, &scaleRecord, W, H);
+ SkRecorder scaleCanvas(&scaleRecord, W, H);
SkMatrix scale;
scale.setScale(2, 3);
scaleCanvas.setMatrix(scale);
// Set up an SkRecord with an initial +20, +20 translate.
SkRecord translateRecord;
- SkRecorder translateCanvas(SkRecorder::kReadWrite_Mode, &translateRecord, W, H);
+ SkRecorder translateCanvas(&translateRecord, W, H);
SkMatrix translate;
translate.setTranslate(20, 20);
translateCanvas.setMatrix(translate);
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index d4ad73931b..6a9f08ad38 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -18,7 +18,7 @@ static const int W = 1920, H = 1080;
DEF_TEST(RecordOpts_Culling, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
recorder.drawRect(SkRect::MakeWH(1000, 10000), SkPaint());
@@ -38,7 +38,7 @@ DEF_TEST(RecordOpts_Culling, r) {
DEF_TEST(RecordOpts_NoopCulls, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
// All should be nooped.
recorder.pushCull(SkRect::MakeWH(200, 200));
@@ -77,7 +77,7 @@ static void draw_pos_text(SkCanvas* canvas, const char* text, bool constantY) {
DEF_TEST(RecordOpts_StrengthReduction, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
// We can convert a drawPosText into a drawPosTextH when all the Ys are the same.
draw_pos_text(&recorder, "This will be reduced to drawPosTextH.", true);
@@ -91,7 +91,7 @@ DEF_TEST(RecordOpts_StrengthReduction, r) {
DEF_TEST(RecordOpts_TextBounding, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
// First, get a drawPosTextH. Here's a handy way. Its text size will be the default (12).
draw_pos_text(&recorder, "This will be reduced to drawPosTextH.", true);
@@ -114,7 +114,7 @@ DEF_TEST(RecordOpts_TextBounding, r) {
DEF_TEST(RecordOpts_NoopDrawSaveRestore, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
// The save and restore are pointless if there's only draw commands in the middle.
recorder.save();
@@ -136,7 +136,7 @@ DEF_TEST(RecordOpts_NoopDrawSaveRestore, r) {
DEF_TEST(RecordOpts_SingleNoopSaveRestore, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
recorder.save();
recorder.clipRect(SkRect::MakeWH(200, 200));
@@ -150,7 +150,7 @@ DEF_TEST(RecordOpts_SingleNoopSaveRestore, r) {
DEF_TEST(RecordOpts_NoopSaveRestores, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
// The second pass will clean up this pair after the first pass noops all the innards.
recorder.save();
@@ -187,7 +187,7 @@ static void assert_savelayer_restore(skiatest::Reporter* r,
DEF_TEST(RecordOpts_NoopSaveLayerDrawRestore, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
+ SkRecorder recorder(&record, W, H);
SkRect bounds = SkRect::MakeWH(100, 200);
SkRect draw = SkRect::MakeWH(50, 60);
diff --git a/tests/RecordPatternTest.cpp b/tests/RecordPatternTest.cpp
index b0904ab7d6..5f4d006683 100644
--- a/tests/RecordPatternTest.cpp
+++ b/tests/RecordPatternTest.cpp
@@ -17,7 +17,7 @@ DEF_TEST(RecordPattern_Simple, r) {
SkRecord record;
REPORTER_ASSERT(r, !pattern.match(&record, 0));
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
// Build up a save-clip-restore block. The pattern will match only it's complete.
recorder.save();
@@ -37,7 +37,7 @@ DEF_TEST(RecordPattern_StartingIndex, r) {
SaveClipRectRestore pattern;
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
// There will be two save-clipRect-restore blocks [0,3) and [3,6).
for (int i = 0; i < 2; i++) {
@@ -60,7 +60,7 @@ DEF_TEST(RecordPattern_DontMatchSubsequences, r) {
SaveClipRectRestore pattern;
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
recorder.save();
recorder.clipRect(SkRect::MakeWH(300, 200));
@@ -74,7 +74,7 @@ DEF_TEST(RecordPattern_Star, r) {
Pattern3<Is<Save>, Star<Is<ClipRect> >, Is<Restore> > pattern;
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
recorder.save();
recorder.restore();
@@ -96,7 +96,7 @@ DEF_TEST(RecordPattern_IsDraw, r) {
Pattern3<Is<Save>, IsDraw, Is<Restore> > pattern;
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
recorder.save();
recorder.clipRect(SkRect::MakeWH(300, 200));
@@ -135,7 +135,7 @@ DEF_TEST(RecordPattern_Complex, r) {
Is<Restore> > pattern;
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
recorder.save();
recorder.restore();
@@ -192,7 +192,7 @@ DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) {
Pattern1<IsDraw> pattern;
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
+ SkRecorder recorder(&record, 1920, 1200);
recorder.saveLayer(NULL, NULL);
REPORTER_ASSERT(r, !pattern.match(&record, 0));
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp
index 8fa198cd6d..c1d96384eb 100644
--- a/tests/RecorderTest.cpp
+++ b/tests/RecorderTest.cpp
@@ -40,7 +40,7 @@ private:
DEF_TEST(Recorder, r) {
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080);
+ SkRecorder recorder(&record, 1920, 1080);
recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint());
@@ -62,7 +62,7 @@ DEF_TEST(Recorder_RefLeaking, r) {
REPORTER_ASSERT(r, paint.getShader()->unique());
{
SkRecord record;
- SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1080);
+ SkRecorder recorder(&record, 1920, 1080);
recorder.saveLayer(&bounds, &paint);
REPORTER_ASSERT(r, !paint.getShader()->unique());
}