Index: src/gpu/effects/GrDistanceFieldGeoProc.cpp |
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp |
index 0b97bb2b94980b225dd2ed7186b6cd70d4f1a4e1..d8fbd86cb33052a439e2c53d496c5b0224e60354 100755 |
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp |
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp |
@@ -80,15 +80,15 @@ public: |
// compute numbers to be hardcoded to convert texture coordinates from int to float |
SkASSERT(dfTexEffect.numTextures() == 1); |
GrTexture* atlas = dfTexEffect.textureAccess(0).getTexture(); |
- SkASSERT(atlas); |
+ SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height())); |
SkScalar recipWidth = 1.0f / atlas->width(); |
SkScalar recipHeight = 1.0f / atlas->height(); |
GrGLVertToFrag uv(kVec2f_GrSLType); |
args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); |
vsBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", uv.vsOut(), |
- SK_FLT_DECIMAL_DIG, recipWidth, |
- SK_FLT_DECIMAL_DIG, recipHeight, |
+ GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipWidth, |
+ GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipHeight, |
dfTexEffect.inTextureCoords()->fName); |
// Use highp to work around aliasing issues |
@@ -542,15 +542,15 @@ public: |
// compute numbers to be hardcoded to convert texture coordinates from int to float |
SkASSERT(dfTexEffect.numTextures() == 1); |
GrTexture* atlas = dfTexEffect.textureAccess(0).getTexture(); |
- SkASSERT(atlas); |
+ SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height())); |
SkScalar recipWidth = 1.0f / atlas->width(); |
SkScalar recipHeight = 1.0f / atlas->height(); |
GrGLVertToFrag uv(kVec2f_GrSLType); |
args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); |
vsBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", uv.vsOut(), |
- SK_FLT_DECIMAL_DIG, recipWidth, |
- SK_FLT_DECIMAL_DIG, recipHeight, |
+ GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipWidth, |
+ GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipHeight, |
dfTexEffect.inTextureCoords()->fName); |
// add frag shader code |