diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp index f5082a0ab7..401d3c3e2e 100644 --- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp +++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp @@ -709,6 +709,7 @@ private: ///////////////////////////////////////////////////////////////////// GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoise2Effect); +#if GR_TEST_UTILS sk_sp GrPerlinNoise2Effect::TestCreate(GrProcessorTestData* d) { int numOctaves = d->fRandom->nextRangeU(2, 10); bool stitchTiles = d->fRandom->nextBool(); @@ -729,6 +730,7 @@ sk_sp GrPerlinNoise2Effect::TestCreate(GrProcessorTestData* GrTest::TestAsFPArgs asFPArgs(d); return shader->asFragmentProcessor(asFPArgs.args()); } +#endif void GrGLPerlinNoise2::emitCode(EmitArgs& args) { const GrPerlinNoise2Effect& pne = args.fFp.cast(); @@ -1118,6 +1120,7 @@ private: ///////////////////////////////////////////////////////////////////// GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrImprovedPerlinNoiseEffect); +#if GR_TEST_UTILS sk_sp GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTestData* d) { SkScalar baseFrequencyX = d->fRandom->nextRangeScalar(0.01f, 0.99f); @@ -1134,6 +1137,7 @@ sk_sp GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTe GrTest::TestAsFPArgs asFPArgs(d); return shader->asFragmentProcessor(asFPArgs.args()); } +#endif void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) { GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h index a56db8188b..748a522c57 100644 --- a/include/gpu/GrProcessorUnitTest.h +++ b/include/gpu/GrProcessorUnitTest.h @@ -8,10 +8,13 @@ #ifndef GrProcessorUnitTest_DEFINED #define GrProcessorUnitTest_DEFINED +#include "SkTypes.h" + +#if GR_TEST_UTILS + #include "../private/GrTextureProxy.h" #include "../private/SkTArray.h" #include "GrTestUtils.h" -#include "SkTypes.h" class SkMatrix; class GrCaps; @@ -183,5 +186,19 @@ private: const GrXPFactory* TestGet(GrProcessorTestData*) #define GR_DEFINE_XP_FACTORY_TEST(X) -#endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS -#endif +#endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS +#else // GR_TEST_UTILS + #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST + #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST + #define GR_DECLARE_XP_FACTORY_TEST + #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(...) + #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(...) + #define GR_DEFINE_XP_FACTORY_TEST(...) + #define GR_DECLARE_FRAGMENT_PROCESSOR_TEST + #define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(...) + #define GR_DECLARE_GEOMETRY_PROCESSOR_TEST + #define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(...) + #define GR_DECLARE_XP_FACTORY_TEST + #define GR_DEFINE_XP_FACTORY_TEST(...) +#endif // GR_TEST_UTILS +#endif // GrProcessorUnitTest_DEFINED diff --git a/include/gpu/GrTestUtils.h b/include/gpu/GrTestUtils.h index 373847dfe9..5bb1cc1738 100644 --- a/include/gpu/GrTestUtils.h +++ b/include/gpu/GrTestUtils.h @@ -10,7 +10,7 @@ #include "SkTypes.h" -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrColor.h" #include "GrColorSpaceXform.h" diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp index 167fd21b38..0c6318bd95 100644 --- a/src/core/SkColorMatrixFilterRowMajor255.cpp +++ b/src/core/SkColorMatrixFilterRowMajor255.cpp @@ -418,6 +418,7 @@ private: GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorMatrixEffect); +#if GR_TEST_UTILS sk_sp ColorMatrixEffect::TestCreate(GrProcessorTestData* d) { SkScalar colorMatrix[20]; for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix); ++i) { @@ -425,6 +426,7 @@ sk_sp ColorMatrixEffect::TestCreate(GrProcessorTestData* d) } return ColorMatrixEffect::Make(colorMatrix); } +#endif sk_sp SkColorMatrixFilterRowMajor255::asFragmentProcessor( GrContext*, SkColorSpace*) const { diff --git a/src/core/SkColorShader.cpp b/src/core/SkColorShader.cpp index 9d93240a6d..ed2a26b931 100644 --- a/src/core/SkColorShader.cpp +++ b/src/core/SkColorShader.cpp @@ -211,6 +211,7 @@ SkShader::GradientType SkColor4Shader::asAGradient(GradientInfo* info) const { #include "SkGr.h" #include "effects/GrConstColorProcessor.h" +#include "GrColorSpaceXform.h" sk_sp SkColor4Shader::asFragmentProcessor(const AsFPArgs& args) const { sk_sp colorSpaceXform = GrColorSpaceXform::Make(fColorSpace.get(), args.fDstColorSpace); diff --git a/src/core/SkModeColorFilter.cpp b/src/core/SkModeColorFilter.cpp index 58127d3ba7..05dfbff1cc 100644 --- a/src/core/SkModeColorFilter.cpp +++ b/src/core/SkModeColorFilter.cpp @@ -16,6 +16,7 @@ #include "SkReadBuffer.h" #include "SkWriteBuffer.h" #include "SkUtils.h" +#include "SkRandom.h" #include "SkString.h" #include "SkValidationUtils.h" #include "SkPM4f.h" diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index 8f9e45dc2b..a18fb9c1e9 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -170,6 +170,7 @@ void GrGLAlphaThresholdFragmentProcessor::onSetData(const GrGLSLProgramDataManag GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrAlphaThresholdFragmentProcessor); +#if GR_TEST_UTILS sk_sp GrAlphaThresholdFragmentProcessor::TestCreate(GrProcessorTestData* d) { GrTexture* bmpTex = d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx]; GrTexture* maskTex = d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx]; @@ -187,6 +188,7 @@ sk_sp GrAlphaThresholdFragmentProcessor::TestCreate(GrProce innerThresh, outerThresh, bounds); } +#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index 91d17d6e6c..c54a71c809 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -347,11 +347,13 @@ sk_sp GrCircleBlurFragmentProcessor::Make(GrTextureProvider GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); +#if GR_TEST_UTILS sk_sp GrCircleBlurFragmentProcessor::TestCreate(GrProcessorTestData* d) { SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); SkRect circle = SkRect::MakeWH(wh, wh); return GrCircleBlurFragmentProcessor::Make(d->fContext->textureProvider(), circle, sigma); } +#endif #endif diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp index c3847ff9c6..40560690ee 100644 --- a/src/effects/SkArithmeticImageFilter.cpp +++ b/src/effects/SkArithmeticImageFilter.cpp @@ -313,6 +313,7 @@ private: }; } +#if GR_TEST_UTILS sk_sp ArithmeticFP::TestCreate(GrProcessorTestData* d) { float k1 = d->fRandom->nextF(); float k2 = d->fRandom->nextF(); @@ -323,6 +324,7 @@ sk_sp ArithmeticFP::TestCreate(GrProcessorTestData* d) { sk_sp dst(GrProcessorUnitTest::MakeChildFP(d)); return ArithmeticFP::Make(k1, k2, k3, k4, enforcePMColor, std::move(dst)); } +#endif GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ArithmeticFP); diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 1da9816658..f41648dc4b 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -1005,6 +1005,7 @@ void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect); +#if GR_TEST_UTILS sk_sp GrRectBlurEffect::TestCreate(GrProcessorTestData* d) { float sigma = d->fRandom->nextRangeF(3,8); float width = d->fRandom->nextRangeF(200,300); @@ -1012,6 +1013,7 @@ sk_sp GrRectBlurEffect::TestCreate(GrProcessorTestData* d) return GrRectBlurEffect::Make(d->fContext->textureProvider(), SkRect::MakeWH(width, height), sigma); } +#endif bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider, GrRenderTargetContext* renderTargetContext, @@ -1227,6 +1229,7 @@ bool GrRRectBlurEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRRectBlurEffect); +#if GR_TEST_UTILS sk_sp GrRRectBlurEffect::TestCreate(GrProcessorTestData* d) { SkScalar w = d->fRandom->nextRangeScalar(100.f, 1000.f); SkScalar h = d->fRandom->nextRangeScalar(100.f, 1000.f); @@ -1236,6 +1239,7 @@ sk_sp GrRRectBlurEffect::TestCreate(GrProcessorTestData* d) rrect.setRectXY(SkRect::MakeWH(w, h), r, r); return GrRRectBlurEffect::Make(d->fContext, sigma, sigma, rrect, rrect); } +#endif ////////////////////////////////////////////////////////////////////////////// diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 9693191c3b..67fb761ed4 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -537,6 +537,7 @@ void GrDisplacementMapEffect::onComputeInvariantOutput(GrInvariantOutput* inout) GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect); +#if GR_TEST_UTILS sk_sp GrDisplacementMapEffect::TestCreate(GrProcessorTestData* d) { int texIdxDispl = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -560,6 +561,7 @@ sk_sp GrDisplacementMapEffect::TestCreate(GrProcessorTestDa d->fTextures[texIdxColor], colorSpaceXform, colorDimensions); } +#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 0a4ce2f46d..fc7b29b490 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1752,6 +1752,7 @@ GrGLSLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLSLInstance() const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect); +#if GR_TEST_UTILS sk_sp GrDiffuseLightingEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -1771,6 +1772,7 @@ sk_sp GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa return GrDiffuseLightingEffect::Make(tex, light.get(), surfaceScale, matrix, kd, mode, &srcBounds); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -1970,6 +1972,7 @@ GrGLSLFragmentProcessor* GrSpecularLightingEffect::onCreateGLSLInstance() const GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSpecularLightingEffect); +#if GR_TEST_UTILS sk_sp GrSpecularLightingEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -1991,6 +1994,7 @@ sk_sp GrSpecularLightingEffect::TestCreate(GrProcessorTestD light.get(), surfaceScale, matrix, ks, shininess, mode, &srcBounds); } +#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 49f4fdddc3..93a67104f4 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -210,6 +210,7 @@ GrGLSLFragmentProcessor* GrMagnifierEffect::onCreateGLSLInstance() const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect); +#if GR_TEST_UTILS sk_sp GrMagnifierEffect::TestCreate(GrProcessorTestData* d) { GrTexture* texture = d->fTextures[0]; const int kMaxWidth = 200; @@ -235,6 +236,7 @@ sk_sp GrMagnifierEffect::TestCreate(GrProcessorTestData* d) SkASSERT(effect); return effect; } +#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 6af8508b5a..8d6dbfc2b7 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -16,6 +16,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" +#include "GrTextureProxy.h" #include "effects/GrMatrixConvolutionEffect.h" #endif diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 75e019bd94..2c813e283a 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -373,6 +373,7 @@ void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect); +#if GR_TEST_UTILS sk_sp GrMorphologyEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -384,6 +385,7 @@ sk_sp GrMorphologyEffect::TestCreate(GrProcessorTestData* d return GrMorphologyEffect::Make(d->fTextures[texIdx], dir, radius, type); } +#endif static void apply_morphology_rect(GrTextureProvider* provider, diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index 450fcaa4ef..92f2946c74 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -573,6 +573,7 @@ private: ///////////////////////////////////////////////////////////////////// GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoiseEffect); +#if GR_TEST_UTILS sk_sp GrPerlinNoiseEffect::TestCreate(GrProcessorTestData* d) { int numOctaves = d->fRandom->nextRangeU(2, 10); bool stitchTiles = d->fRandom->nextBool(); @@ -593,6 +594,7 @@ sk_sp GrPerlinNoiseEffect::TestCreate(GrProcessorTestData* GrTest::TestAsFPArgs asFPArgs(d); return shader->asFragmentProcessor(asFPArgs.args()); } +#endif void GrGLPerlinNoise::emitCode(EmitArgs& args) { const GrPerlinNoiseEffect& pne = args.fFp.cast(); diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 9198460c66..7de1008abe 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -569,6 +569,7 @@ void ColorTableEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect); +#if GR_TEST_UTILS sk_sp ColorTableEffect::TestCreate(GrProcessorTestData* d) { int flags = 0; uint8_t luts[256][4]; @@ -595,6 +596,7 @@ sk_sp ColorTableEffect::TestCreate(GrProcessorTestData* d) SkASSERT(fp); return fp; } +#endif sk_sp SkTable_ColorFilter::asFragmentProcessor(GrContext* context, SkColorSpace*) const { diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 9a3438efe0..7b91a60f75 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1740,6 +1740,7 @@ void GrGradientEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const } } +#if GR_TEST_UTILS GrGradientEffect::RandomGradientParams::RandomGradientParams(SkRandom* random) { fColorCount = random->nextRangeU(1, kMaxRandomGradientColors); fUseColors4f = random->nextBool(); @@ -1777,5 +1778,6 @@ GrGradientEffect::RandomGradientParams::RandomGradientParams(SkRandom* random) { } fTileMode = static_cast(random->nextULessThan(SkShader::kTileModeCount)); } +#endif #endif diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 6f46698eba..75b6595926 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -402,6 +402,7 @@ public: protected: GrGradientEffect(const CreateArgs&, bool isOpaque); + #if GR_TEST_UTILS /** Helper struct that stores (and populates) parameters to construct a random gradient. If fUseColors4f is true, then the SkColor4f factory should be called, with fColors4f and fColorSpace. Otherwise, the SkColor factory should be called, with fColors. fColorCount @@ -422,6 +423,7 @@ protected: int fColorCount; SkScalar* fStops; }; + #endif bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index b3f70d1173..5a74bfd7b9 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -477,6 +477,7 @@ void GrLinearGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps, GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrLinearGradient); +#if GR_TEST_UTILS sk_sp GrLinearGradient::TestCreate(GrProcessorTestData* d) { SkPoint points[] = {{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}, {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}}; @@ -492,6 +493,7 @@ sk_sp GrLinearGradient::TestCreate(GrProcessorTestData* d) GrAlwaysAssert(fp); return fp; } +#endif ///////////////////////////////////////////////////////////////////// diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index 4eb3e6d93a..a7dca764d5 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -303,6 +303,7 @@ void GrRadialGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps, GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRadialGradient); +#if GR_TEST_UTILS sk_sp GrRadialGradient::TestCreate(GrProcessorTestData* d) { SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; SkScalar radius = d->fRandom->nextUScalar1(); @@ -318,6 +319,7 @@ sk_sp GrRadialGradient::TestCreate(GrProcessorTestData* d) GrAlwaysAssert(fp); return fp; } +#endif ///////////////////////////////////////////////////////////////////// diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 7e93a21de4..27d5dbeb7b 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -186,6 +186,7 @@ void GrSweepGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps, GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSweepGradient); +#if GR_TEST_UTILS sk_sp GrSweepGradient::TestCreate(GrProcessorTestData* d) { SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; @@ -200,6 +201,7 @@ sk_sp GrSweepGradient::TestCreate(GrProcessorTestData* d) { GrAlwaysAssert(fp); return fp; } +#endif ///////////////////////////////////////////////////////////////////// diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index 75b1cf7090..a301d64aca 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -182,6 +182,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Edge2PtConicalEffect); /* * All Two point conical gradient test create functions may occasionally create edge case shaders */ +#if GR_TEST_UTILS sk_sp Edge2PtConicalEffect::TestCreate(GrProcessorTestData* d) { SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; SkScalar radius1 = d->fRandom->nextUScalar1(); @@ -212,6 +213,7 @@ sk_sp Edge2PtConicalEffect::TestCreate(GrProcessorTestData* GrAlwaysAssert(fp); return fp; } +#endif Edge2PtConicalEffect::GLSLEdge2PtConicalProcessor::GLSLEdge2PtConicalProcessor(const GrProcessor&) : fVSVaryingName(nullptr) @@ -464,6 +466,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalOutside2PtConicalEffect); /* * All Two point conical gradient test create functions may occasionally create edge case shaders */ +#if GR_TEST_UTILS sk_sp FocalOutside2PtConicalEffect::TestCreate(GrProcessorTestData* d) { SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; SkScalar radius1 = 0.f; @@ -492,6 +495,7 @@ sk_sp FocalOutside2PtConicalEffect::TestCreate(GrProcessorT GrAlwaysAssert(fp); return fp; } +#endif FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor ::GLSLFocalOutside2PtConicalProcessor(const GrProcessor& processor) @@ -666,6 +670,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalInside2PtConicalEffect); /* * All Two point conical gradient test create functions may occasionally create edge case shaders */ +#if GR_TEST_UTILS sk_sp FocalInside2PtConicalEffect::TestCreate(GrProcessorTestData* d) { SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; SkScalar radius1 = 0.f; @@ -695,6 +700,7 @@ sk_sp FocalInside2PtConicalEffect::TestCreate(GrProcessorTe GrAlwaysAssert(fp); return fp; } +#endif FocalInside2PtConicalEffect::GLSLFocalInside2PtConicalProcessor ::GLSLFocalInside2PtConicalProcessor(const GrProcessor&) @@ -912,6 +918,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleInside2PtConicalEffect); /* * All Two point conical gradient test create functions may occasionally create edge case shaders */ +#if GR_TEST_UTILS sk_sp CircleInside2PtConicalEffect::TestCreate(GrProcessorTestData* d) { SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; SkScalar radius1 = d->fRandom->nextUScalar1() + 0.0001f; // make sure radius1 != 0 @@ -940,6 +947,7 @@ sk_sp CircleInside2PtConicalEffect::TestCreate(GrProcessorT GrAlwaysAssert(fp); return fp; } +#endif CircleInside2PtConicalEffect::GLSLCircleInside2PtConicalProcessor ::GLSLCircleInside2PtConicalProcessor(const GrProcessor& processor) @@ -1144,6 +1152,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleOutside2PtConicalEffect); /* * All Two point conical gradient test create functions may occasionally create edge case shaders */ +#if GR_TEST_UTILS sk_sp CircleOutside2PtConicalEffect::TestCreate(GrProcessorTestData* d) { SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; SkScalar radius1 = d->fRandom->nextUScalar1() + 0.0001f; // make sure radius1 != 0 @@ -1173,6 +1182,7 @@ sk_sp CircleOutside2PtConicalEffect::TestCreate(GrProcessor GrAlwaysAssert(fp); return fp; } +#endif CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor ::GLSLCircleOutside2PtConicalProcessor(const GrProcessor& processor) diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp index ab57c0b7b5..f371e24b1f 100644 --- a/src/gpu/GrDefaultGeoProcFactory.cpp +++ b/src/gpu/GrDefaultGeoProcFactory.cpp @@ -237,6 +237,7 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc); +#if GR_TEST_UTILS sk_sp DefaultGeoProc::TestCreate(GrProcessorTestData* d) { uint32_t flags = 0; if (d->fRandom->nextBool()) { @@ -260,6 +261,7 @@ sk_sp DefaultGeoProc::TestCreate(GrProcessorTestData* d) { d->fRandom->nextBool(), GrRandomCoverage(d->fRandom)); } +#endif sk_sp GrDefaultGeoProcFactory::Make(const Color& color, const Coverage& coverage, diff --git a/src/gpu/GrDrawOpTest.cpp b/src/gpu/GrDrawOpTest.cpp index 3cf1a90b8e..5d0aa56ee9 100644 --- a/src/gpu/GrDrawOpTest.cpp +++ b/src/gpu/GrDrawOpTest.cpp @@ -10,7 +10,7 @@ #include "SkRandom.h" #include "SkTypes.h" -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #define DRAW_OP_TEST_EXTERN(Op) \ extern std::unique_ptr Op##__Test(SkRandom*, GrContext* context); diff --git a/src/gpu/GrDrawOpTest.h b/src/gpu/GrDrawOpTest.h index 46abf18283..8c98597c3f 100644 --- a/src/gpu/GrDrawOpTest.h +++ b/src/gpu/GrDrawOpTest.h @@ -11,7 +11,7 @@ #include "GrTestUtils.h" #include "SkRefCnt.h" -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS class GrDrawOp; class GrContext; diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 56d3e7f1a4..897a755902 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -17,7 +17,7 @@ #include "SkSpinlock.h" #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS - +#if GR_TEST_UTILS class GrFragmentProcessor; class GrGeometryProcessor; @@ -80,6 +80,7 @@ void GrXPFactoryTestFactory::VerifyFactoryCount() { } #endif +#endif // We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on diff --git a/src/gpu/GrProcessorUnitTest.cpp b/src/gpu/GrProcessorUnitTest.cpp index 3f43389fe0..71b112d20f 100644 --- a/src/gpu/GrProcessorUnitTest.cpp +++ b/src/gpu/GrProcessorUnitTest.cpp @@ -8,6 +8,8 @@ #include "GrProcessorUnitTest.h" #include "GrFragmentProcessor.h" +#if GR_TEST_UTILS + sk_sp GrProcessorUnitTest::MakeChildFP(GrProcessorTestData* data) { #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS sk_sp fp; @@ -21,3 +23,4 @@ sk_sp GrProcessorUnitTest::MakeChildFP(GrProcessorTestData* return nullptr; #endif } +#endif diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp index c9cccb8f93..35af494c9b 100644 --- a/src/gpu/GrTestUtils.cpp +++ b/src/gpu/GrTestUtils.cpp @@ -14,7 +14,7 @@ #include "SkPath.h" #include "SkRRect.h" -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS static const SkMatrix& test_matrix(SkRandom* random, bool includeNonPerspective, diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index aef3c0d1be..ad43eef76d 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -14,6 +14,7 @@ #include "GrGpuResourcePriv.h" #include "GrRenderTargetContext.h" #include "GrTexturePriv.h" +#include "GrTextureProxy.h" #include "GrTypes.h" #include "GrXferProcessor.h" diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index 834b11dc17..4877072210 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -258,6 +258,7 @@ GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); +#if GR_TEST_UTILS sk_sp GrConicEffect::TestCreate(GrProcessorTestData* d) { sk_sp gp; do { @@ -270,6 +271,7 @@ sk_sp GrConicEffect::TestCreate(GrProcessorTestData* d) { } while (nullptr == gp); return gp; } +#endif ////////////////////////////////////////////////////////////////////////////// // Quad @@ -459,6 +461,7 @@ GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); +#if GR_TEST_UTILS sk_sp GrQuadEffect::TestCreate(GrProcessorTestData* d) { sk_sp gp; do { @@ -470,6 +473,7 @@ sk_sp GrQuadEffect::TestCreate(GrProcessorTestData* d) { } while (nullptr == gp); return gp; } +#endif ////////////////////////////////////////////////////////////////////////////// // Cubic @@ -679,6 +683,7 @@ GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); +#if GR_TEST_UTILS sk_sp GrCubicEffect::TestCreate(GrProcessorTestData* d) { sk_sp gp; do { @@ -690,3 +695,4 @@ sk_sp GrCubicEffect::TestCreate(GrProcessorTestData* d) { } while (nullptr == gp); return gp; } +#endif diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index cb589959a2..2499c20cb2 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -8,6 +8,7 @@ #include "GrBicubicEffect.h" #include "GrInvariantOutput.h" #include "GrProxyMove.h" +#include "GrTextureProxy.h" #include "glsl/GrGLSLColorSpaceXformHelper.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -202,6 +203,7 @@ void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); +#if GR_TEST_UTILS sk_sp GrBicubicEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -211,6 +213,7 @@ sk_sp GrBicubicEffect::TestCreate(GrProcessorTestData* d) { return GrBicubicEffect::Make(d->context(), d->textureProxy(texIdx), std::move(colorSpaceXform), SkMatrix::I(), kClampClamp); } +#endif ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 3c4566ea7c..60df6b90b2 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -154,6 +154,7 @@ GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrShader GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc); +#if GR_TEST_UTILS sk_sp GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -186,3 +187,4 @@ sk_sp GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* format, GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool()); } +#endif diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index d9b408a6bb..d9a6fefc1e 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -149,6 +149,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); #pragma optimize("t", off) #endif +#if GR_TEST_UTILS sk_sp GrConfigConversionEffect::TestCreate(GrProcessorTestData* d) { PMConversion pmConv = static_cast(d->fRandom->nextULessThan(kPMConversionCnt)); GrSwizzle swizzle; @@ -160,6 +161,7 @@ sk_sp GrConfigConversionEffect::TestCreate(GrProcessorTestD d->textureProxy(GrProcessorUnitTest::kSkiaPMTextureIdx), swizzle, pmConv, GrTest::TestMatrix(d->fRandom))); } +#endif #if !defined(__clang__) && _MSC_FULL_VER >= 190024213 // Restore optimization settings. diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp index 3875ffcaa0..1d20512a63 100644 --- a/src/gpu/effects/GrConstColorProcessor.cpp +++ b/src/gpu/effects/GrConstColorProcessor.cpp @@ -116,6 +116,7 @@ bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); +#if GR_TEST_UTILS sk_sp GrConstColorProcessor::TestCreate(GrProcessorTestData* d) { GrColor4f color; int colorPicker = d->fRandom->nextULessThan(3); @@ -139,3 +140,4 @@ sk_sp GrConstColorProcessor::TestCreate(GrProcessorTestData InputMode mode = static_cast(d->fRandom->nextULessThan(kInputModeCnt)); return GrConstColorProcessor::Make(color, mode); } +#endif diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index 4100a0fce2..db8c2d999e 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -63,6 +63,7 @@ private: GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); +#if GR_TEST_UTILS sk_sp AARectEffect::TestCreate(GrProcessorTestData* d) { SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(), d->fRandom->nextSScalar1(), @@ -77,6 +78,7 @@ sk_sp AARectEffect::TestCreate(GrProcessorTestData* d) { } while (nullptr == fp); return fp; } +#endif ////////////////////////////////////////////////////////////////////////////// @@ -362,6 +364,7 @@ bool GrConvexPolyEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect); +#if GR_TEST_UTILS sk_sp GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) { int count = d->fRandom->nextULessThan(kMaxEdges) + 1; SkScalar edges[kMaxEdges * 3]; @@ -377,3 +380,4 @@ sk_sp GrConvexPolyEffect::TestCreate(GrProcessorTestData* d } while (nullptr == fp); return fp; } +#endif diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp index 05e9fadf9b..b8902de58c 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.cpp +++ b/src/gpu/effects/GrCoverageSetOpXP.cpp @@ -347,8 +347,10 @@ void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); +#if GR_TEST_UTILS const GrXPFactory* GrCoverageSetOpXPFactory::TestGet(GrProcessorTestData* d) { SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLastOp + 1)); bool invertCoverage = !d->fRenderTargetContext->hasMixedSamples() && d->fRandom->nextBool(); return GrCoverageSetOpXPFactory::Get(regionOp, invertCoverage); } +#endif diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index f8af7db8a0..4c33b9b9ec 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -382,12 +382,14 @@ void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, } GR_DEFINE_XP_FACTORY_TEST(CustomXPFactory); +#if GR_TEST_UTILS const GrXPFactory* CustomXPFactory::TestGet(GrProcessorTestData* d) { int mode = d->fRandom->nextRangeU((int)SkBlendMode::kLastCoeffMode + 1, (int)SkBlendMode::kLastSeparableMode); return GrCustomXfermode::Get((SkBlendMode)mode); } +#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index 69c34ecc66..7323331a67 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -98,6 +98,8 @@ GrXferProcessor* GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& ca GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); +#if GR_TEST_UTILS const GrXPFactory* GrDisableColorXPFactory::TestGet(GrProcessorTestData*) { return GrDisableColorXPFactory::Get(); } +#endif diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index ee28760b11..0f9625e8a0 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -265,6 +265,7 @@ GrDistanceFieldA8TextGeoProc::createGLSLInstance(const GrShaderCaps&) const { GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc); +#if GR_TEST_UTILS sk_sp GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -295,6 +296,7 @@ sk_sp GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT flags, d->fRandom->nextBool()); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -503,6 +505,7 @@ GrDistanceFieldPathGeoProc::createGLSLInstance(const GrShaderCaps&) const { GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldPathGeoProc); +#if GR_TEST_UTILS sk_sp GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -531,6 +534,7 @@ sk_sp GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes flags, d->fRandom->nextBool()); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -801,6 +805,7 @@ GrGLSLPrimitiveProcessor* GrDistanceFieldLCDTextGeoProc::createGLSLInstance(cons GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextGeoProc); +#if GR_TEST_UTILS sk_sp GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -829,3 +834,4 @@ sk_sp GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor flags, d->fRandom->nextBool()); } +#endif diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 24e3ba6d50..34a15651d2 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -50,9 +50,11 @@ void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect); +#if GR_TEST_UTILS sk_sp DitherEffect::TestCreate(GrProcessorTestData*) { return DitherEffect::Make(); } +#endif ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp index 66aba13438..2d485e634e 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp @@ -7,6 +7,7 @@ #include "GrGaussianConvolutionFragmentProcessor.h" #include "GrProxyMove.h" +#include "GrTextureProxy.h" #include "../private/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" @@ -229,6 +230,7 @@ bool GrGaussianConvolutionFragmentProcessor::onIsEqual(const GrFragmentProcessor GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrGaussianConvolutionFragmentProcessor); +#if GR_TEST_UTILS sk_sp GrGaussianConvolutionFragmentProcessor::TestCreate( GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx @@ -255,3 +257,4 @@ sk_sp GrGaussianConvolutionFragmentProcessor::TestCreate( return GrGaussianConvolutionFragmentProcessor::Make( d->context(), d->textureProxy(texIdx), dir, radius, sigma, useBounds, bounds); } +#endif diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index 86fd565877..1a40514c83 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ #include "GrMatrixConvolutionEffect.h" +#include "GrTextureProxy.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -290,6 +291,7 @@ sk_sp GrMatrixConvolutionEffect::MakeGaussian(GrContext* co GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect); +#if GR_TEST_UTILS sk_sp GrMatrixConvolutionEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -322,3 +324,4 @@ sk_sp GrMatrixConvolutionEffect::TestCreate(GrProcessorTest tileMode, convolveAlpha); } +#endif diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index 3b0a8871c4..b64ac56859 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -77,6 +77,7 @@ bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); +#if GR_TEST_UTILS sk_sp CircleEffect::TestCreate(GrProcessorTestData* d) { SkPoint center; center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f); @@ -88,6 +89,7 @@ sk_sp CircleEffect::TestCreate(GrProcessorTestData* d) { } while (kHairlineAA_GrProcessorEdgeType == et); return CircleEffect::Make(et, center, radius); } +#endif ////////////////////////////////////////////////////////////////////////////// @@ -246,6 +248,7 @@ bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); +#if GR_TEST_UTILS sk_sp EllipseEffect::TestCreate(GrProcessorTestData* d) { SkPoint center; center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f); @@ -258,6 +261,7 @@ sk_sp EllipseEffect::TestCreate(GrProcessorTestData* d) { } while (kHairlineAA_GrProcessorEdgeType == et); return EllipseEffect::Make(et, center, rx, ry); } +#endif ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index 59710ebfc0..8289561b1e 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -830,10 +830,12 @@ bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps, ColorType color GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); +#if GR_TEST_UTILS const GrXPFactory* GrPorterDuffXPFactory::TestGet(GrProcessorTestData* d) { SkBlendMode mode = SkBlendMode(d->fRandom->nextULessThan((int)SkBlendMode::kLastCoeffMode)); return GrPorterDuffXPFactory::Get(mode); } +#endif void GrPorterDuffXPFactory::TestGetXPOutputTypes(const GrXferProcessor* xp, int* outPrimary, @@ -847,7 +849,6 @@ void GrPorterDuffXPFactory::TestGetXPOutputTypes(const GrXferProcessor* xp, *outSecondary = blendFormula.fSecondaryOutputType; } - //////////////////////////////////////////////////////////////////////////////////////////////// // SrcOver Global functions //////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index 4397fcf930..dabf11ae8d 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -112,6 +112,7 @@ bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); +#if GR_TEST_UTILS sk_sp CircularRRectEffect::TestCreate(GrProcessorTestData* d) { SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); @@ -126,6 +127,7 @@ sk_sp CircularRRectEffect::TestCreate(GrProcessorTestData* } while (nullptr == fp); return fp; } +#endif ////////////////////////////////////////////////////////////////////////////// @@ -445,6 +447,7 @@ bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); +#if GR_TEST_UTILS sk_sp EllipticalRRectEffect::TestCreate(GrProcessorTestData* d) { SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); @@ -480,6 +483,7 @@ sk_sp EllipticalRRectEffect::TestCreate(GrProcessorTestData } while (nullptr == fp); return fp; } +#endif ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrSRGBEffect.cpp b/src/gpu/effects/GrSRGBEffect.cpp index 9279586584..ad90e70936 100644 --- a/src/gpu/effects/GrSRGBEffect.cpp +++ b/src/gpu/effects/GrSRGBEffect.cpp @@ -110,10 +110,12 @@ GrColor4f GrSRGBEffect::constantOutputForConstantInput(GrColor4f input) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSRGBEffect); +#if GR_TEST_UTILS sk_sp GrSRGBEffect::TestCreate(GrProcessorTestData* d) { Mode testMode = static_cast(d->fRandom->nextRangeU(0, 1)); return sk_sp(new GrSRGBEffect(testMode)); } +#endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrShadowGeoProc.cpp b/src/gpu/effects/GrShadowGeoProc.cpp index cb4c834aea..e11a672dba 100755 --- a/src/gpu/effects/GrShadowGeoProc.cpp +++ b/src/gpu/effects/GrShadowGeoProc.cpp @@ -99,6 +99,8 @@ GrGLSLPrimitiveProcessor* GrRRectShadowGeoProc::createGLSLInstance(const GrShade GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrRRectShadowGeoProc); +#if GR_TEST_UTILS sk_sp GrRRectShadowGeoProc::TestCreate(GrProcessorTestData* d) { return GrRRectShadowGeoProc::Make(GrTest::TestMatrix(d->fRandom)); } +#endif diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 3dc6ea3a2c..8b63fec907 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -96,6 +96,7 @@ GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLSLInstance() const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect); +#if GR_TEST_UTILS sk_sp GrSimpleTextureEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -116,3 +117,4 @@ sk_sp GrSimpleTextureEffect::TestCreate(GrProcessorTestData return GrSimpleTextureEffect::Make(d->context(), d->textureProxy(texIdx), std::move(colorSpaceXform), matrix); } +#endif diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index f27b776f3c..58707f5744 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -375,6 +375,7 @@ void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); +#if GR_TEST_UTILS sk_sp GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; @@ -398,6 +399,7 @@ sk_sp GrTextureDomainEffect::TestCreate(GrProcessorTestData bilerp ? GrSamplerParams::kBilerp_FilterMode : GrSamplerParams::kNone_FilterMode); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -515,6 +517,7 @@ void GrDeviceSpaceTextureDecalFragmentProcessor::onComputeInvariantOutput( GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDeviceSpaceTextureDecalFragmentProcessor); +#if GR_TEST_UTILS sk_sp GrDeviceSpaceTextureDecalFragmentProcessor::TestCreate( GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx @@ -531,3 +534,4 @@ sk_sp GrDeviceSpaceTextureDecalFragmentProcessor::TestCreat return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->context(), std::move(proxy), subset, pt); } +#endif diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp index af32adec8b..0ecb4bd3c0 100644 --- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp +++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp @@ -90,6 +90,7 @@ private: GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ComposeTwoFragmentProcessor); +#if GR_TEST_UTILS sk_sp ComposeTwoFragmentProcessor::TestCreate(GrProcessorTestData* d) { // Create two random frag procs. sk_sp fpA(GrProcessorUnitTest::MakeChildFP(d)); @@ -100,6 +101,7 @@ sk_sp ComposeTwoFragmentProcessor::TestCreate(GrProcessorTe return sk_sp( new ComposeTwoFragmentProcessor(std::move(fpA), std::move(fpB), mode)); } +#endif GrGLSLFragmentProcessor* ComposeTwoFragmentProcessor::onCreateGLSLInstance() const{ return new GLComposeTwoFragmentProcessor; @@ -295,6 +297,7 @@ private: GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ComposeOneFragmentProcessor); +#if GR_TEST_UTILS sk_sp ComposeOneFragmentProcessor::TestCreate(GrProcessorTestData* d) { // Create one random frag procs. // For now, we'll prevent either children from being a shader with children to prevent the @@ -307,6 +310,7 @@ sk_sp ComposeOneFragmentProcessor::TestCreate(GrProcessorTe ComposeOneFragmentProcessor::kSrc_Child; return sk_sp(new ComposeOneFragmentProcessor(std::move(dst), mode, child)); } +#endif GrGLSLFragmentProcessor* ComposeOneFragmentProcessor::onCreateGLSLInstance() const { return new GLComposeOneFragmentProcessor; diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp index f39902fd2c..767b7a01f9 100644 --- a/src/gpu/ops/GrAAConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp @@ -654,6 +654,7 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); +#if GR_TEST_UTILS sk_sp QuadEdgeEffect::TestCreate(GrProcessorTestData* d) { // Doesn't work without derivative instructions. return d->fContext->caps()->shaderCaps()->shaderDerivativeSupport() @@ -662,6 +663,7 @@ sk_sp QuadEdgeEffect::TestCreate(GrProcessorTestData* d) { d->fRandom->nextBool()) : nullptr; } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -985,7 +987,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(AAConvexPathOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp index 891eab3e00..f817f86357 100644 --- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp @@ -551,7 +551,7 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS struct PathTestStruct { typedef GrAADistanceFieldPathRenderer::ShapeCache ShapeCache; diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp index a0fc9f028f..13aaae44de 100644 --- a/src/gpu/ops/GrAAFillRectOp.cpp +++ b/src/gpu/ops/GrAAFillRectOp.cpp @@ -383,7 +383,7 @@ std::unique_ptr MakeWithLocalRect(GrColor color, /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrDrawOpTest.h" diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp index 958eb579ea..f17b21876c 100644 --- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp @@ -962,7 +962,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(AAHairlineOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp index fd09d91599..fdb5d7f7d7 100644 --- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp @@ -350,7 +350,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(AAFlatteningConvexPathOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp index b05e72216e..c30be77923 100644 --- a/src/gpu/ops/GrAAStrokeRectOp.cpp +++ b/src/gpu/ops/GrAAStrokeRectOp.cpp @@ -11,6 +11,7 @@ #include "GrOpFlushState.h" #include "GrResourceKey.h" #include "GrResourceProvider.h" +#include "SkStrokeRec.h" GR_DECLARE_STATIC_UNIQUE_KEY(gMiterIndexBufferKey); GR_DECLARE_STATIC_UNIQUE_KEY(gBevelIndexBufferKey); @@ -578,7 +579,7 @@ std::unique_ptr Make(GrColor color, /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrDrawOpTest.h" diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp index 52934ff9c7..df62e05b30 100644 --- a/src/gpu/ops/GrAnalyticRectOp.cpp +++ b/src/gpu/ops/GrAnalyticRectOp.cpp @@ -223,9 +223,11 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(RectGeometryProcessor); +#if GR_TEST_UTILS sk_sp RectGeometryProcessor::TestCreate(GrProcessorTestData* d) { return sk_sp(new RectGeometryProcessor(GrTest::TestMatrix(d->fRandom))); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -385,7 +387,7 @@ std::unique_ptr GrAnalyticRectOp::Make(GrColor color, new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds)); } -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(AnalyticRectOp) { SkMatrix viewMatrix = GrTest::TestMatrix(random); diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp index d4be853100..7d7dbf1564 100644 --- a/src/gpu/ops/GrDashOp.cpp +++ b/src/gpu/ops/GrDashOp.cpp @@ -936,12 +936,14 @@ DashingCircleEffect::DashingCircleEffect(GrColor color, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect); +#if GR_TEST_UTILS sk_sp DashingCircleEffect::TestCreate(GrProcessorTestData* d) { AAMode aaMode = static_cast(d->fRandom->nextULessThan(GrDashOp::kAAModeCnt)); return DashingCircleEffect::Make(GrRandomColor(d->fRandom), aaMode, GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool()); } +#endif ////////////////////////////////////////////////////////////////////////////// @@ -1156,12 +1158,14 @@ DashingLineEffect::DashingLineEffect(GrColor color, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect); +#if GR_TEST_UTILS sk_sp DashingLineEffect::TestCreate(GrProcessorTestData* d) { AAMode aaMode = static_cast(d->fRandom->nextULessThan(GrDashOp::kAAModeCnt)); return DashingLineEffect::Make(GrRandomColor(d->fRandom), aaMode, GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool()); } +#endif ////////////////////////////////////////////////////////////////////////////// @@ -1187,7 +1191,7 @@ static sk_sp make_dash_gp(GrColor color, ///////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(DashOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp index e76ded3d5a..5ac71d8807 100644 --- a/src/gpu/ops/GrDefaultPathRenderer.cpp +++ b/src/gpu/ops/GrDefaultPathRenderer.cpp @@ -607,7 +607,7 @@ void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(DefaultPathOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp index 4d78a7dc6d..7ef7e06317 100644 --- a/src/gpu/ops/GrDrawAtlasOp.cpp +++ b/src/gpu/ops/GrDrawAtlasOp.cpp @@ -179,7 +179,7 @@ bool GrDrawAtlasOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) { return true; } -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS static SkRSXform random_xform(SkRandom* random) { static const SkScalar kMinExtent = -100.f; diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp index 3448249096..2b63804ee7 100644 --- a/src/gpu/ops/GrDrawVerticesOp.cpp +++ b/src/gpu/ops/GrDrawVerticesOp.cpp @@ -221,7 +221,7 @@ bool GrDrawVerticesOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrDrawOpTest.h" diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp index 7ef6cad0be..5688c9bb11 100644 --- a/src/gpu/ops/GrNonAAFillRectOp.cpp +++ b/src/gpu/ops/GrNonAAFillRectOp.cpp @@ -188,7 +188,7 @@ std::unique_ptr Make(GrColor color, /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrDrawOpTest.h" diff --git a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp index cec1cfc286..cf657f0006 100644 --- a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp +++ b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp @@ -232,7 +232,7 @@ std::unique_ptr MakeWithPerspective(GrColor color, /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrDrawOpTest.h" diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp index 417d76e357..53b359e5e0 100644 --- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp +++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp @@ -12,6 +12,7 @@ #include "GrDrawOpTest.h" #include "GrMeshDrawOp.h" #include "GrOpFlushState.h" +#include "SkStrokeRec.h" #include "SkRandom.h" /* create a triangle strip that strokes the specified rect. There are 8 @@ -193,7 +194,7 @@ std::unique_ptr Make(GrColor color, } } -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(NonAAStrokeRectOp) { SkMatrix viewMatrix = GrTest::TestMatrix(random); diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp index f693169b47..2f50bb49bb 100644 --- a/src/gpu/ops/GrOvalOpFactory.cpp +++ b/src/gpu/ops/GrOvalOpFactory.cpp @@ -246,11 +246,13 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleGeometryProcessor); +#if GR_TEST_UTILS sk_sp CircleGeometryProcessor::TestCreate(GrProcessorTestData* d) { return sk_sp(new CircleGeometryProcessor( d->fRandom->nextBool(), d->fRandom->nextBool(), d->fRandom->nextBool(), d->fRandom->nextBool(), GrTest::TestMatrix(d->fRandom))); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -382,10 +384,12 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseGeometryProcessor); +#if GR_TEST_UTILS sk_sp EllipseGeometryProcessor::TestCreate(GrProcessorTestData* d) { return sk_sp( new EllipseGeometryProcessor(d->fRandom->nextBool(), GrTest::TestMatrix(d->fRandom))); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -548,10 +552,12 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseGeometryProcessor); +#if GR_TEST_UTILS sk_sp DIEllipseGeometryProcessor::TestCreate(GrProcessorTestData* d) { return sk_sp(new DIEllipseGeometryProcessor( GrTest::TestMatrix(d->fRandom), (DIEllipseStyle)(d->fRandom->nextRangeU(0, 2)))); } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -2402,7 +2408,7 @@ std::unique_ptr GrOvalOpFactory::MakeArcOp(GrColor color, const SkMatr /////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(CircleOp) { do { diff --git a/src/gpu/ops/GrPLSPathRenderer.cpp b/src/gpu/ops/GrPLSPathRenderer.cpp index 384733f206..80a4cda688 100644 --- a/src/gpu/ops/GrPLSPathRenderer.cpp +++ b/src/gpu/ops/GrPLSPathRenderer.cpp @@ -934,7 +934,7 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(PLSPathOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp index 1882aad47d..e0eadd85c7 100755 --- a/src/gpu/ops/GrShadowRRectOp.cpp +++ b/src/gpu/ops/GrShadowRRectOp.cpp @@ -923,7 +923,7 @@ std::unique_ptr Make(GrColor color, } /////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(ShadowCircleOp) { do { diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp index 509ac9fb8b..dd0d3a0fd5 100644 --- a/src/gpu/ops/GrTessellatingPathRenderer.cpp +++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp @@ -367,7 +367,7 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) { /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(TesselatingPathOp) { GrColor color = GrRandomColor(random); diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 07a653cdae..e1dc7e2dbd 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -337,7 +337,7 @@ void GrAtlasTextContext::drawPosText(GrContext* context, GrRenderTargetContext* /////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS DRAW_OP_TEST_DEFINE(TextBlobOp) { static uint32_t gContextID = SK_InvalidGenID; diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h index 11e22d3b7a..20a736876b 100644 --- a/src/gpu/text/GrAtlasTextContext.h +++ b/src/gpu/text/GrAtlasTextContext.h @@ -14,7 +14,7 @@ #include "GrTextUtils.h" #include "SkTextBlobRunIterator.h" -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS #include "GrDrawOpTest.h" #endif @@ -86,7 +86,7 @@ private: sk_sp fDistanceAdjustTable; -#ifdef GR_TEST_UTILS +#if GR_TEST_UTILS static const uint32_t kTextBlobOpScalerContextFlags = SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags; DRAW_OP_TEST_FRIEND(TextBlobOp); diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index e6d738dd59..19f190e8dc 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -93,9 +93,11 @@ private: GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor); +#if GR_TEST_UTILS sk_sp BigKeyProcessor::TestCreate(GrProcessorTestData*) { return BigKeyProcessor::Make(); } +#endif ////////////////////////////////////////////////////////////////////////////// @@ -164,6 +166,7 @@ static sk_sp random_render_target_context(GrContext* cont return renderTargetContext; } +#if GR_TEST_UTILS static void set_random_xpf(GrPaint* paint, GrProcessorTestData* d) { paint->setXPFactory(GrXPFactoryTestFactory::Get(d)); } @@ -281,7 +284,11 @@ static const GrUserStencilSettings* get_random_stencil(SkRandom* random) { return &kDoesNotWriteStencil; } } +#endif +#if !GR_TEST_UTILS +bool GrDrawingManager::ProgramUnitTest(GrContext*, int) { return true; } +#else bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { GrDrawingManager* drawingManager = context->contextPriv().drawingManager(); @@ -378,6 +385,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { return true; } +#endif static int get_glprograms_max_stages(GrContext* context) { GrGLGpu* gpu = static_cast(context->getGpu()); diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index ff31e49619..a23b40ab88 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -244,6 +244,7 @@ static GrColor texel_color(int i, int j) { static GrColor4f texel_color4f(int i, int j) { return GrColor4f::FromGrColor(texel_color(i, j)); } +#if GR_TEST_UTILS DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, reporter, ctxInfo) { // This tests code under development but not used in skia lib. Leaving this disabled until // some platform-specific issues are addressed. @@ -370,6 +371,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, reporter } } } -#endif - -#endif +#endif // GR_TEST_UTILS +#endif // SK_ALLOW_STATIC_GLOBAL_INITIALIZERS +#endif // SK_SUPPORT_GPU