Update GrLatticeOp to not read from the gpu vertex buffer.

Change-Id: I93e90da7762c379486fd1a329ebf984e93578c69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364917
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2021-02-02 17:11:37 -05:00 committed by Skia Commit-Bot
parent 1dea436a38
commit d49b1282fe

View File

@ -259,7 +259,6 @@ private:
SkIRect srcR;
SkRect dstR;
SkPoint* patchPositions = reinterpret_cast<SkPoint*>(vertices.fPtr);
Sk4f scales(1.f / fView.proxy()->width(), 1.f / fView.proxy()->height(),
1.f / fView.proxy()->width(), 1.f / fView.proxy()->height());
static const Sk4f kDomainOffsets(0.5f, 0.5f, -0.5f, -0.5f);
@ -280,17 +279,36 @@ private:
domain.store(&texDomain);
coords.store(&texCoords);
if (isScaleTranslate) {
vertices.writeQuad(GrVertexWriter::TriStripFromRect(dstR),
GrVertexWriter::TriStripFromRect(texCoords),
texDomain,
patchColor);
} else {
SkPoint mappedPts[4];
patch.fViewMatrix.mapRectToQuad(mappedPts, dstR);
// In the above if statement, writeQuad writes the corners as:
// left-top, left-bottom, right-top, right-bottom.
// However, mapRectToQuad returns them in the order:
// left-top, right-top, right-bottom, left-bottom
// Thus we write out the vertices to match the writeQuad path.
vertices.write(mappedPts[0],
SkPoint::Make(texCoords.fLeft, texCoords.fTop),
texDomain,
patchColor);
vertices.write(mappedPts[3],
SkPoint::Make(texCoords.fLeft, texCoords.fBottom),
texDomain,
patchColor);
vertices.write(mappedPts[1],
SkPoint::Make(texCoords.fRight, texCoords.fTop),
texDomain,
patchColor);
vertices.write(mappedPts[2],
SkPoint::Make(texCoords.fRight, texCoords.fBottom),
texDomain,
patchColor);
}
// If we didn't handle it above, apply the matrix here.
if (!isScaleTranslate) {
SkMatrixPriv::MapPointsWithStride(
patch.fViewMatrix, patchPositions, kVertexStride,
GrResourceProvider::NumVertsPerNonAAQuad() * patch.fIter->numRectsToDraw());
}
}