diff options
author | 2017-08-24 17:47:23 +0000 | |
---|---|---|
committer | 2017-08-24 17:56:30 +0000 | |
commit | e253831ee0f3f85c5143e5ac39325400b145106f (patch) | |
tree | 84c13b8a445992289e0b2ca6c7335a9315e892f2 /src/gpu/ops | |
parent | 01a6a619d96d4b396d6f911722ffae862acdcbe6 (diff) |
Revert "Switch atlas clients over to using absolute texture coordinates"
This reverts commit e84c087e621978e6d298b8ca950521601a0366cb.
Reason for revert: ANGLE is unhappy
Original change's description:
> Switch atlas clients over to using absolute texture coordinates
>
> This is a prerequisite for being able to resize the atlas with impunity.
>
> Change-Id: I509816c8d6f38fbc92fa39aeab303b42ab09f58b
> Reviewed-on: https://skia-review.googlesource.com/37560
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,jvanverth@google.com,robertphillips@google.com,brianosman@google.com
Change-Id: I329efd642c22e11a5c576a4632fc557759b200d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/38400
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r-- | src/gpu/ops/GrSmallPathRenderer.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp index 7e7a496af6..69cd669abb 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,6 +479,7 @@ 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; @@ -614,10 +615,22 @@ private: } // set up texture coordinates - uint16_t l = shapeData->fTextureCoords.fLeft; - uint16_t t = shapeData->fTextureCoords.fTop; - uint16_t r = shapeData->fTextureCoords.fRight; - uint16_t b = shapeData->fTextureCoords.fBottom; + 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); // set vertex texture coords intptr_t textureCoordOffset = offset + sizeof(SkPoint) + sizeof(GrColor); |