Create GPU-less build of Skia.



git-svn-id: http://skia.googlecode.com/svn/trunk@4912 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index a02f0d3..db6ffd0 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 @@
 ////////////////////////////////////////////////////////////////////////////////
 #include "TestClassDef.h"
 DEFINE_GPUTESTCLASS("ClipCache", ClipCacheTestClass, TestClipCache)
+
+#endif
diff --git a/tests/GLInterfaceValidation.cpp b/tests/GLInterfaceValidation.cpp
index 9ca2cc2..881a4c9 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 @@
                  GLInterfaceValidationTestClass,
                  GLInterfaceValidationTest)
 
+#endif
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 1eb0579..7e333f9 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 @@
 #include "TestClassDef.h"
 DEFINE_GPUTESTCLASS("GLPrograms", GLProgramsTestClass, GLProgramsTest)
 
+#endif
diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp
index 0426944..6c14dbe 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 @@
 #include "TestClassDef.h"
 DEFINE_TESTCLASS("GrMemoryPool", GrMemoryPoolClass, test_memory_pool)
 
+#endif
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index c4ec6ab..a22ff5a 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 @@
                                           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 4e0fcc6..730be05 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 @@
                                           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 fb818b3..6c1c912 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 @@
 #include "TestClassDef.h"
 DEFINE_GPUTESTCLASS("ReadWriteAlpha", ReadWriteAlphaTestClass, ReadWriteAlphaTest)
 
+#endif
diff --git a/tests/Test.cpp b/tests/Test.cpp
index 62df731..0441ab0 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 @@
 
 
 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 @@
         gGLContext.get()->makeCurrent();
     }
     return gGrContext.get();
+#else
+    return NULL;
+#endif
 }
 
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 12b57ca..688aa5d 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 @@
             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 @@
 
 enum DevType {
     kRaster_DevType,
+#if SK_SUPPORT_GPU
     kGpu_DevType,
+#endif
 };
 
 struct CanvasConfig {
@@ -287,7 +296,7 @@
 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 @@
                 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;
 }