Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp

Issue 1715063002: Simplify calculations in AADistanceFieldPathBatch::writePathVertices. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrTexturePriv.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index d48649cd27f551aa14000aecd510a4e22a9449f6..8525eb2fdef513928831a3cdbfa31985e6860eb7 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<SkPoint*>(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);
}
« no previous file with comments | « src/gpu/GrTexturePriv.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698