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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 SkAutoTUnref<SkPicture> srcPic(src.endRecording()); | 112 SkAutoTUnref<SkPicture> srcPic(src.endRecording()); |
113 | 113 |
114 // A target canvas with an empty clip. | 114 // A target canvas with an empty clip. |
115 SkCanvas* c = dst.beginRecording(1,1, NULL); | 115 SkCanvas* c = dst.beginRecording(1,1, NULL); |
116 c->clipRect(SkRect::MakeEmpty()); | 116 c->clipRect(SkRect::MakeEmpty()); |
117 srcPic->playback(c); | 117 srcPic->playback(c); |
118 SkAutoTUnref<SkPicture> dstPic(dst.endRecording()); | 118 SkAutoTUnref<SkPicture> dstPic(dst.endRecording()); |
119 | 119 |
120 // Should be Clip - Save - Clear - Restore. | 120 // Should be Clip - Save - Clear - Restore. |
121 // Buggy implementations might return 1 (just Clip) or 3 (Clip - Save - Rest
ore). | 121 // Buggy implementations might return 1 (just Clip) or 3 (Clip - Save - Rest
ore). |
122 REPORTER_ASSERT(r, dstPic->approximateOpCount() == 4); | 122 // TODO: can we just search that it contains "clear"? <reed> |
| 123 REPORTER_ASSERT(r, dstPic->approximateOpCount() == 4 || dstPic->approximateO
pCount() == 2); |
123 } | 124 } |
124 | 125 |
125 DEF_TEST(PictureBBH_Clear, r) { | 126 DEF_TEST(PictureBBH_Clear, r) { |
126 test_clear(r, NULL); | 127 test_clear(r, NULL); |
127 | 128 |
128 SkTileGridFactory::TileGridInfo grid = { {1,1}, {0,0}, {0,0} }; | 129 SkTileGridFactory::TileGridInfo grid = { {1,1}, {0,0}, {0,0} }; |
129 SkTileGridFactory tilegrid(grid); | 130 SkTileGridFactory tilegrid(grid); |
130 test_clear(r, &tilegrid); | 131 test_clear(r, &tilegrid); |
131 | 132 |
132 SkRTreeFactory rtree; | 133 SkRTreeFactory rtree; |
133 test_clear(r, &rtree); | 134 test_clear(r, &rtree); |
134 } | 135 } |
OLD | NEW |