| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // verify that frame is intially fresh | 283 // verify that frame is intially fresh |
| 284 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 284 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 285 // no clearing op since last call to isFreshFrame -> not fresh | 285 // no clearing op since last call to isFreshFrame -> not fresh |
| 286 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 286 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
| 287 | 287 |
| 288 // Verify that clear triggers a fresh frame | 288 // Verify that clear triggers a fresh frame |
| 289 canvas->clear(0x00000000); | 289 canvas->clear(0x00000000); |
| 290 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 290 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 291 | 291 |
| 292 // Verify that clear with saved state triggers a fresh frame | 292 // Verify that clear with saved state triggers a fresh frame |
| 293 canvas->save(SkCanvas::kMatrixClip_SaveFlag); | 293 canvas->save(); |
| 294 canvas->clear(0x00000000); | 294 canvas->clear(0x00000000); |
| 295 canvas->restore(); | 295 canvas->restore(); |
| 296 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 296 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 297 | 297 |
| 298 // Verify that clear within a layer does NOT trigger a fresh frame | 298 // Verify that clear within a layer does NOT trigger a fresh frame |
| 299 canvas->saveLayer(NULL, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); | 299 canvas->saveLayer(NULL, NULL); |
| 300 canvas->clear(0x00000000); | 300 canvas->clear(0x00000000); |
| 301 canvas->restore(); | 301 canvas->restore(); |
| 302 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 302 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
| 303 | 303 |
| 304 // Verify that a clear with clipping triggers a fresh frame | 304 // Verify that a clear with clipping triggers a fresh frame |
| 305 // (clear is not affected by clipping) | 305 // (clear is not affected by clipping) |
| 306 canvas->save(SkCanvas::kMatrixClip_SaveFlag); | 306 canvas->save(); |
| 307 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); | 307 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); |
| 308 canvas->clear(0x00000000); | 308 canvas->clear(0x00000000); |
| 309 canvas->restore(); | 309 canvas->restore(); |
| 310 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 310 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 311 | 311 |
| 312 // Verify that full frame rects with different forms of opaque paint | 312 // Verify that full frame rects with different forms of opaque paint |
| 313 // trigger frames to be marked as fresh | 313 // trigger frames to be marked as fresh |
| 314 { | 314 { |
| 315 SkPaint paint; | 315 SkPaint paint; |
| 316 paint.setStyle(SkPaint::kFill_Style); | 316 paint.setStyle(SkPaint::kFill_Style); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 SkPaint paint; | 382 SkPaint paint; |
| 383 paint.setStyle(SkPaint::kFill_Style); | 383 paint.setStyle(SkPaint::kFill_Style); |
| 384 paint.setAlpha(255); | 384 paint.setAlpha(255); |
| 385 canvas->drawRect(partialRect, paint); | 385 canvas->drawRect(partialRect, paint); |
| 386 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 386 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 // Verify that incomplete coverage due to clipping does not trigger a fresh | 389 // Verify that incomplete coverage due to clipping does not trigger a fresh |
| 390 // frame | 390 // frame |
| 391 { | 391 { |
| 392 canvas->save(SkCanvas::kMatrixClip_SaveFlag); | 392 canvas->save(); |
| 393 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); | 393 canvas->clipRect(partialRect, SkRegion::kIntersect_Op, false); |
| 394 SkPaint paint; | 394 SkPaint paint; |
| 395 paint.setStyle(SkPaint::kFill_Style); | 395 paint.setStyle(SkPaint::kFill_Style); |
| 396 paint.setAlpha(255); | 396 paint.setAlpha(255); |
| 397 canvas->drawRect(fullRect, paint); | 397 canvas->drawRect(fullRect, paint); |
| 398 canvas->restore(); | 398 canvas->restore(); |
| 399 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 399 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
| 400 } | 400 } |
| 401 { | 401 { |
| 402 canvas->save(SkCanvas::kMatrixClip_SaveFlag); | 402 canvas->save(); |
| 403 SkPaint paint; | 403 SkPaint paint; |
| 404 paint.setStyle(SkPaint::kFill_Style); | 404 paint.setStyle(SkPaint::kFill_Style); |
| 405 paint.setAlpha(255); | 405 paint.setAlpha(255); |
| 406 SkPath path; | 406 SkPath path; |
| 407 path.addCircle(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(2)); | 407 path.addCircle(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(2)); |
| 408 canvas->clipPath(path, SkRegion::kIntersect_Op, false); | 408 canvas->clipPath(path, SkRegion::kIntersect_Op, false); |
| 409 canvas->drawRect(fullRect, paint); | 409 canvas->drawRect(fullRect, paint); |
| 410 canvas->restore(); | 410 canvas->restore(); |
| 411 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 411 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
| 412 } | 412 } |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 TestDeferredCanvasBitmapSizeThreshold(reporter); | 828 TestDeferredCanvasBitmapSizeThreshold(reporter); |
| 829 TestDeferredCanvasCreateCompatibleDevice(reporter); | 829 TestDeferredCanvasCreateCompatibleDevice(reporter); |
| 830 TestDeferredCanvasWritePixelsToSurface(reporter); | 830 TestDeferredCanvasWritePixelsToSurface(reporter); |
| 831 TestDeferredCanvasSurface(reporter, NULL); | 831 TestDeferredCanvasSurface(reporter, NULL); |
| 832 TestDeferredCanvasSetSurface(reporter, NULL); | 832 TestDeferredCanvasSetSurface(reporter, NULL); |
| 833 if (NULL != factory) { | 833 if (NULL != factory) { |
| 834 TestDeferredCanvasSurface(reporter, factory); | 834 TestDeferredCanvasSurface(reporter, factory); |
| 835 TestDeferredCanvasSetSurface(reporter, factory); | 835 TestDeferredCanvasSetSurface(reporter, factory); |
| 836 } | 836 } |
| 837 } | 837 } |
| OLD | NEW |