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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 772533004: Change clear() to respect the clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox Created 6 years 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 | « tests/DeferredCanvasTest.cpp ('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 #include "RecordTestUtils.h" 9 #include "RecordTestUtils.h"
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 REPORTER_ASSERT(r, 3 == rerecord.count()); 196 REPORTER_ASSERT(r, 3 == rerecord.count());
197 assert_type<SkRecords::Save> (r, rerecord, 0); 197 assert_type<SkRecords::Save> (r, rerecord, 0);
198 assert_type<SkRecords::DrawRect> (r, rerecord, 1); 198 assert_type<SkRecords::DrawRect> (r, rerecord, 1);
199 assert_type<SkRecords::Restore> (r, rerecord, 2); 199 assert_type<SkRecords::Restore> (r, rerecord, 2);
200 200
201 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re record, 1); 201 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re record, 1);
202 REPORTER_ASSERT(r, drawRect->rect == r2); 202 REPORTER_ASSERT(r, drawRect->rect == r2);
203 } 203 }
204 204
205 #if 0
mtklein 2014/12/02 16:29:28 Sure, we can remove this now, but if we do there's
205 // Check that clears are converted to drawRects 206 // Check that clears are converted to drawRects
206 DEF_TEST(RecordDraw_PartialClear, r) { 207 DEF_TEST(RecordDraw_PartialClear, r) {
207 static const int kWidth = 10, kHeight = 10; 208 static const int kWidth = 10, kHeight = 10;
208 209
209 SkRect rect = { 0, 0, kWidth, kHeight }; 210 SkRect rect = { 0, 0, kWidth, kHeight };
210 211
211 SkRecord record; 212 SkRecord record;
212 SkRecorder recorder(&record, kWidth, kHeight); 213 SkRecorder recorder(&record, kWidth, kHeight);
213 recorder.clear(SK_ColorRED); 214 recorder.clear(SK_ColorRED);
214 215
215 SkRecord rerecord; 216 SkRecord rerecord;
216 SkRecorder canvas(&rerecord, kWidth, kHeight); 217 SkRecorder canvas(&rerecord, kWidth, kHeight);
217 SkRecordPartialDraw(record, &canvas, NULL, 0, rect, 0, 1, SkMatrix::I()); // replay just the clear 218 SkRecordPartialDraw(record, &canvas, NULL, 0, rect, 0, 1, SkMatrix::I()); // replay just the clear
218 219
219 REPORTER_ASSERT(r, 3 == rerecord.count()); 220 REPORTER_ASSERT(r, 3 == rerecord.count());
220 assert_type<SkRecords::Save> (r, rerecord, 0); 221 assert_type<SkRecords::Save> (r, rerecord, 0);
221 assert_type<SkRecords::DrawRect>(r, rerecord, 1); 222 assert_type<SkRecords::DrawRect>(r, rerecord, 1);
222 assert_type<SkRecords::Restore> (r, rerecord, 2); 223 assert_type<SkRecords::Restore> (r, rerecord, 2);
223 224
224 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re record, 1); 225 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re record, 1);
225 REPORTER_ASSERT(r, drawRect->rect == rect); 226 REPORTER_ASSERT(r, drawRect->rect == rect);
226 REPORTER_ASSERT(r, drawRect->paint.getColor() == SK_ColorRED); 227 REPORTER_ASSERT(r, drawRect->paint.getColor() == SK_ColorRED);
227 } 228 }
229 #endif
228 230
229 // A regression test for crbug.com/415468 and skbug.com/2957. 231 // A regression test for crbug.com/415468 and skbug.com/2957.
230 // 232 //
231 // This also now serves as a regression test for crbug.com/418417. We used to a djust the 233 // This also now serves as a regression test for crbug.com/418417. We used to a djust the
232 // bounds for the saveLayer, clip, and restore to be greater than the bounds of the picture. 234 // bounds for the saveLayer, clip, and restore to be greater than the bounds of the picture.
233 // (We were applying the saveLayer paint to the bounds after restore, which make s no sense.) 235 // (We were applying the saveLayer paint to the bounds after restore, which make s no sense.)
234 DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) { 236 DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) {
235 SkRecord record; 237 SkRecord record;
236 SkRecorder recorder(&record, 50, 50); 238 SkRecorder recorder(&record, 50, 50);
237 239
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 329
328 { 330 {
329 SkRecord record; 331 SkRecord record;
330 SkRecorder recorder(&record, 10, 10); 332 SkRecorder recorder(&record, 10, 10);
331 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); 333 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10));
332 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); 334 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0);
333 } 335 }
334 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); 336 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
335 337
336 } 338 }
OLDNEW
« no previous file with comments | « tests/DeferredCanvasTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698