make GR_TEST_UTILS=0 work
Change-Id: Icce35140ca08b65217b32e6b1ffc6ad2f38ab37f Reviewed-on: https://skia-review.googlesource.com/7840 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
351b045a5e
commit
6f6961ebad
@ -709,6 +709,7 @@ private:
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoise2Effect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrPerlinNoise2Effect::TestCreate(GrProcessorTestData* d) {
|
||||
int numOctaves = d->fRandom->nextRangeU(2, 10);
|
||||
bool stitchTiles = d->fRandom->nextBool();
|
||||
@ -729,6 +730,7 @@ sk_sp<GrFragmentProcessor> GrPerlinNoise2Effect::TestCreate(GrProcessorTestData*
|
||||
GrTest::TestAsFPArgs asFPArgs(d);
|
||||
return shader->asFragmentProcessor(asFPArgs.args());
|
||||
}
|
||||
#endif
|
||||
|
||||
void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
const GrPerlinNoise2Effect& pne = args.fFp.cast<GrPerlinNoise2Effect>();
|
||||
@ -1118,6 +1120,7 @@ private:
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrImprovedPerlinNoiseEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkScalar baseFrequencyX = d->fRandom->nextRangeScalar(0.01f,
|
||||
0.99f);
|
||||
@ -1134,6 +1137,7 @@ sk_sp<GrFragmentProcessor> GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTe
|
||||
GrTest::TestAsFPArgs asFPArgs(d);
|
||||
return shader->asFragmentProcessor(asFPArgs.args());
|
||||
}
|
||||
#endif
|
||||
|
||||
void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
|
||||
GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder;
|
||||
|
@ -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
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "SkTypes.h"
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "GrColor.h"
|
||||
#include "GrColorSpaceXform.h"
|
||||
|
@ -418,6 +418,7 @@ private:
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorMatrixEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> ColorMatrixEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkScalar colorMatrix[20];
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix); ++i) {
|
||||
@ -425,6 +426,7 @@ sk_sp<GrFragmentProcessor> ColorMatrixEffect::TestCreate(GrProcessorTestData* d)
|
||||
}
|
||||
return ColorMatrixEffect::Make(colorMatrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<GrFragmentProcessor> SkColorMatrixFilterRowMajor255::asFragmentProcessor(
|
||||
GrContext*, SkColorSpace*) const {
|
||||
|
@ -211,6 +211,7 @@ SkShader::GradientType SkColor4Shader::asAGradient(GradientInfo* info) const {
|
||||
|
||||
#include "SkGr.h"
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
#include "GrColorSpaceXform.h"
|
||||
sk_sp<GrFragmentProcessor> SkColor4Shader::asFragmentProcessor(const AsFPArgs& args) const {
|
||||
sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(fColorSpace.get(),
|
||||
args.fDstColorSpace);
|
||||
|
@ -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"
|
||||
|
@ -170,6 +170,7 @@ void GrGLAlphaThresholdFragmentProcessor::onSetData(const GrGLSLProgramDataManag
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrAlphaThresholdFragmentProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
GrTexture* bmpTex = d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx];
|
||||
GrTexture* maskTex = d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx];
|
||||
@ -187,6 +188,7 @@ sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::TestCreate(GrProce
|
||||
innerThresh, outerThresh,
|
||||
bounds);
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -347,11 +347,13 @@ sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrTextureProvider
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> 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
|
||||
|
@ -313,6 +313,7 @@ private:
|
||||
};
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> ArithmeticFP::TestCreate(GrProcessorTestData* d) {
|
||||
float k1 = d->fRandom->nextF();
|
||||
float k2 = d->fRandom->nextF();
|
||||
@ -323,6 +324,7 @@ sk_sp<GrFragmentProcessor> ArithmeticFP::TestCreate(GrProcessorTestData* d) {
|
||||
sk_sp<GrFragmentProcessor> dst(GrProcessorUnitTest::MakeChildFP(d));
|
||||
return ArithmeticFP::Make(k1, k2, k3, k4, enforcePMColor, std::move(dst));
|
||||
}
|
||||
#endif
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ArithmeticFP);
|
||||
|
||||
|
@ -1005,6 +1005,7 @@ void GrRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRectBlurEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrRectBlurEffect::TestCreate(GrProcessorTestData* d) {
|
||||
float sigma = d->fRandom->nextRangeF(3,8);
|
||||
float width = d->fRandom->nextRangeF(200,300);
|
||||
@ -1012,6 +1013,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> 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<GrFragmentProcessor> GrRRectBlurEffect::TestCreate(GrProcessorTestData* d)
|
||||
rrect.setRectXY(SkRect::MakeWH(w, h), r, r);
|
||||
return GrRRectBlurEffect::Make(d->fContext, sigma, sigma, rrect, rrect);
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -537,6 +537,7 @@ void GrDisplacementMapEffect::onComputeInvariantOutput(GrInvariantOutput* inout)
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrDisplacementMapEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdxDispl = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -560,6 +561,7 @@ sk_sp<GrFragmentProcessor> GrDisplacementMapEffect::TestCreate(GrProcessorTestDa
|
||||
d->fTextures[texIdxColor], colorSpaceXform,
|
||||
colorDimensions);
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1752,6 +1752,7 @@ GrGLSLFragmentProcessor* GrDiffuseLightingEffect::onCreateGLSLInstance() const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDiffuseLightingEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrDiffuseLightingEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -1771,6 +1772,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> GrSpecularLightingEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -1991,6 +1994,7 @@ sk_sp<GrFragmentProcessor> GrSpecularLightingEffect::TestCreate(GrProcessorTestD
|
||||
light.get(), surfaceScale, matrix, ks, shininess, mode,
|
||||
&srcBounds);
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -210,6 +210,7 @@ GrGLSLFragmentProcessor* GrMagnifierEffect::onCreateGLSLInstance() const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMagnifierEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrMagnifierEffect::TestCreate(GrProcessorTestData* d) {
|
||||
GrTexture* texture = d->fTextures[0];
|
||||
const int kMaxWidth = 200;
|
||||
@ -235,6 +236,7 @@ sk_sp<GrFragmentProcessor> GrMagnifierEffect::TestCreate(GrProcessorTestData* d)
|
||||
SkASSERT(effect);
|
||||
return effect;
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContext.h"
|
||||
#include "GrTextureProxy.h"
|
||||
#include "effects/GrMatrixConvolutionEffect.h"
|
||||
#endif
|
||||
|
||||
|
@ -373,6 +373,7 @@ void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -384,6 +385,7 @@ sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d
|
||||
|
||||
return GrMorphologyEffect::Make(d->fTextures[texIdx], dir, radius, type);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void apply_morphology_rect(GrTextureProvider* provider,
|
||||
|
@ -573,6 +573,7 @@ private:
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoiseEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrPerlinNoiseEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int numOctaves = d->fRandom->nextRangeU(2, 10);
|
||||
bool stitchTiles = d->fRandom->nextBool();
|
||||
@ -593,6 +594,7 @@ sk_sp<GrFragmentProcessor> GrPerlinNoiseEffect::TestCreate(GrProcessorTestData*
|
||||
GrTest::TestAsFPArgs asFPArgs(d);
|
||||
return shader->asFragmentProcessor(asFPArgs.args());
|
||||
}
|
||||
#endif
|
||||
|
||||
void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
const GrPerlinNoiseEffect& pne = args.fFp.cast<GrPerlinNoiseEffect>();
|
||||
|
@ -569,6 +569,7 @@ void ColorTableEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> ColorTableEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int flags = 0;
|
||||
uint8_t luts[256][4];
|
||||
@ -595,6 +596,7 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::TestCreate(GrProcessorTestData* d)
|
||||
SkASSERT(fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<GrFragmentProcessor> SkTable_ColorFilter::asFragmentProcessor(GrContext* context,
|
||||
SkColorSpace*) const {
|
||||
|
@ -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<SkShader::TileMode>(random->nextULessThan(SkShader::kTileModeCount));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -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;
|
||||
|
||||
|
@ -477,6 +477,7 @@ void GrLinearGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrLinearGradient);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint points[] = {{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()},
|
||||
{d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}};
|
||||
@ -492,6 +493,7 @@ sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d)
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -303,6 +303,7 @@ void GrRadialGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRadialGradient);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrRadialGradient::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
|
||||
SkScalar radius = d->fRandom->nextUScalar1();
|
||||
@ -318,6 +319,7 @@ sk_sp<GrFragmentProcessor> GrRadialGradient::TestCreate(GrProcessorTestData* d)
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -186,6 +186,7 @@ void GrSweepGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps,
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSweepGradient);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrSweepGradient::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
|
||||
|
||||
@ -200,6 +201,7 @@ sk_sp<GrFragmentProcessor> GrSweepGradient::TestCreate(GrProcessorTestData* d) {
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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<GrFragmentProcessor> Edge2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
|
||||
SkScalar radius1 = d->fRandom->nextUScalar1();
|
||||
@ -212,6 +213,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> FocalOutside2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
|
||||
SkScalar radius1 = 0.f;
|
||||
@ -492,6 +495,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> FocalInside2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
|
||||
SkScalar radius1 = 0.f;
|
||||
@ -695,6 +700,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> 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<GrFragmentProcessor> 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<GrFragmentProcessor> 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<GrFragmentProcessor> CircleOutside2PtConicalEffect::TestCreate(GrProcessor
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor
|
||||
::GLSLCircleOutside2PtConicalProcessor(const GrProcessor& processor)
|
||||
|
@ -237,6 +237,7 @@ private:
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
uint32_t flags = 0;
|
||||
if (d->fRandom->nextBool()) {
|
||||
@ -260,6 +261,7 @@ sk_sp<GrGeometryProcessor> DefaultGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
d->fRandom->nextBool(),
|
||||
GrRandomCoverage(d->fRandom));
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<GrGeometryProcessor> GrDefaultGeoProcFactory::Make(const Color& color,
|
||||
const Coverage& coverage,
|
||||
|
@ -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<GrDrawOp> Op##__Test(SkRandom*, GrContext* context);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "GrTestUtils.h"
|
||||
#include "SkRefCnt.h"
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
class GrDrawOp;
|
||||
class GrContext;
|
||||
|
@ -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
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "GrProcessorUnitTest.h"
|
||||
#include "GrFragmentProcessor.h"
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
sk_sp<GrFragmentProcessor> GrProcessorUnitTest::MakeChildFP(GrProcessorTestData* data) {
|
||||
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
|
||||
sk_sp<GrFragmentProcessor> fp;
|
||||
@ -21,3 +23,4 @@ sk_sp<GrFragmentProcessor> GrProcessorUnitTest::MakeChildFP(GrProcessorTestData*
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -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,
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "GrGpuResourcePriv.h"
|
||||
#include "GrRenderTargetContext.h"
|
||||
#include "GrTexturePriv.h"
|
||||
#include "GrTextureProxy.h"
|
||||
#include "GrTypes.h"
|
||||
#include "GrXferProcessor.h"
|
||||
|
||||
|
@ -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<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
sk_sp<GrGeometryProcessor> gp;
|
||||
do {
|
||||
@ -270,6 +271,7 @@ sk_sp<GrGeometryProcessor> 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<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) {
|
||||
sk_sp<GrGeometryProcessor> gp;
|
||||
do {
|
||||
@ -470,6 +473,7 @@ sk_sp<GrGeometryProcessor> 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<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
sk_sp<GrGeometryProcessor> gp;
|
||||
do {
|
||||
@ -690,3 +695,4 @@ sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
} while (nullptr == gp);
|
||||
return gp;
|
||||
}
|
||||
#endif
|
||||
|
@ -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<GrFragmentProcessor> GrBicubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
: GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -211,6 +213,7 @@ sk_sp<GrFragmentProcessor> GrBicubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
return GrBicubicEffect::Make(d->context(), d->textureProxy(texIdx), std::move(colorSpaceXform),
|
||||
SkMatrix::I(), kClampClamp);
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -154,6 +154,7 @@ GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrShader
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
: GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -186,3 +187,4 @@ sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData*
|
||||
format, GrTest::TestMatrix(d->fRandom),
|
||||
d->fRandom->nextBool());
|
||||
}
|
||||
#endif
|
||||
|
@ -149,6 +149,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect);
|
||||
#pragma optimize("t", off)
|
||||
#endif
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(GrProcessorTestData* d) {
|
||||
PMConversion pmConv = static_cast<PMConversion>(d->fRandom->nextULessThan(kPMConversionCnt));
|
||||
GrSwizzle swizzle;
|
||||
@ -160,6 +161,7 @@ sk_sp<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(GrProcessorTestD
|
||||
d->textureProxy(GrProcessorUnitTest::kSkiaPMTextureIdx),
|
||||
swizzle, pmConv, GrTest::TestMatrix(d->fRandom)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__clang__) && _MSC_FULL_VER >= 190024213
|
||||
// Restore optimization settings.
|
||||
|
@ -116,6 +116,7 @@ bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrConstColorProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
GrColor4f color;
|
||||
int colorPicker = d->fRandom->nextULessThan(3);
|
||||
@ -139,3 +140,4 @@ sk_sp<GrFragmentProcessor> GrConstColorProcessor::TestCreate(GrProcessorTestData
|
||||
InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputModeCnt));
|
||||
return GrConstColorProcessor::Make(color, mode);
|
||||
}
|
||||
#endif
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> AARectEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(),
|
||||
d->fRandom->nextSScalar1(),
|
||||
@ -77,6 +78,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int count = d->fRandom->nextULessThan(kMaxEdges) + 1;
|
||||
SkScalar edges[kMaxEdges * 3];
|
||||
@ -377,3 +380,4 @@ sk_sp<GrFragmentProcessor> GrConvexPolyEffect::TestCreate(GrProcessorTestData* d
|
||||
} while (nullptr == fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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
|
||||
|
@ -265,6 +265,7 @@ GrDistanceFieldA8TextGeoProc::createGLSLInstance(const GrShaderCaps&) const {
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -295,6 +296,7 @@ sk_sp<GrGeometryProcessor> 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<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
: GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -531,6 +534,7 @@ sk_sp<GrGeometryProcessor> 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<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -829,3 +834,4 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor
|
||||
flags,
|
||||
d->fRandom->nextBool());
|
||||
}
|
||||
#endif
|
||||
|
@ -50,9 +50,11 @@ void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> DitherEffect::TestCreate(GrProcessorTestData*) {
|
||||
return DitherEffect::Make();
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::TestCreate(
|
||||
GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
@ -255,3 +257,4 @@ sk_sp<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::TestCreate(
|
||||
return GrGaussianConvolutionFragmentProcessor::Make(
|
||||
d->context(), d->textureProxy(texIdx), dir, radius, sigma, useBounds, bounds);
|
||||
}
|
||||
#endif
|
||||
|
@ -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<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian(GrContext* co
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
|
||||
GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -322,3 +324,4 @@ sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTest
|
||||
tileMode,
|
||||
convolveAlpha);
|
||||
}
|
||||
#endif
|
||||
|
@ -77,6 +77,7 @@ bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> CircleEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center;
|
||||
center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f);
|
||||
@ -88,6 +89,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> EllipseEffect::TestCreate(GrProcessorTestData* d) {
|
||||
SkPoint center;
|
||||
center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f);
|
||||
@ -258,6 +261,7 @@ sk_sp<GrFragmentProcessor> EllipseEffect::TestCreate(GrProcessorTestData* d) {
|
||||
} while (kHairlineAA_GrProcessorEdgeType == et);
|
||||
return EllipseEffect::Make(et, center, rx, ry);
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -112,6 +112,7 @@ bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> 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<GrFragmentProcessor> 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<GrFragmentProcessor> EllipticalRRectEffect::TestCreate(GrProcessorTestData
|
||||
} while (nullptr == fp);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -110,10 +110,12 @@ GrColor4f GrSRGBEffect::constantOutputForConstantInput(GrColor4f input) const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSRGBEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrSRGBEffect::TestCreate(GrProcessorTestData* d) {
|
||||
Mode testMode = static_cast<Mode>(d->fRandom->nextRangeU(0, 1));
|
||||
return sk_sp<GrFragmentProcessor>(new GrSRGBEffect(testMode));
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -99,6 +99,8 @@ GrGLSLPrimitiveProcessor* GrRRectShadowGeoProc::createGLSLInstance(const GrShade
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrRRectShadowGeoProc);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> GrRRectShadowGeoProc::TestCreate(GrProcessorTestData* d) {
|
||||
return GrRRectShadowGeoProc::Make(GrTest::TestMatrix(d->fRandom));
|
||||
}
|
||||
#endif
|
||||
|
@ -96,6 +96,7 @@ GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLSLInstance() const {
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
: GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -116,3 +117,4 @@ sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData
|
||||
return GrSimpleTextureEffect::Make(d->context(), d->textureProxy(texIdx),
|
||||
std::move(colorSpaceXform), matrix);
|
||||
}
|
||||
#endif
|
||||
|
@ -375,6 +375,7 @@ void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
: GrProcessorUnitTest::kAlphaTextureIdx;
|
||||
@ -398,6 +399,7 @@ sk_sp<GrFragmentProcessor> 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<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::TestCreate(
|
||||
GrProcessorTestData* d) {
|
||||
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
|
||||
@ -531,3 +534,4 @@ sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::TestCreat
|
||||
return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->context(),
|
||||
std::move(proxy), subset, pt);
|
||||
}
|
||||
#endif
|
||||
|
@ -90,6 +90,7 @@ private:
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ComposeTwoFragmentProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> ComposeTwoFragmentProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
// Create two random frag procs.
|
||||
sk_sp<GrFragmentProcessor> fpA(GrProcessorUnitTest::MakeChildFP(d));
|
||||
@ -100,6 +101,7 @@ sk_sp<GrFragmentProcessor> ComposeTwoFragmentProcessor::TestCreate(GrProcessorTe
|
||||
return sk_sp<GrFragmentProcessor>(
|
||||
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<GrFragmentProcessor> 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<GrFragmentProcessor> ComposeOneFragmentProcessor::TestCreate(GrProcessorTe
|
||||
ComposeOneFragmentProcessor::kSrc_Child;
|
||||
return sk_sp<GrFragmentProcessor>(new ComposeOneFragmentProcessor(std::move(dst), mode, child));
|
||||
}
|
||||
#endif
|
||||
|
||||
GrGLSLFragmentProcessor* ComposeOneFragmentProcessor::onCreateGLSLInstance() const {
|
||||
return new GLComposeOneFragmentProcessor;
|
||||
|
@ -654,6 +654,7 @@ private:
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
|
||||
// Doesn't work without derivative instructions.
|
||||
return d->fContext->caps()->shaderCaps()->shaderDerivativeSupport()
|
||||
@ -662,6 +663,7 @@ sk_sp<GrGeometryProcessor> 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);
|
||||
|
@ -551,7 +551,7 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
struct PathTestStruct {
|
||||
typedef GrAADistanceFieldPathRenderer::ShapeCache ShapeCache;
|
||||
|
@ -383,7 +383,7 @@ std::unique_ptr<GrDrawOp> MakeWithLocalRect(GrColor color,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "GrDrawOpTest.h"
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<GrDrawOp> Make(GrColor color,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "GrDrawOpTest.h"
|
||||
|
||||
|
@ -223,9 +223,11 @@ private:
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(RectGeometryProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> RectGeometryProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
return sk_sp<GrGeometryProcessor>(new RectGeometryProcessor(GrTest::TestMatrix(d->fRandom)));
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -385,7 +387,7 @@ std::unique_ptr<GrDrawOp> 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);
|
||||
|
@ -936,12 +936,14 @@ DashingCircleEffect::DashingCircleEffect(GrColor color,
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> DashingCircleEffect::TestCreate(GrProcessorTestData* d) {
|
||||
AAMode aaMode = static_cast<AAMode>(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<GrGeometryProcessor> DashingLineEffect::TestCreate(GrProcessorTestData* d) {
|
||||
AAMode aaMode = static_cast<AAMode>(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<GrGeometryProcessor> make_dash_gp(GrColor color,
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
DRAW_OP_TEST_DEFINE(DashOp) {
|
||||
GrColor color = GrRandomColor(random);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -221,7 +221,7 @@ bool GrDrawVerticesOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "GrDrawOpTest.h"
|
||||
|
||||
|
@ -188,7 +188,7 @@ std::unique_ptr<GrDrawOp> Make(GrColor color,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "GrDrawOpTest.h"
|
||||
|
||||
|
@ -232,7 +232,7 @@ std::unique_ptr<GrDrawOp> MakeWithPerspective(GrColor color,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "GrDrawOpTest.h"
|
||||
|
||||
|
@ -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<GrDrawOp> Make(GrColor color,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
DRAW_OP_TEST_DEFINE(NonAAStrokeRectOp) {
|
||||
SkMatrix viewMatrix = GrTest::TestMatrix(random);
|
||||
|
@ -246,11 +246,13 @@ private:
|
||||
|
||||
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleGeometryProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrGeometryProcessor> CircleGeometryProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
return sk_sp<GrGeometryProcessor>(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<GrGeometryProcessor> EllipseGeometryProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
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<GrGeometryProcessor> DIEllipseGeometryProcessor::TestCreate(GrProcessorTestData* d) {
|
||||
return sk_sp<GrGeometryProcessor>(new DIEllipseGeometryProcessor(
|
||||
GrTest::TestMatrix(d->fRandom), (DIEllipseStyle)(d->fRandom->nextRangeU(0, 2))));
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -2402,7 +2408,7 @@ std::unique_ptr<GrDrawOp> GrOvalOpFactory::MakeArcOp(GrColor color, const SkMatr
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
DRAW_OP_TEST_DEFINE(CircleOp) {
|
||||
do {
|
||||
|
@ -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);
|
||||
|
@ -923,7 +923,7 @@ std::unique_ptr<GrDrawOp> Make(GrColor color,
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
DRAW_OP_TEST_DEFINE(ShadowCircleOp) {
|
||||
do {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
|
||||
|
||||
#ifdef GR_TEST_UTILS
|
||||
#if GR_TEST_UTILS
|
||||
static const uint32_t kTextBlobOpScalerContextFlags =
|
||||
SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags;
|
||||
DRAW_OP_TEST_FRIEND(TextBlobOp);
|
||||
|
@ -93,9 +93,11 @@ private:
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
sk_sp<GrFragmentProcessor> BigKeyProcessor::TestCreate(GrProcessorTestData*) {
|
||||
return BigKeyProcessor::Make();
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -164,6 +166,7 @@ static sk_sp<GrRenderTargetContext> 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<GrGLGpu*>(context->getGpu());
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user