aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrEffectUnitTest.h12
-rw-r--r--src/effects/SkBicubicImageFilter.cpp2
-rw-r--r--src/effects/SkColorMatrixFilter.cpp2
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp2
-rw-r--r--src/effects/SkLightingImageFilter.cpp8
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp2
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp2
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
-rw-r--r--src/effects/SkTableColorFilter.cpp2
-rw-r--r--src/effects/gradients/SkGradientShader.cpp2
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h2
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp2
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp2
-rw-r--r--src/effects/gradients/SkSweepGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointRadialGradient.cpp2
-rw-r--r--src/gpu/GrEffect.cpp2
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp2
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp2
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp2
-rw-r--r--src/gpu/effects/GrTextureDomainEffect.cpp2
-rw-r--r--tests/GLProgramsTest.cpp21
22 files changed, 33 insertions, 46 deletions
diff --git a/include/gpu/GrEffectUnitTest.h b/include/gpu/GrEffectUnitTest.h
index 3d251e21a7..03a302c3b2 100644
--- a/include/gpu/GrEffectUnitTest.h
+++ b/include/gpu/GrEffectUnitTest.h
@@ -24,7 +24,7 @@ enum {
/**
* A helper for use in GrEffect::TestCreate functions.
*/
-const SkMatrix& TestMatrix(SkRandom*);
+const SkMatrix& TestMatrix(SkMWCRandom*);
}
@@ -37,14 +37,14 @@ class GrTexture;
class GrEffectTestFactory : GrNoncopyable {
public:
- typedef GrEffectRef* (*CreateProc)(SkRandom*, GrContext*, GrTexture* dummyTextures[]);
+ typedef GrEffectRef* (*CreateProc)(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[]);
GrEffectTestFactory(CreateProc createProc) {
fCreateProc = createProc;
GetFactories()->push_back(this);
}
- static GrEffectRef* CreateStage(SkRandom* random,
+ static GrEffectRef* CreateStage(SkMWCRandom* random,
GrContext* context,
GrTexture* dummyTextures[]) {
uint32_t idx = random->nextRangeU(0, GetFactories()->count() - 1);
@@ -62,11 +62,11 @@ private:
*/
#define GR_DECLARE_EFFECT_TEST \
static GrEffectTestFactory gTestFactory; \
- static GrEffectRef* TestCreate(SkRandom*, GrContext*, GrTexture* dummyTextures[2])
+ static GrEffectRef* TestCreate(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[2])
/** GrEffect subclasses should insert this macro in their implementation file. They must then
* also implement this static function:
- * GrEffect* TestCreate(SkRandom*, GrContext*, GrTexture* dummyTextures[2]);
+ * GrEffect* TestCreate(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[2]);
* dummyTextures[] are valid textures that can optionally be used to construct GrTextureAccesses.
* The first texture has config kSkia8888_GrPixelConfig and the second has
* kAlpha_8_GrPixelConfig. TestCreate functions are also free to create additional textures using
@@ -80,7 +80,7 @@ private:
// The unit test relies on static initializers. Just declare the TestCreate function so that
// its definitions will compile.
#define GR_DECLARE_EFFECT_TEST \
- static GrEffectRef* TestCreate(SkRandom*, GrContext*, GrTexture* dummyTextures[2])
+ static GrEffectRef* TestCreate(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[2])
#define GR_DEFINE_EFFECT_TEST(X)
#endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/src/effects/SkBicubicImageFilter.cpp b/src/effects/SkBicubicImageFilter.cpp
index 1d8de0743d..992060c642 100644
--- a/src/effects/SkBicubicImageFilter.cpp
+++ b/src/effects/SkBicubicImageFilter.cpp
@@ -320,7 +320,7 @@ void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* valid
GR_DEFINE_EFFECT_TEST(GrBicubicEffect);
-GrEffectRef* GrBicubicEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrBicubicEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index 15824642eb..73e96167ce 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -462,7 +462,7 @@ private:
GR_DEFINE_EFFECT_TEST(ColorMatrixEffect);
-GrEffectRef* ColorMatrixEffect::TestCreate(SkRandom* random,
+GrEffectRef* ColorMatrixEffect::TestCreate(SkMWCRandom* random,
GrContext*,
GrTexture* dummyTextures[2]) {
SkColorMatrix colorMatrix;
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index f652bb2406..ee0906c67d 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -359,7 +359,7 @@ void GrDisplacementMapEffect::getConstantColorComponents(GrColor* color,
GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect);
-GrEffectRef* GrDisplacementMapEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrDisplacementMapEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdxDispl = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 498c8e0d17..e1952628ab 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -947,13 +947,13 @@ bool SkSpecularLightingImageFilter::asNewEffect(GrEffectRef** effect,
#if SK_SUPPORT_GPU
namespace {
-SkPoint3 random_point3(SkRandom* random) {
+SkPoint3 random_point3(SkMWCRandom* random) {
return SkPoint3(SkScalarToFloat(random->nextSScalar1()),
SkScalarToFloat(random->nextSScalar1()),
SkScalarToFloat(random->nextSScalar1()));
}
-SkLight* create_random_light(SkRandom* random) {
+SkLight* create_random_light(SkMWCRandom* random) {
int type = random->nextULessThan(3);
switch (type) {
case 0: {
@@ -1079,7 +1079,7 @@ bool GrDiffuseLightingEffect::onIsEqual(const GrEffect& sBase) const {
GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect);
-GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
SkScalar surfaceScale = random->nextSScalar1();
@@ -1290,7 +1290,7 @@ bool GrSpecularLightingEffect::onIsEqual(const GrEffect& sBase) const {
GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect);
-GrEffectRef* GrSpecularLightingEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrSpecularLightingEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
SkScalar surfaceScale = random->nextSScalar1();
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index e0ab4d0d4d..b577a1d8fe 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -200,7 +200,7 @@ GrGLEffect::EffectKey GrGLMagnifierEffect::GenKey(const GrEffectStage& stage, co
GR_DEFINE_EFFECT_TEST(GrMagnifierEffect);
-GrEffectRef* GrMagnifierEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrMagnifierEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture** textures) {
const int kMaxWidth = 200;
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 97af7ad737..0addc237a5 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -535,7 +535,7 @@ GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect);
// Allows for a 5x5 kernel (or 25x1, for that matter).
#define MAX_KERNEL_SIZE 25
-GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 801003430d..b40130bfe0 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -419,7 +419,7 @@ void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va
GR_DEFINE_EFFECT_TEST(GrMorphologyEffect);
-GrEffectRef* GrMorphologyEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 5c00794892..cf7ddc5295 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -369,7 +369,7 @@ void ColorTableEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
GR_DEFINE_EFFECT_TEST(ColorTableEffect);
-GrEffectRef* ColorTableEffect::TestCreate(SkRandom* random,
+GrEffectRef* ColorTableEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
static unsigned kAllFlags = SkTable_ColorFilter::kR_Flag | SkTable_ColorFilter::kG_Flag |
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 6c953741cd..261ad8ff13 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -870,7 +870,7 @@ void GrGradientEffect::getConstantColorComponents(GrColor* color, uint32_t* vali
}
}
-int GrGradientEffect::RandomGradientParams(SkRandom* random,
+int GrGradientEffect::RandomGradientParams(SkMWCRandom* random,
SkColor colors[],
SkScalar** stops,
SkShader::TileMode* tm) {
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 7bcda14738..271a2b6e51 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -246,7 +246,7 @@ protected:
passed to the gradient factory rather than the array.
*/
static const int kMaxRandomGradientColors = 4;
- static int RandomGradientParams(SkRandom* r,
+ static int RandomGradientParams(SkMWCRandom* r,
SkColor colors[kMaxRandomGradientColors],
SkScalar** stops,
SkShader::TileMode* tm);
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index f6bae725dc..adc60f8024 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -516,7 +516,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrLinearGradient);
-GrEffectRef* GrLinearGradient::TestCreate(SkRandom* random,
+GrEffectRef* GrLinearGradient::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture**) {
SkPoint points[] = {{random->nextUScalar1(), random->nextUScalar1()},
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 07f1c19715..ff3a2aa75c 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -533,7 +533,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrRadialGradient);
-GrEffectRef* GrRadialGradient::TestCreate(SkRandom* random,
+GrEffectRef* GrRadialGradient::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture**) {
SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 458ddbc590..b5d94aadc2 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -453,7 +453,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrSweepGradient);
-GrEffectRef* GrSweepGradient::TestCreate(SkRandom* random,
+GrEffectRef* GrSweepGradient::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture**) {
SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index f1acd551cc..5c11d4cffa 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -451,7 +451,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrConical2Gradient);
-GrEffectRef* GrConical2Gradient::TestCreate(SkRandom* random,
+GrEffectRef* GrConical2Gradient::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 4eaf487230..6bb475a3fe 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -487,7 +487,7 @@ private:
GR_DEFINE_EFFECT_TEST(GrRadial2Gradient);
-GrEffectRef* GrRadial2Gradient::TestCreate(SkRandom* random,
+GrEffectRef* GrRadial2Gradient::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture**) {
SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
diff --git a/src/gpu/GrEffect.cpp b/src/gpu/GrEffect.cpp
index 40a519aa83..6e743e7f95 100644
--- a/src/gpu/GrEffect.cpp
+++ b/src/gpu/GrEffect.cpp
@@ -21,7 +21,7 @@ SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() {
#endif
namespace GrEffectUnitTest {
-const SkMatrix& TestMatrix(SkRandom* random) {
+const SkMatrix& TestMatrix(SkMWCRandom* random) {
static SkMatrix gMatrices[5];
static bool gOnce;
if (!gOnce) {
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 92df82d940..1dd51c888b 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -131,7 +131,7 @@ void GrConfigConversionEffect::getConstantColorComponents(GrColor* color,
GR_DEFINE_EFFECT_TEST(GrConfigConversionEffect);
-GrEffectRef* GrConfigConversionEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrConfigConversionEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMConversionCnt));
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 896885794d..12c32f05c5 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -178,7 +178,7 @@ bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
GR_DEFINE_EFFECT_TEST(GrConvolutionEffect);
-GrEffectRef* GrConvolutionEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index b6748794de..0fe083bd5d 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -67,7 +67,7 @@ const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const {
GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect);
-GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrSimpleTextureEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp
index 833c19803b..39c992eb8c 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -186,7 +186,7 @@ void GrTextureDomainEffect::getConstantColorComponents(GrColor* color, uint32_t*
GR_DEFINE_EFFECT_TEST(GrTextureDomainEffect);
-GrEffectRef* GrTextureDomainEffect::TestCreate(SkRandom* random,
+GrEffectRef* GrTextureDomainEffect::TestCreate(SkMWCRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index ad3d2c650b..d4873cada0 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -20,20 +20,6 @@
#include "SkRandom.h"
#include "Test.h"
-namespace {
-
-const GrEffectRef* create_random_effect(SkMWCRandom* random,
- GrContext* context,
- GrTexture* dummyTextures[]) {
- // TODO: Make GrTestFactory use SkMWCRandom and simply pass along param random
- SkRandom sk_random;
- sk_random.setSeed(random->nextU());
- GrEffectRef* effect = GrEffectTestFactory::CreateStage(&sk_random, context, dummyTextures);
- GrAssert(effect);
- return effect;
-}
-}
-
void GrGLProgram::Desc::setRandom(SkMWCRandom* random,
const GrGpuGL* gpu,
const GrEffectStage stages[GrDrawState::kNumStages]) {
@@ -118,9 +104,10 @@ bool GrGpuGL::programUnitTest(int maxStages) {
// enable the stage?
if (random.nextBool()) {
GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};
- SkAutoTUnref<const GrEffectRef> effect(create_random_effect(&random,
- getContext(),
- dummyTextures));
+ SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateStage(
+ &random,
+ this->getContext(),
+ dummyTextures));
stages[s].setEffect(effect.get());
}
}