diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrAAConvexPathRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrDefaultGeoProcFactory.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrOvalRenderer.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrProcessor.cpp | 20 | ||||
-rw-r--r-- | src/gpu/GrTestUtils.cpp | 29 | ||||
-rw-r--r-- | src/gpu/effects/GrBezierEffect.cpp | 10 | ||||
-rw-r--r-- | src/gpu/effects/GrBitmapTextGeoProc.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 4 | ||||
-rwxr-xr-x | src/gpu/effects/GrDistanceFieldGeoProc.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrSimpleTextureEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureDomain.cpp | 2 |
12 files changed, 49 insertions, 40 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index d6eb3d2a2b..4310f4c23e 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -673,7 +673,7 @@ GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, // Doesn't work without derivative instructions. return caps.shaderDerivativeSupport() ? QuadEdgeEffect::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random)) : NULL; + GrTest::TestMatrix(random)) : NULL; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp index fac101d8fb..ae1f4d15b0 100644 --- a/src/gpu/GrDefaultGeoProcFactory.cpp +++ b/src/gpu/GrDefaultGeoProcFactory.cpp @@ -265,8 +265,8 @@ GrGeometryProcessor* DefaultGeoProc::TestCreate(SkRandom* random, return DefaultGeoProc::Create(flags, GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), - GrProcessorUnitTest::TestMatrix(random), + GrTest::TestMatrix(random), + GrTest::TestMatrix(random), random->nextBool(), GrRandomCoverage(random)); } diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index e9cda2fd64..c89ece806e 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -227,7 +227,7 @@ GrGeometryProcessor* CircleEdgeEffect::TestCreate(SkRandom* random, GrTexture* textures[]) { return CircleEdgeEffect::Create(GrRandomColor(random), random->nextBool(), - GrProcessorUnitTest::TestMatrix(random)); + GrTest::TestMatrix(random)); } /////////////////////////////////////////////////////////////////////////////// @@ -425,7 +425,7 @@ GrGeometryProcessor* EllipseEdgeEffect::TestCreate(SkRandom* random, GrTexture* textures[]) { return EllipseEdgeEffect::Create(GrRandomColor(random), random->nextBool(), - GrProcessorUnitTest::TestMatrix(random)); + GrTest::TestMatrix(random)); } /////////////////////////////////////////////////////////////////////////////// @@ -639,7 +639,7 @@ GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(SkRandom* random, const GrDrawTargetCaps&, GrTexture* textures[]) { return DIEllipseEdgeEffect::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), + GrTest::TestMatrix(random), (Mode)(random->nextRangeU(0,2))); } diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 1457bed7ba..9be9e4063b 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -76,26 +76,6 @@ void GrProcessorTestFactory<GrXPFactory>::VerifyFactoryCount() { #endif -namespace GrProcessorUnitTest { -const SkMatrix& TestMatrix(SkRandom* random) { - static SkMatrix gMatrices[5]; - static bool gOnce; - if (!gOnce) { - gMatrices[0].reset(); - gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); - gMatrices[2].setRotate(SkIntToScalar(17)); - gMatrices[3].setRotate(SkIntToScalar(185)); - gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); - gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); - gMatrices[4].setRotate(SkIntToScalar(215)); - gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); - gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); - gOnce = true; - } - return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; -} -} - // We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on // different threads. The GrContext is not used concurrently on different threads and there is a diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp new file mode 100644 index 0000000000..c132663d20 --- /dev/null +++ b/src/gpu/GrTestUtils.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "GrTestUtils.h" +#include "SkMatrix.h" + +namespace GrTest { +const SkMatrix& TestMatrix(SkRandom* random) { + static SkMatrix gMatrices[5]; + static bool gOnce; + if (!gOnce) { + gMatrices[0].reset(); + gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100)); + gMatrices[2].setRotate(SkIntToScalar(17)); + gMatrices[3].setRotate(SkIntToScalar(185)); + gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33)); + gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf); + gMatrices[4].setRotate(SkIntToScalar(215)); + gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f); + gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f); + gOnce = true; + } + return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))]; +} +}; diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index cb440d4bb0..6eeda90cdd 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -236,9 +236,9 @@ GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, do { GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( random->nextULessThan(kGrProcessorEdgeTypeCnt)); - gp = GrConicEffect::Create(GrRandomColor(random), GrProcessorUnitTest::TestMatrix(random), + gp = GrConicEffect::Create(GrRandomColor(random), GrTest::TestMatrix(random), edgeType, caps, - GrProcessorUnitTest::TestMatrix(random)); + GrTest::TestMatrix(random)); } while (NULL == gp); return gp; } @@ -458,9 +458,9 @@ GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( random->nextULessThan(kGrProcessorEdgeTypeCnt)); gp = GrQuadEffect::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), + GrTest::TestMatrix(random), edgeType, caps, - GrProcessorUnitTest::TestMatrix(random)); + GrTest::TestMatrix(random)); } while (NULL == gp); return gp; } @@ -698,7 +698,7 @@ GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random, GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( random->nextULessThan(kGrProcessorEdgeTypeCnt)); gp = GrCubicEffect::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), edgeType, caps); + GrTest::TestMatrix(random), edgeType, caps); } while (NULL == gp); return gp; } diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 7cce1df201..9834a7687a 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -232,5 +232,5 @@ GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random, return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params, format, random->nextBool(), - GrProcessorUnitTest::TestMatrix(random)); + GrTest::TestMatrix(random)); } diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index e536c8fadf..6ee0c966aa 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -142,7 +142,7 @@ GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random, (textures[GrProcessorUnitTest::kSkiaPMTextureIdx], swapRB, pmConv, - GrProcessorUnitTest::TestMatrix(random))); + GrTest::TestMatrix(random))); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 08a3f670d9..b729d0a698 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -1002,7 +1002,7 @@ GrGeometryProcessor* DashingCircleEffect::TestCreate(SkRandom* random, GrTexture*[]) { DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAModeCount)); return DashingCircleEffect::Create(GrRandomColor(random), - aaMode, GrProcessorUnitTest::TestMatrix(random)); + aaMode, GrTest::TestMatrix(random)); } ////////////////////////////////////////////////////////////////////////////// @@ -1261,7 +1261,7 @@ GrGeometryProcessor* DashingLineEffect::TestCreate(SkRandom* random, GrTexture*[]) { DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAModeCount)); return DashingLineEffect::Create(GrRandomColor(random), - aaMode, GrProcessorUnitTest::TestMatrix(random)); + aaMode, GrTest::TestMatrix(random)); } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index c15d45b588..719ea50b55 100755 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -283,7 +283,7 @@ GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(SkRandom* random, GrTextureParams::kNone_FilterMode); return GrDistanceFieldA8TextGeoProc::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), + GrTest::TestMatrix(random), textures[texIdx], params, #ifdef SK_GAMMA_APPLY_TO_A8 random->nextF(), @@ -528,7 +528,7 @@ GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(SkRandom* random, : GrTextureParams::kNone_FilterMode); return GrDistanceFieldPathGeoProc::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), + GrTest::TestMatrix(random), textures[texIdx], params, random->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0, random->nextBool()); @@ -818,7 +818,7 @@ GrGeometryProcessor* GrDistanceFieldLCDTextGeoProc::TestCreate(SkRandom* random, flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), - GrProcessorUnitTest::TestMatrix(random), + GrTest::TestMatrix(random), textures[texIdx], params, wa, flags); diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index abbd89cafa..2fe6dfe1a4 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -80,6 +80,6 @@ GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(SkRandom* random, }; GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoordSets))]; - const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); + const SkMatrix& matrix = GrTest::TestMatrix(random); return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); } diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 45b5546c1b..3c4f348283 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -299,7 +299,7 @@ GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random, domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); GrTextureDomain::Mode mode = (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCount); - const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); + const SkMatrix& matrix = GrTest::TestMatrix(random); bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : false; GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoordSet; return GrTextureDomainEffect::Create(textures[texIdx], |