Index: src/gpu/GrAADistanceFieldPathRenderer.cpp |
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp |
index f2d618efcde2a3116ceef6364325a39213531139..1b2c36fe22d0bffdf018c65387e0d8c11ddd5054 100755 |
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp |
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp |
@@ -19,10 +19,10 @@ |
#include "SkDistanceFieldGen.h" |
#include "SkRTConf.h" |
-#define ATLAS_TEXTURE_WIDTH 1024 |
+#define ATLAS_TEXTURE_WIDTH 1024 |
#define ATLAS_TEXTURE_HEIGHT 2048 |
-#define PLOT_WIDTH 256 |
-#define PLOT_HEIGHT 256 |
+#define PLOT_WIDTH 256 |
+#define PLOT_HEIGHT 256 |
#define NUM_PLOTS_X (ATLAS_TEXTURE_WIDTH / PLOT_WIDTH) |
#define NUM_PLOTS_Y (ATLAS_TEXTURE_HEIGHT / PLOT_HEIGHT) |
@@ -342,39 +342,38 @@ bool GrAADistanceFieldPathRenderer::internalDrawPath(GrDrawTarget* target, |
bool success = target->reserveVertexAndIndexSpace(4, |
fCachedGeometryProcessor->getVertexStride(), |
0, &vertices, NULL); |
- SkASSERT(fCachedGeometryProcessor->getVertexStride() == 2 * sizeof(SkPoint)); |
+ SkASSERT(fCachedGeometryProcessor->getVertexStride() == sizeof(SkPoint) + sizeof(SkIPoint16)); |
GrAlwaysAssert(success); |
SkScalar dx = pathData->fBounds.fLeft; |
SkScalar dy = pathData->fBounds.fTop; |
robertphillips
2015/02/13 16:10:41
round_out_WH ?
comment ?
Would it not be better to
jvanverth1
2015/02/13 19:58:56
Rounding out the bounds seems to add an extra texe
|
- SkScalar width = pathData->fBounds.width(); |
- SkScalar height = pathData->fBounds.height(); |
+ int iwidth = static_cast<int>(pathData->fBounds.width() + 0.99f); |
+ int iheight = static_cast<int>(pathData->fBounds.height() + 0.99f); |
+ SkScalar width = iwidth; |
+ SkScalar height = iheight; |
SkScalar invScale = 1.0f/pathData->fScale; |
dx *= invScale; |
dy *= invScale; |
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()); |
- |
+ |
+ int u0 = pathData->fAtlasLocation.fX; |
+ int v0 = pathData->fAtlasLocation.fY; |
+ int u1 = u0 + iwidth; |
+ int v1 = v0 + iheight; |
// vertex positions |
SkRect r = SkRect::MakeXYWH(dx, dy, width, height); |
- size_t vertSize = 2 * sizeof(SkPoint); |
+ size_t vertSize = sizeof(SkPoint) + sizeof(SkIPoint16); |
SkPoint* positions = reinterpret_cast<SkPoint*>(vertices); |
positions->setRectFan(r.left(), r.top(), r.right(), r.bottom(), vertSize); |
// vertex texture coords |
- intptr_t intPtr = reinterpret_cast<intptr_t>(positions); |
- SkPoint* textureCoords = reinterpret_cast<SkPoint*>(intPtr + vertSize - sizeof(SkPoint)); |
- textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFixedX(tx)), |
- SkFixedToFloat(texture->texturePriv().normalizeFixedY(ty)), |
- SkFixedToFloat(texture->texturePriv().normalizeFixedX(tx + tw)), |
- SkFixedToFloat(texture->texturePriv().normalizeFixedY(ty + th)), |
- vertSize); |
+ intptr_t textureCoords = reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkIPoint16); |
+ ((SkIPoint16*)(textureCoords + 0 * vertSize))->set(u0, v0); |
+ ((SkIPoint16*)(textureCoords + 1 * vertSize))->set(u0, v1); |
+ ((SkIPoint16*)(textureCoords + 2 * vertSize))->set(u1, v1); |
+ ((SkIPoint16*)(textureCoords + 3 * vertSize))->set(u1, v0); |
viewMatrix.mapRect(&r); |
target->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); |