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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 | 234 |
235 // When a saveLayer provides an explicit bound and has a complex paint (e.g., on
e that | 235 // When a saveLayer provides an explicit bound and has a complex paint (e.g., on
e that |
236 // affects transparent black), that bound should serve to shrink the area of the
required | 236 // affects transparent black), that bound should serve to shrink the area of the
required |
237 // backing store. | 237 // backing store. |
238 DEF_TEST(RecordDraw_SaveLayerBoundsAffectsClipBounds, r) { | 238 DEF_TEST(RecordDraw_SaveLayerBoundsAffectsClipBounds, r) { |
239 SkRecord record; | 239 SkRecord record; |
240 SkRecorder recorder(&record, 50, 50); | 240 SkRecorder recorder(&record, 50, 50); |
241 | 241 |
242 SkPaint p; | 242 SkPaint p; |
243 p.setXfermodeMode(SkXfermode::kSrc_Mode); | 243 p.setBlendMode(SkBlendMode::kSrc); |
244 | 244 |
245 SkRect layerBounds = SkRect::MakeLTRB(10, 10, 40, 40); | 245 SkRect layerBounds = SkRect::MakeLTRB(10, 10, 40, 40); |
246 recorder.saveLayer(&layerBounds, &p); | 246 recorder.saveLayer(&layerBounds, &p); |
247 recorder.drawRect(SkRect::MakeLTRB(20, 20, 30, 30), SkPaint()); | 247 recorder.drawRect(SkRect::MakeLTRB(20, 20, 30, 30), SkPaint()); |
248 recorder.restore(); | 248 recorder.restore(); |
249 | 249 |
250 SkAutoTMalloc<SkRect> bounds(record.count()); | 250 SkAutoTMalloc<SkRect> bounds(record.count()); |
251 SkRecordFillBounds(SkRect::MakeWH(50, 50), record, bounds); | 251 SkRecordFillBounds(SkRect::MakeWH(50, 50), record, bounds); |
252 if (!SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds()) { | 252 if (!SkCanvas::Internal_Private_GetIgnoreSaveLayerBounds()) { |
253 REPORTER_ASSERT(r, sloppy_rect_eq(bounds[0], SkRect::MakeLTRB(10, 10, 40
, 40))); | 253 REPORTER_ASSERT(r, sloppy_rect_eq(bounds[0], SkRect::MakeLTRB(10, 10, 40
, 40))); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 { | 299 { |
300 SkRecord record; | 300 SkRecord record; |
301 SkRecorder recorder(&record, 10, 10); | 301 SkRecorder recorder(&record, 10, 10); |
302 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); | 302 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); |
303 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); | 303 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); |
304 } | 304 } |
305 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 305 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
306 | 306 |
307 } | 307 } |
OLD | NEW |