Index: src/gpu/effects/GrBitmapTextGeoProc.cpp |
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp |
index 18f191711d3b0a2f7790238545c1f5c072db7756..6fd353849e18c9d2822cdaa6c846eb75520b8cfb 100644 |
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp |
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp |
@@ -31,12 +31,16 @@ |
// compute numbers to be hardcoded to convert texture coordinates from int to float |
SkASSERT(cte.numTextures() == 1); |
- SkDEBUGCODE(GrTexture* atlas = cte.textureAccess(0).getTexture()); |
+ GrTexture* atlas = cte.textureAccess(0).getTexture(); |
SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height())); |
+ SkScalar recipWidth = 1.0f / atlas->width(); |
+ SkScalar recipHeight = 1.0f / atlas->height(); |
GrGLSLVertToFrag v(kVec2f_GrSLType); |
varyingHandler->addVarying("TextureCoords", &v); |
- vertBuilder->codeAppendf("%s = %s;", v.vsOut(), |
+ vertBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", v.vsOut(), |
+ GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipWidth, |
+ GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipHeight, |
cte.inTextureCoords()->fName); |
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
@@ -146,7 +150,7 @@ |
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType)); |
} |
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", |
- kVec2us_GrVertexAttribType)); |
+ kVec2s_GrVertexAttribType)); |
this->addTextureAccess(&fTextureAccess); |
} |