From 01e583807618038a578a3b07cfad3101d24115c7 Mon Sep 17 00:00:00 2001 From: benjaminwagner Date: Mon, 22 Feb 2016 11:10:33 -0800 Subject: Simplify calculations in AADistanceFieldPathBatch::writePathVertices. No API changes. BUG=skia:4632 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1715063002 TBR=reed Review URL: https://codereview.chromium.org/1715063002 --- src/gpu/batches/GrAADistanceFieldPathRenderer.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/gpu/batches') diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp index d48649cd27..8525eb2fde 100644 --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp @@ -461,11 +461,6 @@ private: width *= invScale; height *= invScale; - SkFixed tx = SkIntToFixed(pathData->fAtlasLocation.fX); - SkFixed ty = SkIntToFixed(pathData->fAtlasLocation.fY); - SkFixed tw = SkScalarToFixed(pathData->fBounds.width()); - SkFixed th = SkScalarToFixed(pathData->fBounds.height()); - SkPoint* positions = reinterpret_cast(offset); // vertex positions @@ -479,12 +474,15 @@ private: *colorPtr = color; } + const SkScalar tx = SkIntToScalar(pathData->fAtlasLocation.fX); + const SkScalar ty = SkIntToScalar(pathData->fAtlasLocation.fY); + // vertex texture coords SkPoint* textureCoords = (SkPoint*)(offset + sizeof(SkPoint) + sizeof(GrColor)); - textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFixedX(tx)), - SkFixedToFloat(texture->texturePriv().normalizeFixedY(ty)), - SkFixedToFloat(texture->texturePriv().normalizeFixedX(tx + tw)), - SkFixedToFloat(texture->texturePriv().normalizeFixedY(ty + th)), + textureCoords->setRectFan(tx / texture->width(), + ty / texture->height(), + (tx + pathData->fBounds.width()) / texture->width(), + (ty + pathData->fBounds.height()) / texture->height(), vertexStride); } -- cgit v1.2.3