| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "TestClassDef.h" |
| 9 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| 10 #include "SkBitmapDevice.h" | 11 #include "SkBitmapDevice.h" |
| 11 #include "SkBitmapProcShader.h" | 12 #include "SkBitmapProcShader.h" |
| 12 #include "SkDeferredCanvas.h" | 13 #include "SkDeferredCanvas.h" |
| 13 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
| 14 #include "SkShader.h" | 15 #include "SkShader.h" |
| 15 #include "../src/image/SkSurface_Base.h" | 16 #include "../src/image/SkSurface_Base.h" |
| 16 #include "../src/image/SkImagePriv.h" | 17 #include "../src/image/SkImagePriv.h" |
| 17 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
| 18 #include "GrContextFactory.h" | 19 #include "GrContextFactory.h" |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 SkPaint paint; | 826 SkPaint paint; |
| 826 // After spawning a compatible canvas: | 827 // After spawning a compatible canvas: |
| 827 // 1) Verify that secondary canvas is usable and does not report to the noti
fication client. | 828 // 1) Verify that secondary canvas is usable and does not report to the noti
fication client. |
| 828 secondaryCanvas.drawRect(rect, paint); | 829 secondaryCanvas.drawRect(rect, paint); |
| 829 REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount
== 0); | 830 REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount
== 0); |
| 830 // 2) Verify that original canvas is usable and still reports to the notific
ation client. | 831 // 2) Verify that original canvas is usable and still reports to the notific
ation client. |
| 831 canvas->drawRect(rect, paint); | 832 canvas->drawRect(rect, paint); |
| 832 REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount
== 1); | 833 REPORTER_ASSERT(reporter, notificationCounter.fStorageAllocatedChangedCount
== 1); |
| 833 } | 834 } |
| 834 | 835 |
| 835 static void TestDeferredCanvas(skiatest::Reporter* reporter, GrContextFactory* f
actory) { | 836 DEF_GPUTEST(DeferredCanvas, reporter, factory) { |
| 836 TestDeferredCanvasBitmapAccess(reporter); | 837 TestDeferredCanvasBitmapAccess(reporter); |
| 837 TestDeferredCanvasFlush(reporter); | 838 TestDeferredCanvasFlush(reporter); |
| 838 TestDeferredCanvasFreshFrame(reporter); | 839 TestDeferredCanvasFreshFrame(reporter); |
| 839 TestDeferredCanvasMemoryLimit(reporter); | 840 TestDeferredCanvasMemoryLimit(reporter); |
| 840 TestDeferredCanvasBitmapCaching(reporter); | 841 TestDeferredCanvasBitmapCaching(reporter); |
| 841 TestDeferredCanvasSkip(reporter); | 842 TestDeferredCanvasSkip(reporter); |
| 842 TestDeferredCanvasBitmapShaderNoLeak(reporter); | 843 TestDeferredCanvasBitmapShaderNoLeak(reporter); |
| 843 TestDeferredCanvasBitmapSizeThreshold(reporter); | 844 TestDeferredCanvasBitmapSizeThreshold(reporter); |
| 844 TestDeferredCanvasCreateCompatibleDevice(reporter); | 845 TestDeferredCanvasCreateCompatibleDevice(reporter); |
| 845 TestDeferredCanvasWritePixelsToSurface(reporter); | 846 TestDeferredCanvasWritePixelsToSurface(reporter); |
| 846 TestDeferredCanvasSurface(reporter, NULL); | 847 TestDeferredCanvasSurface(reporter, NULL); |
| 847 TestDeferredCanvasSetSurface(reporter, NULL); | 848 TestDeferredCanvasSetSurface(reporter, NULL); |
| 848 if (NULL != factory) { | 849 if (NULL != factory) { |
| 849 TestDeferredCanvasSurface(reporter, factory); | 850 TestDeferredCanvasSurface(reporter, factory); |
| 850 TestDeferredCanvasSetSurface(reporter, factory); | 851 TestDeferredCanvasSetSurface(reporter, factory); |
| 851 } | 852 } |
| 852 } | 853 } |
| 853 | |
| 854 #include "TestClassDef.h" | |
| 855 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) | |
| OLD | NEW |