Revert "Wrap page index packing in helper methods."
This reverts commit cb93a20d9a961219bad674d6c168bfde03a16246.
Reason for revert: Still seeing some corruption issues with Chrome text that may be related to this.
Original change's description:
> Wrap page index packing in helper methods.
>
> Also simplifies the shaders if we know there's only one atlas texture.
>
> Change-Id: I81063d423fd56cf91caee83ba9eae9d988aa249b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266566
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=jvanverth@google.com,herb@google.com,brianosman@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I031f27c07929b1f66581ed8e94e1056d9107bf75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266633
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 32530b1..f790870 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -197,16 +197,12 @@
auto* blobCoordsRB = reinterpret_cast<const uint16_t*>(blobVertices + 3 * vertexStride +
coordOffset);
// Pull out the texel coordinates and texture index bits
- uint16_t coordsRectL = blobCoordsLT[0];
- uint16_t coordsRectT = blobCoordsLT[1];
- uint16_t coordsRectR = blobCoordsRB[0];
- uint16_t coordsRectB = blobCoordsRB[1];
- int index0, index1;
- std::tie(coordsRectL, coordsRectT, index0) =
- GrDrawOpAtlas::UnpackIndexFromTexCoords(coordsRectL, coordsRectT);
- std::tie(coordsRectR, coordsRectB, index1) =
- GrDrawOpAtlas::UnpackIndexFromTexCoords(coordsRectR, coordsRectB);
- SkASSERT(index0 == index1);
+ uint16_t coordsRectL = blobCoordsLT[0] >> 1;
+ uint16_t coordsRectT = blobCoordsLT[1] >> 1;
+ uint16_t coordsRectR = blobCoordsRB[0] >> 1;
+ uint16_t coordsRectB = blobCoordsRB[1] >> 1;
+ uint16_t pageIndexX = blobCoordsLT[0] & 0x1;
+ uint16_t pageIndexY = blobCoordsLT[1] & 0x1;
int positionRectWidth = positionRect.width();
int positionRectHeight = positionRect.height();
@@ -232,10 +228,10 @@
positionRect.fBottom -= delta;
// Repack texel coordinates and index
- std::tie(coordsRectL, coordsRectT) =
- GrDrawOpAtlas::PackIndexInTexCoords(coordsRectL, coordsRectT, index0);
- std::tie(coordsRectR, coordsRectB) =
- GrDrawOpAtlas::PackIndexInTexCoords(coordsRectR, coordsRectB, index1);
+ coordsRectL = coordsRectL << 1 | pageIndexX;
+ coordsRectT = coordsRectT << 1 | pageIndexY;
+ coordsRectR = coordsRectR << 1 | pageIndexX;
+ coordsRectB = coordsRectB << 1 | pageIndexY;
// Set new positions and coords
SkPoint* currPosition = reinterpret_cast<SkPoint*>(currVertex);