#include "GrNoncopyable.h"
#include "SkTArray.h"
+namespace GrCustomStageUnitTest {
+// Used to access the dummy textures in TestCreate procs.
+enum {
+ kSkiaPMTextureIdx = 0,
+ kAlphaTextureIdx = 1,
+};
+}
+
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
class GrCustomStage;
class GrCustomStageTestFactory : GrNoncopyable {
public:
- // Used to access the dummy textures in TestCreate procs.
- enum {
- kSkiaPMTextureIdx = 0,
- kAlphaTextureIdx = 1,
- };
typedef GrCustomStage* (*CreateProc)(SkRandom*, GrContext*, GrTexture* dummyTextures[]);
GrCustomStage* GrColorTableEffect::TestCreate(SkRandom* random,
GrContext* context,
GrTexture* textures[]) {
- return SkNEW_ARGS(GrColorTableEffect, (textures[GrCustomStageTestFactory::kAlphaTextureIdx]));
+ return SkNEW_ARGS(GrColorTableEffect, (textures[GrCustomStageUnitTest::kAlphaTextureIdx]));
}
GrCustomStage* GrConvolutionEffect::TestCreate(SkRandom* random,
GrContext* context,
GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
- GrCustomStageTestFactory::kAlphaTextureIdx;
+ int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
+ GrCustomStageUnitTest::kAlphaTextureIdx;
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
int radius = random->nextRangeU(1, kMaxKernelRadius);
float kernel[kMaxKernelRadius];
GrCustomStage* GrMorphologyEffect::TestCreate(SkRandom* random,
GrContext* context,
GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
- GrCustomStageTestFactory::kAlphaTextureIdx;
+ int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
+ GrCustomStageUnitTest::kAlphaTextureIdx;
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
static const int kMaxRadius = 10;
int radius = random->nextRangeU(1, kMaxRadius);
GrCustomStage* GrSingleTextureEffect::TestCreate(SkRandom* random,
GrContext* context,
GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
- GrCustomStageTestFactory::kAlphaTextureIdx;
+ int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
+ GrCustomStageUnitTest::kAlphaTextureIdx;
return SkNEW_ARGS(GrSingleTextureEffect, (textures[texIdx]));
}
GrCustomStage* GrTextureDomainEffect::TestCreate(SkRandom* random,
GrContext* context,
GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
- GrCustomStageTestFactory::kAlphaTextureIdx;
+ int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
+ GrCustomStageUnitTest::kAlphaTextureIdx;
GrRect domain;
domain.fLeft = random->nextUScalar1();
domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1);