From cf8fb1f6f03fc77f9927564f9ef9abeeeec508d2 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Thu, 2 Aug 2012 14:03:32 +0000 Subject: Create GPU-less build of Skia. git-svn-id: http://skia.googlecode.com/svn/trunk@4912 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/effects/gradients/SkGradientShader.cpp | 5 +++++ src/effects/gradients/SkGradientShaderPriv.h | 9 ++++++--- src/effects/gradients/SkLinearGradient.cpp | 11 +++++++++++ src/effects/gradients/SkRadialGradient.cpp | 11 +++++++++++ src/effects/gradients/SkSweepGradient.cpp | 11 +++++++++++ src/effects/gradients/SkTwoPointConicalGradient.cpp | 11 +++++++++++ src/effects/gradients/SkTwoPointRadialGradient.cpp | 11 +++++++++++ 7 files changed, 66 insertions(+), 3 deletions(-) (limited to 'src/effects/gradients') diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 0dfb186e75..e415c62c36 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -671,6 +671,10 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END /////////////////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + +#include "SkGr.h" + GrGLGradientStage::GrGLGradientStage(const GrProgramStageFactory& factory) : INHERITED(factory) { } @@ -728,3 +732,4 @@ GrTexture* GrGradientEffect::texture(unsigned int index) return fTexture; } +#endif diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index af15ecdff3..9e80fd3467 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -18,9 +18,6 @@ #include "SkTemplates.h" #include "SkBitmapCache.h" #include "SkShader.h" -#include "GrSamplerState.h" -#include "SkGr.h" -#include "gl/GrGLProgramStage.h" #ifndef SK_DISABLE_DITHER_32BIT_GRADIENT #define USE_DITHER_32BIT_GRADIENT @@ -192,6 +189,10 @@ private: /////////////////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + +#include "gl/GrGLProgramStage.h" + class GrSamplerState; class GrProgramStageFactory; @@ -262,3 +263,5 @@ private: #endif +#endif + diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 9d4ee6dddf..cd44d3f14e 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -472,6 +472,8 @@ void SkLinearGradient::shadeSpan16(int x, int y, } } +#if SK_SUPPORT_GPU + ///////////////////////////////////////////////////////////////////// class GrGLLinearGradient : public GrGLGradientStage { @@ -541,3 +543,12 @@ GrCustomStage* SkLinearGradient::asNewCustomStage(GrContext* context, return SkNEW_ARGS(GrLinearGradient, (context, *this, sampler)); } +#else + +GrCustomStage* SkLinearGradient::asNewCustomStage(GrContext* context, + GrSamplerState* sampler) const { + SkDEBUGFAIL("Should not call in GPU-less build"); + return NULL; +} + +#endif diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index be2e46f0ca..32083dc1da 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -471,6 +471,8 @@ void SkRadialGradient::shadeSpan(int x, int y, ///////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + class GrGLRadialGradient : public GrGLGradientStage { public: @@ -541,3 +543,12 @@ GrCustomStage* SkRadialGradient::asNewCustomStage(GrContext* context, return SkNEW_ARGS(GrRadialGradient, (context, *this, sampler)); } +#else + +GrCustomStage* SkRadialGradient::asNewCustomStage(GrContext* context, + GrSamplerState* sampler) const { + SkDEBUGFAIL("Should not call in GPU-less build"); + return NULL; +} + +#endif diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index b4e013a0a1..1daaa7d231 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -380,6 +380,8 @@ void SkSweepGradient::shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, ///////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + class GrGLSweepGradient : public GrGLGradientStage { public: @@ -448,3 +450,12 @@ GrCustomStage* SkSweepGradient::asNewCustomStage(GrContext* context, return SkNEW_ARGS(GrSweepGradient, (context, *this, sampler)); } +#else + +GrCustomStage* SkSweepGradient::asNewCustomStage(GrContext* context, + GrSamplerState* sampler) const { + SkDEBUGFAIL("Should not call in GPU-less build"); + return NULL; +} + +#endif diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index ae20caeb50..9fe180a3c9 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -315,6 +315,8 @@ void SkTwoPointConicalGradient::flatten( ///////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + // For brevity typedef GrGLUniformManager::UniformHandle UniformHandle; static const UniformHandle kInvalidUniformHandle = GrGLUniformManager::kInvalidUniformHandle; @@ -659,3 +661,12 @@ GrCustomStage* SkTwoPointConicalGradient::asNewCustomStage( return SkNEW_ARGS(GrConical2Gradient, (context, *this, sampler)); } +#else + +GrCustomStage* SkTwoPointConicalGradient::asNewCustomStage( + GrContext* context, GrSamplerState* sampler) const { + SkDEBUGFAIL("Should not call in GPU-less build"); + return NULL; +} + +#endif \ No newline at end of file diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp index 582c435bf2..06e27fe17a 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -347,6 +347,8 @@ void SkTwoPointRadialGradient::init() { ///////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + // For brevity typedef GrGLUniformManager::UniformHandle UniformHandle; static const UniformHandle kInvalidUniformHandle = GrGLUniformManager::kInvalidUniformHandle; @@ -630,3 +632,12 @@ GrCustomStage* SkTwoPointRadialGradient::asNewCustomStage( return SkNEW_ARGS(GrRadial2Gradient, (context, *this, sampler)); } +#else + +GrCustomStage* SkTwoPointRadialGradient::asNewCustomStage( + GrContext* context, GrSamplerState* sampler) const { + SkDEBUGFAIL("Should not call in GPU-less build"); + return NULL; +} + +#endif -- cgit v1.2.3