aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-08-25 08:45:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-25 15:19:27 +0000
commit8296e752fa1803dcb8cf97d6ab10bb4f5f5f51f0 (patch)
tree7251f087721b2578152647b1c9e17d7dbf581dbc /src/gpu/ops
parentc8323aa51ab27259076532ba081d2ed5c26aedfc (diff)
Switch atlas clients over to using absolute texture coordinates (take 2)
This is a prerequisite for being able to resize the atlas with impunity. Change-Id: Iccc9c7ced43f38a7d8483a7bd12a458d59a3453a Reviewed-on: https://skia-review.googlesource.com/38362 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r--src/gpu/ops/GrSmallPathRenderer.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 69cd669abb..7e7a496af6 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -351,11 +351,11 @@ private:
shapeData = new ShapeData;
if (!this->addBMPathToAtlas(target,
- &flushInfo,
- atlas,
- shapeData,
- args.fShape,
- this->viewMatrix())) {
+ &flushInfo,
+ atlas,
+ shapeData,
+ args.fShape,
+ this->viewMatrix())) {
delete shapeData;
continue;
}
@@ -479,7 +479,6 @@ private:
shapeData->fKey.set(shape, dimension);
shapeData->fID = id;
- // set the bounds rect to the original bounds
shapeData->fBounds = SkRect::Make(devPathBounds);
shapeData->fBounds.offset(-translateX, -translateY);
shapeData->fBounds.fLeft /= scale;
@@ -615,22 +614,10 @@ private:
}
// set up texture coordinates
- SkScalar texLeft = shapeData->fTextureCoords.fLeft;
- SkScalar texTop = shapeData->fTextureCoords.fTop;
- SkScalar texRight = shapeData->fTextureCoords.fRight;
- SkScalar texBottom = shapeData->fTextureCoords.fBottom;
-
- // convert texcoords to unsigned short format
- sk_sp<GrTextureProxy> proxy = atlas->getProxy();
-
- // The proxy must be functionally exact for this normalization to work correctly
- SkASSERT(GrResourceProvider::IsFunctionallyExact(proxy.get()));
- SkScalar uFactor = 65535.f / proxy->width();
- SkScalar vFactor = 65535.f / proxy->height();
- uint16_t l = (uint16_t)(texLeft*uFactor);
- uint16_t t = (uint16_t)(texTop*vFactor);
- uint16_t r = (uint16_t)(texRight*uFactor);
- uint16_t b = (uint16_t)(texBottom*vFactor);
+ uint16_t l = shapeData->fTextureCoords.fLeft;
+ uint16_t t = shapeData->fTextureCoords.fTop;
+ uint16_t r = shapeData->fTextureCoords.fRight;
+ uint16_t b = shapeData->fTextureCoords.fBottom;
// set vertex texture coords
intptr_t textureCoordOffset = offset + sizeof(SkPoint) + sizeof(GrColor);