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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLT
RB(10, 10, 40, 40))); | 281 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[2].bounds, SkRect::MakeLT
RB(10, 10, 40, 40))); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 DEF_TEST(RecordDraw_drawImage, r){ | 285 DEF_TEST(RecordDraw_drawImage, r){ |
286 class SkCanvasMock : public SkCanvas { | 286 class SkCanvasMock : public SkCanvas { |
287 public: | 287 public: |
288 SkCanvasMock(int width, int height) : SkCanvas(width, height) { | 288 SkCanvasMock(int width, int height) : SkCanvas(width, height) { |
289 this->resetTestValues(); | 289 this->resetTestValues(); |
290 } | 290 } |
| 291 virtual ~SkCanvasMock() {} |
| 292 virtual void drawImage(const SkImage* image, SkScalar left, SkScalar top
, |
| 293 const SkPaint* paint = NULL) SK_OVERRIDE { |
291 | 294 |
292 void onDrawImage(const SkImage* image, SkScalar left, SkScalar top, | |
293 const SkPaint* paint) SK_OVERRIDE { | |
294 fDrawImageCalled = true; | 295 fDrawImageCalled = true; |
295 } | 296 } |
296 | 297 |
297 void onDrawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, | 298 virtual void drawImageRect(const SkImage* image, const SkRect* src, |
298 const SkPaint* paint) SK_OVERRIDE { | 299 const SkRect& dst, |
| 300 const SkPaint* paint = NULL) SK_OVERRIDE { |
299 fDrawImageRectCalled = true; | 301 fDrawImageRectCalled = true; |
300 } | 302 } |
301 | 303 |
302 void resetTestValues() { | 304 void resetTestValues() { |
303 fDrawImageCalled = fDrawImageRectCalled = false; | 305 fDrawImageCalled = fDrawImageRectCalled = false; |
304 } | 306 } |
305 | 307 |
306 bool fDrawImageCalled; | 308 bool fDrawImageCalled; |
307 bool fDrawImageRectCalled; | 309 bool fDrawImageRectCalled; |
308 }; | 310 }; |
(...skipping 15 matching lines...) Expand all Loading... |
324 | 326 |
325 { | 327 { |
326 SkRecord record; | 328 SkRecord record; |
327 SkRecorder recorder(&record, 10, 10); | 329 SkRecorder recorder(&record, 10, 10); |
328 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); | 330 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); |
329 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); | 331 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); |
330 } | 332 } |
331 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 333 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
332 | 334 |
333 } | 335 } |
OLD | NEW |