| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkBitmapDevice.h" |
| 10 #include "SkBitmapProcShader.h" | 11 #include "SkBitmapProcShader.h" |
| 11 #include "SkDeferredCanvas.h" | 12 #include "SkDeferredCanvas.h" |
| 12 #include "SkDevice.h" | |
| 13 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
| 14 #include "SkShader.h" | 14 #include "SkShader.h" |
| 15 #include "../src/image/SkSurface_Base.h" | 15 #include "../src/image/SkSurface_Base.h" |
| 16 #include "../src/image/SkImagePriv.h" | 16 #include "../src/image/SkImagePriv.h" |
| 17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
| 18 #include "GrContextFactory.h" | 18 #include "GrContextFactory.h" |
| 19 #else | 19 #else |
| 20 class GrContextFactory; | 20 class GrContextFactory; |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 static const int gWidth = 2; | 23 static const int gWidth = 2; |
| 24 static const int gHeight = 2; | 24 static const int gHeight = 2; |
| 25 | 25 |
| 26 static void create(SkBitmap* bm, SkBitmap::Config config, SkColor color) { | 26 static void create(SkBitmap* bm, SkBitmap::Config config, SkColor color) { |
| 27 bm->setConfig(config, gWidth, gHeight); | 27 bm->setConfig(config, gWidth, gHeight); |
| 28 bm->allocPixels(); | 28 bm->allocPixels(); |
| 29 bm->eraseColor(color); | 29 bm->eraseColor(color); |
| 30 } | 30 } |
| 31 | 31 |
| 32 static void TestDeferredCanvasBitmapAccess(skiatest::Reporter* reporter) { | 32 static void TestDeferredCanvasBitmapAccess(skiatest::Reporter* reporter) { |
| 33 SkBitmap store; | 33 SkBitmap store; |
| 34 | 34 |
| 35 create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); | 35 create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); |
| 36 SkDevice device(store); | 36 SkBitmapDevice device(store); |
| 37 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 37 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 38 | 38 |
| 39 canvas->clear(0x00000000); | 39 canvas->clear(0x00000000); |
| 40 | 40 |
| 41 SkAutoLockPixels alp(store); | 41 SkAutoLockPixels alp(store); |
| 42 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0xFFFFFFFF); //verify that
clear was deferred | 42 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0xFFFFFFFF); //verify that
clear was deferred |
| 43 SkBitmap accessed = canvas->getDevice()->accessBitmap(false); | 43 SkBitmap accessed = canvas->getDevice()->accessBitmap(false); |
| 44 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0x00000000); //verify that
clear was executed | 44 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0x00000000); //verify that
clear was executed |
| 45 REPORTER_ASSERT(reporter, accessed.pixelRef() == store.pixelRef()); | 45 REPORTER_ASSERT(reporter, accessed.pixelRef() == store.pixelRef()); |
| 46 } | 46 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 surface->clearCounts(); | 252 surface->clearCounts(); |
| 253 canvas->flush(); | 253 canvas->flush(); |
| 254 REPORTER_ASSERT(reporter, 0 == surface->fDiscardCount); | 254 REPORTER_ASSERT(reporter, 0 == surface->fDiscardCount); |
| 255 REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); | 255 REPORTER_ASSERT(reporter, 0 == surface->fRetainCount); |
| 256 } | 256 } |
| 257 | 257 |
| 258 static void TestDeferredCanvasFlush(skiatest::Reporter* reporter) { | 258 static void TestDeferredCanvasFlush(skiatest::Reporter* reporter) { |
| 259 SkBitmap store; | 259 SkBitmap store; |
| 260 | 260 |
| 261 create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); | 261 create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); |
| 262 SkDevice device(store); | 262 SkBitmapDevice device(store); |
| 263 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 263 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 264 | 264 |
| 265 canvas->clear(0x00000000); | 265 canvas->clear(0x00000000); |
| 266 | 266 |
| 267 SkAutoLockPixels alp(store); | 267 SkAutoLockPixels alp(store); |
| 268 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0xFFFFFFFF); //verify that
clear was deferred | 268 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0xFFFFFFFF); //verify that
clear was deferred |
| 269 canvas->flush(); | 269 canvas->flush(); |
| 270 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0x00000000); //verify that
clear was executed | 270 REPORTER_ASSERT(reporter, store.getColor(0,0) == 0x00000000); //verify that
clear was executed |
| 271 } | 271 } |
| 272 | 272 |
| 273 static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) { | 273 static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) { |
| 274 SkBitmap store; | 274 SkBitmap store; |
| 275 SkRect fullRect; | 275 SkRect fullRect; |
| 276 fullRect.setXYWH(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(gWidth), | 276 fullRect.setXYWH(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(gWidth), |
| 277 SkIntToScalar(gHeight)); | 277 SkIntToScalar(gHeight)); |
| 278 SkRect partialRect; | 278 SkRect partialRect; |
| 279 partialRect.setXYWH(SkIntToScalar(0), SkIntToScalar(0), | 279 partialRect.setXYWH(SkIntToScalar(0), SkIntToScalar(0), |
| 280 SkIntToScalar(1), SkIntToScalar(1)); | 280 SkIntToScalar(1), SkIntToScalar(1)); |
| 281 create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); | 281 create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); |
| 282 SkDevice device(store); | 282 SkBitmapDevice device(store); |
| 283 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 283 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 284 | 284 |
| 285 // verify that frame is intially fresh | 285 // verify that frame is intially fresh |
| 286 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 286 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 287 // no clearing op since last call to isFreshFrame -> not fresh | 287 // no clearing op since last call to isFreshFrame -> not fresh |
| 288 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 288 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
| 289 | 289 |
| 290 // Verify that clear triggers a fresh frame | 290 // Verify that clear triggers a fresh frame |
| 291 canvas->clear(0x00000000); | 291 canvas->clear(0x00000000); |
| 292 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 292 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 { | 426 { |
| 427 SkPaint paint; | 427 SkPaint paint; |
| 428 paint.setStyle(SkPaint::kFill_Style); | 428 paint.setStyle(SkPaint::kFill_Style); |
| 429 paint.setAlpha(100); | 429 paint.setAlpha(100); |
| 430 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 430 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 431 canvas->drawRect(fullRect, paint); | 431 canvas->drawRect(fullRect, paint); |
| 432 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 432 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 class MockDevice : public SkDevice { | 436 class MockDevice : public SkBitmapDevice { |
| 437 public: | 437 public: |
| 438 MockDevice(const SkBitmap& bm) : SkDevice(bm) { | 438 MockDevice(const SkBitmap& bm) : SkBitmapDevice(bm) { |
| 439 fDrawBitmapCallCount = 0; | 439 fDrawBitmapCallCount = 0; |
| 440 } | 440 } |
| 441 virtual void drawBitmap(const SkDraw&, const SkBitmap&, | 441 virtual void drawBitmap(const SkDraw&, const SkBitmap&, |
| 442 const SkMatrix&, const SkPaint&) SK_OVERRIDE { | 442 const SkMatrix&, const SkPaint&) SK_OVERRIDE { |
| 443 fDrawBitmapCallCount++; | 443 fDrawBitmapCallCount++; |
| 444 } | 444 } |
| 445 | 445 |
| 446 int fDrawBitmapCallCount; | 446 int fDrawBitmapCallCount; |
| 447 }; | 447 }; |
| 448 | 448 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 int fSkippedPendingDrawCommandsCount; | 495 int fSkippedPendingDrawCommandsCount; |
| 496 | 496 |
| 497 private: | 497 private: |
| 498 typedef SkDeferredCanvas::NotificationClient INHERITED; | 498 typedef SkDeferredCanvas::NotificationClient INHERITED; |
| 499 }; | 499 }; |
| 500 | 500 |
| 501 static void TestDeferredCanvasBitmapCaching(skiatest::Reporter* reporter) { | 501 static void TestDeferredCanvasBitmapCaching(skiatest::Reporter* reporter) { |
| 502 SkBitmap store; | 502 SkBitmap store; |
| 503 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 503 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 504 store.allocPixels(); | 504 store.allocPixels(); |
| 505 SkDevice device(store); | 505 SkBitmapDevice device(store); |
| 506 NotificationCounter notificationCounter; | 506 NotificationCounter notificationCounter; |
| 507 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 507 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 508 canvas->setNotificationClient(¬ificationCounter); | 508 canvas->setNotificationClient(¬ificationCounter); |
| 509 | 509 |
| 510 const int imageCount = 2; | 510 const int imageCount = 2; |
| 511 SkBitmap sourceImages[imageCount]; | 511 SkBitmap sourceImages[imageCount]; |
| 512 for (int i = 0; i < imageCount; i++) | 512 for (int i = 0; i < imageCount; i++) |
| 513 { | 513 { |
| 514 sourceImages[i].setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 514 sourceImages[i].setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 515 sourceImages[i].allocPixels(); | 515 sourceImages[i].allocPixels(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2*bitmapS
ize); | 578 REPORTER_ASSERT(reporter, canvas->storageAllocatedForRecording() > 2*bitmapS
ize); |
| 579 | 579 |
| 580 // Verify that nothing in this test caused commands to be skipped | 580 // Verify that nothing in this test caused commands to be skipped |
| 581 REPORTER_ASSERT(reporter, 0 == notificationCounter.fSkippedPendingDrawComman
dsCount); | 581 REPORTER_ASSERT(reporter, 0 == notificationCounter.fSkippedPendingDrawComman
dsCount); |
| 582 } | 582 } |
| 583 | 583 |
| 584 static void TestDeferredCanvasSkip(skiatest::Reporter* reporter) { | 584 static void TestDeferredCanvasSkip(skiatest::Reporter* reporter) { |
| 585 SkBitmap store; | 585 SkBitmap store; |
| 586 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 586 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 587 store.allocPixels(); | 587 store.allocPixels(); |
| 588 SkDevice device(store); | 588 SkBitmapDevice device(store); |
| 589 NotificationCounter notificationCounter; | 589 NotificationCounter notificationCounter; |
| 590 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 590 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 591 canvas->setNotificationClient(¬ificationCounter); | 591 canvas->setNotificationClient(¬ificationCounter); |
| 592 canvas->clear(0x0); | 592 canvas->clear(0x0); |
| 593 REPORTER_ASSERT(reporter, 1 == notificationCounter.fSkippedPendingDrawComman
dsCount); | 593 REPORTER_ASSERT(reporter, 1 == notificationCounter.fSkippedPendingDrawComman
dsCount); |
| 594 REPORTER_ASSERT(reporter, 0 == notificationCounter.fFlushedDrawCommandsCount
); | 594 REPORTER_ASSERT(reporter, 0 == notificationCounter.fFlushedDrawCommandsCount
); |
| 595 canvas->flush(); | 595 canvas->flush(); |
| 596 REPORTER_ASSERT(reporter, 1 == notificationCounter.fSkippedPendingDrawComman
dsCount); | 596 REPORTER_ASSERT(reporter, 1 == notificationCounter.fSkippedPendingDrawComman
dsCount); |
| 597 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); | 597 REPORTER_ASSERT(reporter, 1 == notificationCounter.fFlushedDrawCommandsCount
); |
| 598 | 598 |
| 599 } | 599 } |
| 600 | 600 |
| 601 static void TestDeferredCanvasBitmapShaderNoLeak(skiatest::Reporter* reporter) { | 601 static void TestDeferredCanvasBitmapShaderNoLeak(skiatest::Reporter* reporter) { |
| 602 // This is a regression test for crbug.com/155875 | 602 // This is a regression test for crbug.com/155875 |
| 603 // This test covers a code path that inserts bitmaps into the bitmap heap th
rough the | 603 // This test covers a code path that inserts bitmaps into the bitmap heap th
rough the |
| 604 // flattening of SkBitmapProcShaders. The refcount in the bitmap heap is mai
ntained through | 604 // flattening of SkBitmapProcShaders. The refcount in the bitmap heap is mai
ntained through |
| 605 // the flattening and unflattening of the shader. | 605 // the flattening and unflattening of the shader. |
| 606 SkBitmap store; | 606 SkBitmap store; |
| 607 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 607 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 608 store.allocPixels(); | 608 store.allocPixels(); |
| 609 SkDevice device(store); | 609 SkBitmapDevice device(store); |
| 610 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 610 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 611 // test will fail if nbIterations is not in sync with | 611 // test will fail if nbIterations is not in sync with |
| 612 // BITMAPS_TO_KEEP in SkGPipeWrite.cpp | 612 // BITMAPS_TO_KEEP in SkGPipeWrite.cpp |
| 613 const int nbIterations = 5; | 613 const int nbIterations = 5; |
| 614 size_t bytesAllocated = 0; | 614 size_t bytesAllocated = 0; |
| 615 for(int pass = 0; pass < 2; ++pass) { | 615 for(int pass = 0; pass < 2; ++pass) { |
| 616 for(int i = 0; i < nbIterations; ++i) { | 616 for(int i = 0; i < nbIterations; ++i) { |
| 617 SkPaint paint; | 617 SkPaint paint; |
| 618 SkBitmap paintPattern; | 618 SkBitmap paintPattern; |
| 619 paintPattern.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 619 paintPattern.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 645 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 645 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 646 store.allocPixels(); | 646 store.allocPixels(); |
| 647 | 647 |
| 648 SkBitmap sourceImage; | 648 SkBitmap sourceImage; |
| 649 // 100 by 100 image, takes 40,000 bytes in memory | 649 // 100 by 100 image, takes 40,000 bytes in memory |
| 650 sourceImage.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 650 sourceImage.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 651 sourceImage.allocPixels(); | 651 sourceImage.allocPixels(); |
| 652 | 652 |
| 653 // 1 under : should not store the image | 653 // 1 under : should not store the image |
| 654 { | 654 { |
| 655 SkDevice device(store); | 655 SkBitmapDevice device(store); |
| 656 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device))
; | 656 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device))
; |
| 657 canvas->setBitmapSizeThreshold(39999); | 657 canvas->setBitmapSizeThreshold(39999); |
| 658 canvas->drawBitmap(sourceImage, 0, 0, NULL); | 658 canvas->drawBitmap(sourceImage, 0, 0, NULL); |
| 659 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); | 659 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); |
| 660 REPORTER_ASSERT(reporter, newBytesAllocated == 0); | 660 REPORTER_ASSERT(reporter, newBytesAllocated == 0); |
| 661 } | 661 } |
| 662 | 662 |
| 663 // exact value : should store the image | 663 // exact value : should store the image |
| 664 { | 664 { |
| 665 SkDevice device(store); | 665 SkBitmapDevice device(store); |
| 666 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device))
; | 666 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device))
; |
| 667 canvas->setBitmapSizeThreshold(40000); | 667 canvas->setBitmapSizeThreshold(40000); |
| 668 canvas->drawBitmap(sourceImage, 0, 0, NULL); | 668 canvas->drawBitmap(sourceImage, 0, 0, NULL); |
| 669 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); | 669 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); |
| 670 REPORTER_ASSERT(reporter, newBytesAllocated > 0); | 670 REPORTER_ASSERT(reporter, newBytesAllocated > 0); |
| 671 } | 671 } |
| 672 | 672 |
| 673 // 1 over : should still store the image | 673 // 1 over : should still store the image |
| 674 { | 674 { |
| 675 SkDevice device(store); | 675 SkBitmapDevice device(store); |
| 676 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device))
; | 676 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device))
; |
| 677 canvas->setBitmapSizeThreshold(40001); | 677 canvas->setBitmapSizeThreshold(40001); |
| 678 canvas->drawBitmap(sourceImage, 0, 0, NULL); | 678 canvas->drawBitmap(sourceImage, 0, 0, NULL); |
| 679 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); | 679 size_t newBytesAllocated = canvas->storageAllocatedForRecording(); |
| 680 REPORTER_ASSERT(reporter, newBytesAllocated > 0); | 680 REPORTER_ASSERT(reporter, newBytesAllocated > 0); |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 | 683 |
| 684 | 684 |
| 685 typedef void* PixelPtr; | 685 typedef void* PixelPtr; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 canvas->clear(SK_ColorWHITE); | 800 canvas->clear(SK_ColorWHITE); |
| 801 canvas->flush(); | 801 canvas->flush(); |
| 802 REPORTER_ASSERT(reporter, getSurfacePixelPtr(surface, useGpu) == pixels1); | 802 REPORTER_ASSERT(reporter, getSurfacePixelPtr(surface, useGpu) == pixels1); |
| 803 REPORTER_ASSERT(reporter, getSurfacePixelPtr(alternateSurface, useGpu) != pi
xels2); | 803 REPORTER_ASSERT(reporter, getSurfacePixelPtr(alternateSurface, useGpu) != pi
xels2); |
| 804 } | 804 } |
| 805 | 805 |
| 806 static void TestDeferredCanvasCreateCompatibleDevice(skiatest::Reporter* reporte
r) { | 806 static void TestDeferredCanvasCreateCompatibleDevice(skiatest::Reporter* reporte
r) { |
| 807 SkBitmap store; | 807 SkBitmap store; |
| 808 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 808 store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
| 809 store.allocPixels(); | 809 store.allocPixels(); |
| 810 SkDevice device(store); | 810 SkBitmapDevice device(store); |
| 811 NotificationCounter notificationCounter; | 811 NotificationCounter notificationCounter; |
| 812 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); | 812 SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device)); |
| 813 canvas->setNotificationClient(¬ificationCounter); | 813 canvas->setNotificationClient(¬ificationCounter); |
| 814 SkAutoTUnref<SkDevice> secondaryDevice(canvas->createCompatibleDevice( | 814 SkAutoTUnref<SkBaseDevice> secondaryDevice(canvas->createCompatibleDevice( |
| 815 SkBitmap::kARGB_8888_Config, 10, 10, device.isOpaque())); | 815 SkBitmap::kARGB_8888_Config, 10, 10, device.isOpaque())); |
| 816 SkCanvas secondaryCanvas(secondaryDevice.get()); | 816 SkCanvas secondaryCanvas(secondaryDevice.get()); |
| 817 SkRect rect = SkRect::MakeWH(5, 5); | 817 SkRect rect = SkRect::MakeWH(5, 5); |
| 818 SkPaint paint; | 818 SkPaint paint; |
| 819 // After spawning a compatible canvas: | 819 // After spawning a compatible canvas: |
| 820 // 1) Verify that secondary canvas is usable and does not report to the noti
fication client. | 820 // 1) Verify that secondary canvas is usable and does not report to the noti
fication client. |
| 821 secondaryCanvas.drawRect(rect, paint); | 821 secondaryCanvas.drawRect(rect, paint); |
| 822 REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount
== 0); | 822 REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount
== 0); |
| 823 // 2) Verify that original canvas is usable and still reports to the notific
ation client. | 823 // 2) Verify that original canvas is usable and still reports to the notific
ation client. |
| 824 canvas->drawRect(rect, paint); | 824 canvas->drawRect(rect, paint); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 839 TestDeferredCanvasSurface(reporter, NULL); | 839 TestDeferredCanvasSurface(reporter, NULL); |
| 840 TestDeferredCanvasSetSurface(reporter, NULL); | 840 TestDeferredCanvasSetSurface(reporter, NULL); |
| 841 if (NULL != factory) { | 841 if (NULL != factory) { |
| 842 TestDeferredCanvasSurface(reporter, factory); | 842 TestDeferredCanvasSurface(reporter, factory); |
| 843 TestDeferredCanvasSetSurface(reporter, factory); | 843 TestDeferredCanvasSetSurface(reporter, factory); |
| 844 } | 844 } |
| 845 } | 845 } |
| 846 | 846 |
| 847 #include "TestClassDef.h" | 847 #include "TestClassDef.h" |
| 848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) | 848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) |
| OLD | NEW |