OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "../src/image/SkImagePriv.h" | 8 #include "../src/image/SkImagePriv.h" |
9 #include "../src/image/SkSurface_Base.h" | 9 #include "../src/image/SkSurface_Base.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 canvas->clear(0x00000000); | 277 canvas->clear(0x00000000); |
278 canvas->restore(); | 278 canvas->restore(); |
279 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 279 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
280 | 280 |
281 // Verify that clear within a layer does NOT trigger a fresh frame | 281 // Verify that clear within a layer does NOT trigger a fresh frame |
282 canvas->saveLayer(NULL, NULL); | 282 canvas->saveLayer(NULL, NULL); |
283 canvas->clear(0x00000000); | 283 canvas->clear(0x00000000); |
284 canvas->restore(); | 284 canvas->restore(); |
285 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 285 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
286 | 286 |
| 287 // Verify that a clear with clipping triggers a fresh frame |
| 288 // (clear is not affected by clipping) |
| 289 canvas->save(); |
| 290 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); |
| 291 canvas->clear(0x00000000); |
| 292 canvas->restore(); |
| 293 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 294 |
287 // Verify that full frame rects with different forms of opaque paint | 295 // Verify that full frame rects with different forms of opaque paint |
288 // trigger frames to be marked as fresh | 296 // trigger frames to be marked as fresh |
289 { | 297 { |
290 SkPaint paint; | 298 SkPaint paint; |
291 paint.setStyle(SkPaint::kFill_Style); | 299 paint.setStyle(SkPaint::kFill_Style); |
292 paint.setAlpha(255); | 300 paint.setAlpha(255); |
293 canvas->drawRect(fullRect, paint); | 301 canvas->drawRect(fullRect, paint); |
294 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 302 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
295 } | 303 } |
296 { | 304 { |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 TestDeferredCanvasSurface(reporter, NULL); | 907 TestDeferredCanvasSurface(reporter, NULL); |
900 TestDeferredCanvasSetSurface(reporter, NULL); | 908 TestDeferredCanvasSetSurface(reporter, NULL); |
901 } | 909 } |
902 | 910 |
903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { | 911 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { |
904 if (factory != NULL) { | 912 if (factory != NULL) { |
905 TestDeferredCanvasSurface(reporter, factory); | 913 TestDeferredCanvasSurface(reporter, factory); |
906 TestDeferredCanvasSetSurface(reporter, factory); | 914 TestDeferredCanvasSetSurface(reporter, factory); |
907 } | 915 } |
908 } | 916 } |
OLD | NEW |