Ensure that enums used by GrCustomStage TestCreate functions are declared in SK_ALLOW_GLOBAL_STATIC_INITIALIZERS=0 builds (e.g. android)
git-svn-id: http://skia.googlecode.com/svn/trunk@4953 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
5c33b71b96
commit
8d3d210e74
@ -12,6 +12,14 @@
|
|||||||
#include "GrNoncopyable.h"
|
#include "GrNoncopyable.h"
|
||||||
#include "SkTArray.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
|
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
|
||||||
|
|
||||||
class GrCustomStage;
|
class GrCustomStage;
|
||||||
@ -20,11 +28,6 @@ class GrTexture;
|
|||||||
|
|
||||||
class GrCustomStageTestFactory : GrNoncopyable {
|
class GrCustomStageTestFactory : GrNoncopyable {
|
||||||
public:
|
public:
|
||||||
// Used to access the dummy textures in TestCreate procs.
|
|
||||||
enum {
|
|
||||||
kSkiaPMTextureIdx = 0,
|
|
||||||
kAlphaTextureIdx = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef GrCustomStage* (*CreateProc)(SkRandom*, GrContext*, GrTexture* dummyTextures[]);
|
typedef GrCustomStage* (*CreateProc)(SkRandom*, GrContext*, GrTexture* dummyTextures[]);
|
||||||
|
|
||||||
|
@ -132,5 +132,5 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrColorTableEffect);
|
|||||||
GrCustomStage* GrColorTableEffect::TestCreate(SkRandom* random,
|
GrCustomStage* GrColorTableEffect::TestCreate(SkRandom* random,
|
||||||
GrContext* context,
|
GrContext* context,
|
||||||
GrTexture* textures[]) {
|
GrTexture* textures[]) {
|
||||||
return SkNEW_ARGS(GrColorTableEffect, (textures[GrCustomStageTestFactory::kAlphaTextureIdx]));
|
return SkNEW_ARGS(GrColorTableEffect, (textures[GrCustomStageUnitTest::kAlphaTextureIdx]));
|
||||||
}
|
}
|
||||||
|
@ -187,8 +187,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrConvolutionEffect);
|
|||||||
GrCustomStage* GrConvolutionEffect::TestCreate(SkRandom* random,
|
GrCustomStage* GrConvolutionEffect::TestCreate(SkRandom* random,
|
||||||
GrContext* context,
|
GrContext* context,
|
||||||
GrTexture* textures[]) {
|
GrTexture* textures[]) {
|
||||||
int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
|
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
|
||||||
GrCustomStageTestFactory::kAlphaTextureIdx;
|
GrCustomStageUnitTest::kAlphaTextureIdx;
|
||||||
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
|
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
|
||||||
int radius = random->nextRangeU(1, kMaxKernelRadius);
|
int radius = random->nextRangeU(1, kMaxKernelRadius);
|
||||||
float kernel[kMaxKernelRadius];
|
float kernel[kMaxKernelRadius];
|
||||||
|
@ -156,8 +156,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrMorphologyEffect);
|
|||||||
GrCustomStage* GrMorphologyEffect::TestCreate(SkRandom* random,
|
GrCustomStage* GrMorphologyEffect::TestCreate(SkRandom* random,
|
||||||
GrContext* context,
|
GrContext* context,
|
||||||
GrTexture* textures[]) {
|
GrTexture* textures[]) {
|
||||||
int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
|
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
|
||||||
GrCustomStageTestFactory::kAlphaTextureIdx;
|
GrCustomStageUnitTest::kAlphaTextureIdx;
|
||||||
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
|
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
|
||||||
static const int kMaxRadius = 10;
|
static const int kMaxRadius = 10;
|
||||||
int radius = random->nextRangeU(1, kMaxRadius);
|
int radius = random->nextRangeU(1, kMaxRadius);
|
||||||
|
@ -64,7 +64,7 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrSingleTextureEffect);
|
|||||||
GrCustomStage* GrSingleTextureEffect::TestCreate(SkRandom* random,
|
GrCustomStage* GrSingleTextureEffect::TestCreate(SkRandom* random,
|
||||||
GrContext* context,
|
GrContext* context,
|
||||||
GrTexture* textures[]) {
|
GrTexture* textures[]) {
|
||||||
int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
|
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
|
||||||
GrCustomStageTestFactory::kAlphaTextureIdx;
|
GrCustomStageUnitTest::kAlphaTextureIdx;
|
||||||
return SkNEW_ARGS(GrSingleTextureEffect, (textures[texIdx]));
|
return SkNEW_ARGS(GrSingleTextureEffect, (textures[texIdx]));
|
||||||
}
|
}
|
||||||
|
@ -115,8 +115,8 @@ GR_DEFINE_CUSTOM_STAGE_TEST(GrTextureDomainEffect);
|
|||||||
GrCustomStage* GrTextureDomainEffect::TestCreate(SkRandom* random,
|
GrCustomStage* GrTextureDomainEffect::TestCreate(SkRandom* random,
|
||||||
GrContext* context,
|
GrContext* context,
|
||||||
GrTexture* textures[]) {
|
GrTexture* textures[]) {
|
||||||
int texIdx = random->nextBool() ? GrCustomStageTestFactory::kSkiaPMTextureIdx :
|
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
|
||||||
GrCustomStageTestFactory::kAlphaTextureIdx;
|
GrCustomStageUnitTest::kAlphaTextureIdx;
|
||||||
GrRect domain;
|
GrRect domain;
|
||||||
domain.fLeft = random->nextUScalar1();
|
domain.fLeft = random->nextUScalar1();
|
||||||
domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1);
|
domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1);
|
||||||
|
Loading…
Reference in New Issue
Block a user