diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-02 14:03:32 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-02 14:03:32 +0000 |
commit | cf8fb1f6f03fc77f9927564f9ef9abeeeec508d2 (patch) | |
tree | 7534f5f2edd97cd61f18ee35ae4a14407a53453e /tests | |
parent | f2a9e58858423be9cbfa72e01e8284754e7d6381 (diff) |
Create GPU-less build of Skia.
git-svn-id: http://skia.googlecode.com/svn/trunk@4912 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ClipCacheTest.cpp | 7 | ||||
-rwxr-xr-x | tests/GLInterfaceValidation.cpp | 5 | ||||
-rw-r--r-- | tests/GLProgramsTest.cpp | 4 | ||||
-rw-r--r-- | tests/GrMemoryPoolTest.cpp | 4 | ||||
-rw-r--r-- | tests/PremulAlphaRoundTripTest.cpp | 9 | ||||
-rw-r--r-- | tests/ReadPixelsTest.cpp | 11 | ||||
-rw-r--r-- | tests/ReadWriteAlphaTest.cpp | 4 | ||||
-rw-r--r-- | tests/Test.cpp | 11 | ||||
-rw-r--r-- | tests/WritePixelsTest.cpp | 18 |
9 files changed, 64 insertions, 9 deletions
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp index a02f0d3ec9..db6ffd0631 100644 --- a/tests/ClipCacheTest.cpp +++ b/tests/ClipCacheTest.cpp @@ -5,6 +5,11 @@ * found in the LICENSE file. */ + +// This is a GR test + +#if SK_SUPPORT_GPU + #include "Test.h" #include "SkGpuDevice.h" #include "../../src/gpu/GrClipMaskManager.h" @@ -223,3 +228,5 @@ static void TestClipCache(skiatest::Reporter* reporter, GrContext* context) { //////////////////////////////////////////////////////////////////////////////// #include "TestClassDef.h" DEFINE_GPUTESTCLASS("ClipCache", ClipCacheTestClass, TestClipCache) + +#endif diff --git a/tests/GLInterfaceValidation.cpp b/tests/GLInterfaceValidation.cpp index 9ca2cc27ba..881a4c9f19 100755 --- a/tests/GLInterfaceValidation.cpp +++ b/tests/GLInterfaceValidation.cpp @@ -6,6 +6,10 @@ * found in the LICENSE file. */ + +// This is a GPU-backend specific test +#if SK_SUPPORT_GPU + #include "Test.h" #if SK_ANGLE #include "gl/SkANGLEGLContext.h" @@ -77,3 +81,4 @@ DEFINE_TESTCLASS("GLInterfaceValidation", GLInterfaceValidationTestClass, GLInterfaceValidationTest) +#endif diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 1eb05792a7..7e333f9bdc 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -6,6 +6,9 @@ * found in the LICENSE file. */ +// This is a GPU-backend specific test +#if SK_SUPPORT_GPU + #include "Test.h" #include "GrContext.h" #include "gl/GrGpuGL.h" @@ -19,3 +22,4 @@ static void GLProgramsTest(skiatest::Reporter* reporter, GrContext* context) { #include "TestClassDef.h" DEFINE_GPUTESTCLASS("GLPrograms", GLProgramsTestClass, GLProgramsTest) +#endif diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp index 0426944527..6c14dbe68c 100644 --- a/tests/GrMemoryPoolTest.cpp +++ b/tests/GrMemoryPoolTest.cpp @@ -5,6 +5,9 @@ * found in the LICENSE file. */ +// This is a GPU-backend specific test +#if SK_SUPPORT_GPU + #include "Test.h" #include "GrMemoryPool.h" #include "SkRandom.h" @@ -241,3 +244,4 @@ static void test_memory_pool(skiatest::Reporter* reporter) { #include "TestClassDef.h" DEFINE_TESTCLASS("GrMemoryPool", GrMemoryPoolClass, test_memory_pool) +#endif diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp index c4ec6ab90a..a22ff5ae13 100644 --- a/tests/PremulAlphaRoundTripTest.cpp +++ b/tests/PremulAlphaRoundTripTest.cpp @@ -9,7 +9,11 @@ #include "Test.h" #include "SkCanvas.h" #include "SkConfig8888.h" +#include "SkDevice.h" + +#if SK_SUPPORT_GPU #include "SkGpuDevice.h" +#endif namespace { @@ -52,14 +56,15 @@ void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, 256, false))->unref(); } else { -#if SK_SCALAR_IS_FIXED +#if !SK_SUPPORT_GPU || defined(SK_SCALAR_IS_FIXED) // GPU device known not to work in the fixed pt build. continue; -#endif +#else canvas.setDevice(new SkGpuDevice(context, SkBitmap::kARGB_8888_Config, 256, 256))->unref(); +#endif } SkBitmap readBmp1; diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 4e0fcc6703..730be05177 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -8,8 +8,12 @@ #include "Test.h" #include "SkCanvas.h" +#include "SkColorPriv.h" +#include "SkDevice.h" #include "SkRegion.h" +#if SK_SUPPORT_GPU #include "SkGpuDevice.h" +#endif static const int DEV_W = 100, DEV_H = 100; @@ -305,14 +309,15 @@ void ReadPixelsTest(skiatest::Reporter* reporter, GrContext* context) { DEV_H, false))->unref(); } else { -#if SK_SCALAR_IS_FIXED - // GPU device known not to work in the fixed pt build. +// GPU device known not to work in the fixed pt build. +#if defined(SK_SCALAR_IS_FIXED) || !SK_SUPPORT_GPU continue; -#endif +#else canvas.setDevice(new SkGpuDevice(context, SkBitmap::kARGB_8888_Config, DEV_W, DEV_H))->unref(); +#endif } fillCanvas(&canvas); diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index fb818b355a..6c1c9128a8 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -6,6 +6,9 @@ * found in the LICENSE file. */ +// This test is specific to the GPU backend. +#if SK_SUPPORT_GPU + #include "Test.h" #include "SkGpuDevice.h" @@ -105,3 +108,4 @@ static void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContext* context) #include "TestClassDef.h" DEFINE_GPUTESTCLASS("ReadWriteAlpha", ReadWriteAlphaTestClass, ReadWriteAlphaTest) +#endif diff --git a/tests/Test.cpp b/tests/Test.cpp index 62df73130f..0441ab0fa7 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp @@ -7,9 +7,14 @@ */ #include "Test.h" +#include "SkTLazy.h" + +#if SK_SUPPORT_GPU #include "GrContext.h" #include "gl/SkNativeGLContext.h" -#include "SkTLazy.h" +#else +class GrContext; +#endif using namespace skiatest; @@ -78,6 +83,7 @@ bool Test::run() { GrContext* GpuTest::GetContext() { +#if SK_SUPPORT_GPU // preserve this order, we want gGrContext destroyed after gEGLContext static SkTLazy<SkNativeGLContext> gGLContext; static SkAutoTUnref<GrContext> gGrContext; @@ -93,5 +99,8 @@ GrContext* GpuTest::GetContext() { gGLContext.get()->makeCurrent(); } return gGrContext.get(); +#else + return NULL; +#endif } diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 12b57cadef..688aa5d227 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -8,8 +8,14 @@ #include "Test.h" #include "SkCanvas.h" +#include "SkColorPriv.h" +#include "SkDevice.h" #include "SkRegion.h" +#if SK_SUPPORT_GPU #include "SkGpuDevice.h" +#else +class GrContext; +#endif static const int DEV_W = 100, DEV_H = 100; static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H); @@ -182,7 +188,8 @@ SkPMColor convertConfig8888ToPMColor(SkCanvas::Config8888 config8888, b = static_cast<U8CPU>(c[2]); break; default: - GrCrash("Unexpected Config8888"); + SkDEBUGFAIL("Unexpected Config8888"); + break; } if (*premul) { r = SkMulDiv255Ceiling(r, a); @@ -276,7 +283,9 @@ bool checkWrite(skiatest::Reporter* reporter, enum DevType { kRaster_DevType, +#if SK_SUPPORT_GPU kGpu_DevType, +#endif }; struct CanvasConfig { @@ -287,7 +296,7 @@ struct CanvasConfig { static const CanvasConfig gCanvasConfigs[] = { {kRaster_DevType, true}, {kRaster_DevType, false}, -#ifdef SK_SCALAR_IS_FLOAT +#if SK_SUPPORT_GPU && defined(SK_SCALAR_IS_FLOAT) {kGpu_DevType, true}, // row bytes has no meaning on gpu devices #endif }; @@ -307,12 +316,15 @@ bool setupCanvas(SkCanvas* canvas, const CanvasConfig& c, GrContext* grCtx) { memset(bmp.getPixels(), DEV_PAD, bmp.getSafeSize()); } canvas->setDevice(new SkDevice(bmp))->unref(); - } break; + break; + } +#if SK_SUPPORT_GPU case kGpu_DevType: canvas->setDevice(new SkGpuDevice(grCtx, SkBitmap::kARGB_8888_Config, DEV_W, DEV_H))->unref(); break; +#endif } return true; } |