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 |
11 #include "SkDebugCanvas.h" | 11 #include "SkDebugCanvas.h" |
| 12 #include "SkDrawPictureCallback.h" |
12 #include "SkDropShadowImageFilter.h" | 13 #include "SkDropShadowImageFilter.h" |
13 #include "SkImagePriv.h" | 14 #include "SkImagePriv.h" |
14 #include "SkRecord.h" | 15 #include "SkRecord.h" |
15 #include "SkRecordDraw.h" | 16 #include "SkRecordDraw.h" |
16 #include "SkRecordOpts.h" | 17 #include "SkRecordOpts.h" |
17 #include "SkRecorder.h" | 18 #include "SkRecorder.h" |
18 #include "SkRecords.h" | 19 #include "SkRecords.h" |
19 #include "SkSurface.h" | 20 #include "SkSurface.h" |
20 | 21 |
21 static const int W = 1920, H = 1080; | 22 static const int W = 1920, H = 1080; |
22 | 23 |
23 class JustOneDraw : public SkPicture::AbortCallback { | 24 class JustOneDraw : public SkDrawPictureCallback { |
24 public: | 25 public: |
25 JustOneDraw() : fCalls(0) {} | 26 JustOneDraw() : fCalls(0) {} |
26 | 27 |
27 virtual bool abort() SK_OVERRIDE { return fCalls++ > 0; } | 28 virtual bool abortDrawing() SK_OVERRIDE { return fCalls++ > 0; } |
28 private: | 29 private: |
29 int fCalls; | 30 int fCalls; |
30 }; | 31 }; |
31 | 32 |
32 DEF_TEST(RecordDraw_LazySaves, r) { | 33 DEF_TEST(RecordDraw_LazySaves, r) { |
33 // Record two commands. | 34 // Record two commands. |
34 SkRecord record; | 35 SkRecord record; |
35 SkRecorder recorder(&record, W, H); | 36 SkRecorder recorder(&record, W, H); |
36 | 37 |
37 REPORTER_ASSERT(r, 0 == record.count()); | 38 REPORTER_ASSERT(r, 0 == record.count()); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 324 |
324 { | 325 { |
325 SkRecord record; | 326 SkRecord record; |
326 SkRecorder recorder(&record, 10, 10); | 327 SkRecorder recorder(&record, 10, 10); |
327 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); | 328 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); |
328 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); | 329 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); |
329 } | 330 } |
330 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 331 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
331 | 332 |
332 } | 333 } |
OLD | NEW |