OLD | NEW |
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 SkRecord rerecord; | 190 SkRecord rerecord; |
191 SkRecorder canvas(&rerecord, kWidth, kHeight); | 191 SkRecorder canvas(&rerecord, kWidth, kHeight); |
192 SkRecordPartialDraw(record, &canvas, nullptr, 0, 1, 2, SkMatrix::I()); // re
play just drawRect of r2 | 192 SkRecordPartialDraw(record, &canvas, nullptr, 0, 1, 2, SkMatrix::I()); // re
play just drawRect of r2 |
193 | 193 |
194 REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecor
d)); | 194 REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecor
d)); |
195 int index = find_first_instances_of_type<SkRecords::DrawRect>(rerecord); | 195 int index = find_first_instances_of_type<SkRecords::DrawRect>(rerecord); |
196 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re
record, index); | 196 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re
record, index); |
197 REPORTER_ASSERT(r, drawRect->rect == r2); | 197 REPORTER_ASSERT(r, drawRect->rect == r2); |
198 } | 198 } |
199 | 199 |
200 // A regression test for crbug.com/415468 and skbug.com/2957. | 200 // A regression test for crbug.com/415468 and https://bug.skia.org/2957 . |
201 // | 201 // |
202 // This also now serves as a regression test for crbug.com/418417. We used to a
djust the | 202 // This also now serves as a regression test for crbug.com/418417. We used to a
djust the |
203 // bounds for the saveLayer, clip, and restore to be greater than the bounds of
the picture. | 203 // bounds for the saveLayer, clip, and restore to be greater than the bounds of
the picture. |
204 // (We were applying the saveLayer paint to the bounds after restore, which make
s no sense.) | 204 // (We were applying the saveLayer paint to the bounds after restore, which make
s no sense.) |
205 DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) { | 205 DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) { |
206 SkRecord record; | 206 SkRecord record; |
207 SkRecorder recorder(&record, 50, 50); | 207 SkRecorder recorder(&record, 50, 50); |
208 | 208 |
209 // We draw a rectangle with a long drop shadow. We used to not update the c
lip | 209 // We draw a rectangle with a long drop shadow. We used to not update the c
lip |
210 // bounds based on SaveLayer paints, so the drop shadow could be cut off. | 210 // bounds based on SaveLayer paints, so the drop shadow could be cut off. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 { | 297 { |
298 SkRecord record; | 298 SkRecord record; |
299 SkRecorder recorder(&record, 10, 10); | 299 SkRecorder recorder(&record, 10, 10); |
300 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); | 300 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); |
301 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); | 301 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); |
302 } | 302 } |
303 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 303 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
304 | 304 |
305 } | 305 } |
OLD | NEW |