aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-11-01 17:12:34 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-11-01 17:12:34 +0000
commit81712883419f76e25d2ffec38a9438284a45a48d (patch)
treed9b6eb86b01ae7e7117f56dc2d6ca4f95879b56f /src/effects/gradients
parent35ac048e357aefa6289485c8f6a50fadce23c0d2 (diff)
Remove GrScalar, replace with SkScalar.
Review URL: https://codereview.appspot.com/6812064 git-svn-id: http://skia.googlecode.com/svn/trunk@6243 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/gradients')
-rw-r--r--src/effects/gradients/SkGradientShader.cpp10
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h6
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp44
-rw-r--r--src/effects/gradients/SkTwoPointRadialGradient.cpp34
4 files changed, 47 insertions, 47 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 78c7e34a74..79a28925f3 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -677,7 +677,7 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
GrGLGradientEffect::GrGLGradientEffect(const GrBackendEffectFactory& factory)
: INHERITED(factory)
- , fCachedYCoord(GR_ScalarMax)
+ , fCachedYCoord(SK_ScalarMax)
, fFSYUni(GrGLUniformManager::kInvalidUniformHandle) {
fRequiresTextureMatrix = false;
}
@@ -694,7 +694,7 @@ void GrGLGradientEffect::setData(const GrGLUniformManager& uman, const GrEffectS
const GrTexture* texture = e.texture(0);
fEffectMatrix.setData(uman, e.getMatrix(), stage.getCoordChangeMatrix(), texture);
- GrScalar yCoord = e.getYCoord();
+ SkScalar yCoord = e.getYCoord();
if (yCoord != fCachedYCoord) {
uman.set1f(fFSYUni, yCoord);
fCachedYCoord = yCoord;
@@ -769,13 +769,13 @@ GrGradientEffect::GrGradientEffect(GrContext* ctx,
fRow = fAtlas->lockRow(bitmap);
if (-1 != fRow) {
- fYCoord = fAtlas->getYOffset(fRow) + GR_ScalarHalf *
+ fYCoord = fAtlas->getYOffset(fRow) + SK_ScalarHalf *
fAtlas->getVerticalScaleFactor();
fTextureAccess.reset(fAtlas->getTexture(), params);
} else {
GrTexture* texture = GrLockCachedBitmapTexture(ctx, bitmap, &params);
fTextureAccess.reset(texture, params);
- fYCoord = GR_ScalarHalf;
+ fYCoord = SK_ScalarHalf;
// Unlock immediately, this is not great, but we don't have a way of
// knowing when else to unlock it currently, so it may get purged from
@@ -806,7 +806,7 @@ int GrGradientEffect::RandomGradientParams(SkRandom* random,
*stops = NULL;
}
- GrScalar stop = 0.f;
+ SkScalar stop = 0.f;
for (int i = 0; i < outColors; ++i) {
colors[i] = random->nextU();
if (NULL != *stops) {
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 24379110ee..792cf6640f 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -237,7 +237,7 @@ public:
virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE;
bool useAtlas() const { return SkToBool(-1 != fRow); }
- GrScalar getYCoord() const { return fYCoord; };
+ SkScalar getYCoord() const { return fYCoord; };
const SkMatrix& getMatrix() const { return fMatrix;}
virtual bool isEqual(const GrEffect& effect) const SK_OVERRIDE {
@@ -263,7 +263,7 @@ protected:
private:
GrTextureAccess fTextureAccess;
- GrScalar fYCoord;
+ SkScalar fYCoord;
GrTextureStripAtlas* fAtlas;
int fRow;
SkMatrix fMatrix;
@@ -327,7 +327,7 @@ protected:
const GrGLShaderBuilder::TextureSampler&);
private:
- GrScalar fCachedYCoord;
+ SkScalar fCachedYCoord;
GrGLUniformManager::UniformHandle fFSYUni;
GrGLEffectMatrix fEffectMatrix;
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 41292bb43a..4538eb29a7 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -352,9 +352,9 @@ protected:
// @{
/// Values last uploaded as uniforms
- GrScalar fCachedCenter;
- GrScalar fCachedRadius;
- GrScalar fCachedDiffRadius;
+ SkScalar fCachedCenter;
+ SkScalar fCachedRadius;
+ SkScalar fCachedDiffRadius;
// @}
@@ -394,9 +394,9 @@ public:
// The radial gradient parameters can collapse to a linear (instead of quadratic) equation.
bool isDegenerate() const { return SkScalarAbs(fDiffRadius) == SkScalarAbs(fCenterX1); }
- GrScalar center() const { return fCenterX1; }
- GrScalar diffRadius() const { return fDiffRadius; }
- GrScalar radius() const { return fRadius0; }
+ SkScalar center() const { return fCenterX1; }
+ SkScalar diffRadius() const { return fDiffRadius; }
+ SkScalar radius() const { return fRadius0; }
typedef GrGLConical2Gradient GLEffect;
@@ -407,9 +407,9 @@ private:
// Cache of values - these can change arbitrarily, EXCEPT
// we shouldn't change between degenerate and non-degenerate?!
- GrScalar fCenterX1;
- GrScalar fRadius0;
- GrScalar fDiffRadius;
+ SkScalar fCenterX1;
+ SkScalar fRadius0;
+ SkScalar fDiffRadius;
// @}
@@ -459,9 +459,9 @@ GrGLConical2Gradient::GrGLConical2Gradient(
, fFSParamUni(kInvalidUniformHandle)
, fVSVaryingName(NULL)
, fFSVaryingName(NULL)
- , fCachedCenter(GR_ScalarMax)
- , fCachedRadius(-GR_ScalarMax)
- , fCachedDiffRadius(-GR_ScalarMax) {
+ , fCachedCenter(SK_ScalarMax)
+ , fCachedRadius(-SK_ScalarMax)
+ , fCachedDiffRadius(-SK_ScalarMax) {
const GrConical2Gradient& data =
static_cast<const GrConical2Gradient&>(baseData);
@@ -642,15 +642,15 @@ void GrGLConical2Gradient::setData(const GrGLUniformManager& uman, const GrEffec
INHERITED::setData(uman, stage);
const GrConical2Gradient& data = static_cast<const GrConical2Gradient&>(*stage.getEffect());
GrAssert(data.isDegenerate() == fIsDegenerate);
- GrScalar centerX1 = data.center();
- GrScalar radius0 = data.radius();
- GrScalar diffRadius = data.diffRadius();
+ SkScalar centerX1 = data.center();
+ SkScalar radius0 = data.radius();
+ SkScalar diffRadius = data.diffRadius();
if (fCachedCenter != centerX1 ||
fCachedRadius != radius0 ||
fCachedDiffRadius != diffRadius) {
- GrScalar a = GrMul(centerX1, centerX1) - diffRadius * diffRadius;
+ SkScalar a = SkScalarMul(centerX1, centerX1) - diffRadius * diffRadius;
// When we're in the degenerate (linear) case, the second
// value will be INF but the program doesn't read it. (We
@@ -658,12 +658,12 @@ void GrGLConical2Gradient::setData(const GrGLUniformManager& uman, const GrEffec
// all in the linear case just to keep the code complexity
// down).
float values[6] = {
- GrScalarToFloat(a * 4),
- 1.f / (GrScalarToFloat(a)),
- GrScalarToFloat(centerX1),
- GrScalarToFloat(radius0),
- GrScalarToFloat(SkScalarMul(radius0, radius0)),
- GrScalarToFloat(diffRadius)
+ SkScalarToFloat(a * 4),
+ 1.f / (SkScalarToFloat(a)),
+ SkScalarToFloat(centerX1),
+ SkScalarToFloat(radius0),
+ SkScalarToFloat(SkScalarMul(radius0, radius0)),
+ SkScalarToFloat(diffRadius)
};
uman.set1fv(fVSParamUni, 0, 6, values);
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index d0186291f2..3f75d0ff9a 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -387,8 +387,8 @@ protected:
// @{
/// Values last uploaded as uniforms
- GrScalar fCachedCenter;
- GrScalar fCachedRadius;
+ SkScalar fCachedCenter;
+ SkScalar fCachedRadius;
bool fCachedPosRoot;
// @}
@@ -427,9 +427,9 @@ public:
}
// The radial gradient parameters can collapse to a linear (instead of quadratic) equation.
- bool isDegenerate() const { return GR_Scalar1 == fCenterX1; }
- GrScalar center() const { return fCenterX1; }
- GrScalar radius() const { return fRadius0; }
+ bool isDegenerate() const { return SK_Scalar1 == fCenterX1; }
+ SkScalar center() const { return fCenterX1; }
+ SkScalar radius() const { return fRadius0; }
bool isPosRoot() const { return SkToBool(fPosRoot); }
typedef GrGLRadial2Gradient GLEffect;
@@ -441,8 +441,8 @@ private:
// Cache of values - these can change arbitrarily, EXCEPT
// we shouldn't change between degenerate and non-degenerate?!
- GrScalar fCenterX1;
- GrScalar fRadius0;
+ SkScalar fCenterX1;
+ SkScalar fRadius0;
SkBool8 fPosRoot;
// @}
@@ -494,8 +494,8 @@ GrGLRadial2Gradient::GrGLRadial2Gradient(
, fFSParamUni(kInvalidUniformHandle)
, fVSVaryingName(NULL)
, fFSVaryingName(NULL)
- , fCachedCenter(GR_ScalarMax)
- , fCachedRadius(-GR_ScalarMax)
+ , fCachedCenter(SK_ScalarMax)
+ , fCachedRadius(-SK_ScalarMax)
, fCachedPosRoot(0) {
const GrRadial2Gradient& data =
@@ -618,13 +618,13 @@ void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman, const GrEffect
INHERITED::setData(uman, stage);
const GrRadial2Gradient& data = static_cast<const GrRadial2Gradient&>(*stage.getEffect());
GrAssert(data.isDegenerate() == fIsDegenerate);
- GrScalar centerX1 = data.center();
- GrScalar radius0 = data.radius();
+ SkScalar centerX1 = data.center();
+ SkScalar radius0 = data.radius();
if (fCachedCenter != centerX1 ||
fCachedRadius != radius0 ||
fCachedPosRoot != data.isPosRoot()) {
- GrScalar a = GrMul(centerX1, centerX1) - GR_Scalar1;
+ SkScalar a = SkScalarMul(centerX1, centerX1) - SK_Scalar1;
// When we're in the degenerate (linear) case, the second
// value will be INF but the program doesn't read it. (We
@@ -632,11 +632,11 @@ void GrGLRadial2Gradient::setData(const GrGLUniformManager& uman, const GrEffect
// all in the linear case just to keep the code complexity
// down).
float values[6] = {
- GrScalarToFloat(a),
- 1 / (2.f * GrScalarToFloat(a)),
- GrScalarToFloat(centerX1),
- GrScalarToFloat(radius0),
- GrScalarToFloat(GrMul(radius0, radius0)),
+ SkScalarToFloat(a),
+ 1 / (2.f * SkScalarToFloat(a)),
+ SkScalarToFloat(centerX1),
+ SkScalarToFloat(radius0),
+ SkScalarToFloat(SkScalarMul(radius0, radius0)),
data.isPosRoot() ? 1.f : -1.f
};