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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkBBoxHierarchy.h" | 9 #include "SkBBoxHierarchy.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 }; | 55 }; |
56 | 56 |
57 // Test to verify the playback of an empty picture | 57 // Test to verify the playback of an empty picture |
58 // | 58 // |
59 class DrawEmptyPictureBBHTest : public PictureBBHTestBase { | 59 class DrawEmptyPictureBBHTest : public PictureBBHTestBase { |
60 public: | 60 public: |
61 DrawEmptyPictureBBHTest() | 61 DrawEmptyPictureBBHTest() |
62 : PictureBBHTestBase(2, 2, 1, 1) { } | 62 : PictureBBHTestBase(2, 2, 1, 1) { } |
63 virtual ~DrawEmptyPictureBBHTest() { } | 63 virtual ~DrawEmptyPictureBBHTest() { } |
64 | 64 |
65 void doTest(SkCanvas&, SkCanvas&) SK_OVERRIDE { } | 65 void doTest(SkCanvas&, SkCanvas&) override { } |
66 }; | 66 }; |
67 | 67 |
68 // Test to verify the playback of a picture into a canvas that has | 68 // Test to verify the playback of a picture into a canvas that has |
69 // an empty clip. | 69 // an empty clip. |
70 // | 70 // |
71 class EmptyClipPictureBBHTest : public PictureBBHTestBase { | 71 class EmptyClipPictureBBHTest : public PictureBBHTestBase { |
72 public: | 72 public: |
73 EmptyClipPictureBBHTest() | 73 EmptyClipPictureBBHTest() |
74 : PictureBBHTestBase(2, 2, 3, 3) { } | 74 : PictureBBHTestBase(2, 2, 3, 3) { } |
75 | 75 |
76 void doTest(SkCanvas& playbackCanvas, SkCanvas& recordingCanvas) SK_OVERRIDE
{ | 76 void doTest(SkCanvas& playbackCanvas, SkCanvas& recordingCanvas) override { |
77 // intersect with out of bounds rect -> empty clip. | 77 // intersect with out of bounds rect -> empty clip. |
78 playbackCanvas.clipRect(SkRect::MakeXYWH(SkIntToScalar(10), SkIntToScala
r(10), | 78 playbackCanvas.clipRect(SkRect::MakeXYWH(SkIntToScalar(10), SkIntToScala
r(10), |
79 SkIntToScalar(1), SkIntToScalar(1)), SkRegion::kIntersect_Op); | 79 SkIntToScalar(1), SkIntToScalar(1)), SkRegion::kIntersect_Op); |
80 SkPaint paint; | 80 SkPaint paint; |
81 recordingCanvas.drawRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScala
r(0), | 81 recordingCanvas.drawRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScala
r(0), |
82 SkIntToScalar(3), SkIntToScalar(3)), paint); | 82 SkIntToScalar(3), SkIntToScalar(3)), paint); |
83 } | 83 } |
84 | 84 |
85 virtual ~EmptyClipPictureBBHTest() { } | 85 virtual ~EmptyClipPictureBBHTest() { } |
86 }; | 86 }; |
87 | 87 |
88 DEF_TEST(PictureBBH, reporter) { | 88 DEF_TEST(PictureBBH, reporter) { |
89 | 89 |
90 DrawEmptyPictureBBHTest emptyPictureTest; | 90 DrawEmptyPictureBBHTest emptyPictureTest; |
91 emptyPictureTest.run(reporter); | 91 emptyPictureTest.run(reporter); |
92 | 92 |
93 EmptyClipPictureBBHTest emptyClipPictureTest; | 93 EmptyClipPictureBBHTest emptyClipPictureTest; |
94 emptyClipPictureTest.run(reporter); | 94 emptyClipPictureTest.run(reporter); |
95 } | 95 } |
OLD | NEW |