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 | |
295 // Verify that full frame rects with different forms of opaque paint | 287 // Verify that full frame rects with different forms of opaque paint |
296 // trigger frames to be marked as fresh | 288 // trigger frames to be marked as fresh |
297 { | 289 { |
298 SkPaint paint; | 290 SkPaint paint; |
299 paint.setStyle(SkPaint::kFill_Style); | 291 paint.setStyle(SkPaint::kFill_Style); |
300 paint.setAlpha(255); | 292 paint.setAlpha(255); |
301 canvas->drawRect(fullRect, paint); | 293 canvas->drawRect(fullRect, paint); |
302 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 294 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
303 } | 295 } |
304 { | 296 { |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 TestDeferredCanvasSurface(reporter, NULL); | 899 TestDeferredCanvasSurface(reporter, NULL); |
908 TestDeferredCanvasSetSurface(reporter, NULL); | 900 TestDeferredCanvasSetSurface(reporter, NULL); |
909 } | 901 } |
910 | 902 |
911 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { | 903 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { |
912 if (factory != NULL) { | 904 if (factory != NULL) { |
913 TestDeferredCanvasSurface(reporter, factory); | 905 TestDeferredCanvasSurface(reporter, factory); |
914 TestDeferredCanvasSetSurface(reporter, factory); | 906 TestDeferredCanvasSetSurface(reporter, factory); |
915 } | 907 } |
916 } | 908 } |
OLD | NEW |