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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 258693006: Start using type traits in src/record instead of macros. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ben Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/utils/SkTLogic.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkDebugCanvas.h" 10 #include "SkDebugCanvas.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // We'll keep the clipRect call from above, and the outer two drawRects, and the push/pop pair. 44 // We'll keep the clipRect call from above, and the outer two drawRects, and the push/pop pair.
45 // If culling weren't working, we'd see 8 commands recorded here. 45 // If culling weren't working, we'd see 8 commands recorded here.
46 REPORTER_ASSERT(r, 5 == rerecord.count()); 46 REPORTER_ASSERT(r, 5 == rerecord.count());
47 } 47 }
48 48
49 DEF_TEST(RecordDraw_Clipping, r) { 49 DEF_TEST(RecordDraw_Clipping, r) {
50 SkRecord record; 50 SkRecord record;
51 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H); 51 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, W, H);
52 52
53 // 9 draw commands. 53 // 8 draw commands.
54 recorder.save(); 54 recorder.save();
55 recorder.clipRect(SkRect::MakeLTRB(0, 0, 100, 100)); 55 recorder.clipRect(SkRect::MakeLTRB(0, 0, 100, 100));
56 recorder.drawRect(SkRect::MakeLTRB(20, 20, 40, 40), SkPaint()); 56 recorder.drawRect(SkRect::MakeLTRB(20, 20, 40, 40), SkPaint());
57 recorder.save(); 57 recorder.save();
58 // This first clipRect makes the clip empty, so the next two command s do nothing. 58 // This clipRect makes the clip empty, so the next command does noth ing.
59 recorder.clipRect(SkRect::MakeLTRB(200, 200, 300, 300)); 59 recorder.clipRect(SkRect::MakeLTRB(200, 200, 300, 300));
60 recorder.clipRect(SkRect::MakeLTRB(210, 210, 250, 250)); // Skipped
61 recorder.drawRect(SkRect::MakeLTRB(220, 220, 240, 240), SkPaint()); // Skipped 60 recorder.drawRect(SkRect::MakeLTRB(220, 220, 240, 240), SkPaint()); // Skipped
62 recorder.restore(); 61 recorder.restore();
63 recorder.restore(); 62 recorder.restore();
64 63
65 // Same deal as above: we need full SkCanvas semantics for clip skipping to work. 64 // Same deal as above: we need full SkCanvas semantics for clip skipping to work.
66 SkRecord rerecord; 65 SkRecord rerecord;
67 SkRecorder rerecorder(SkRecorder::kReadWrite_Mode, &rerecord, W, H); 66 SkRecorder rerecorder(SkRecorder::kReadWrite_Mode, &rerecord, W, H);
68 SkRecordDraw(record, &rerecorder); 67 SkRecordDraw(record, &rerecorder);
69 68
70 // All commands except the two marked // Skipped above will be preserved. 69 // All commands except the one marked // Skipped will be preserved.
71 REPORTER_ASSERT(r, 7 == rerecord.count()); 70 REPORTER_ASSERT(r, 7 == rerecord.count());
72 } 71 }
OLDNEW
« no previous file with comments | « src/utils/SkTLogic.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698