a few text blob and text op cleanups
Change-Id: I2dd7cacc19232c0ff9d890c613fe6cc2346e8553
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371142
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index a0ac0a3..29c5a54 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -29,18 +29,30 @@
static const int kIndicesPerGlyph = 6;
struct Geometry {
+ Geometry(const GrAtlasSubRun& subRun,
+ const SkMatrix& drawMatrix,
+ SkPoint drawOrigin,
+ SkIRect clipRect,
+ GrTextBlob* blob,
+ const SkPMColor4f& color)
+ : fSubRun{subRun}
+ , fDrawMatrix{drawMatrix}
+ , fDrawOrigin{drawOrigin}
+ , fClipRect{clipRect}
+ , fBlob{blob}
+ , fColor{color} {}
void fillVertexData(void* dst, int offset, int count) const;
const GrAtlasSubRun& fSubRun;
- const SkMatrix fDrawMatrix;
- const SkPoint fDrawOrigin;
- const SkIRect fClipRect;
- GrTextBlob* const fBlob; // mutable to make unref call in Op dtor.
+ const SkMatrix fDrawMatrix;
+ const SkPoint fDrawOrigin;
+ const SkIRect fClipRect;
+ GrTextBlob* const fBlob; // mutable to make unref call in Op dtor.
// Color is updated after processor analysis if it was determined the shader resolves to
// a constant color that we then evaluate on the CPU.
// TODO: This can be made const once processor analysis is separated from op creation.
- SkPMColor4f fColor;
+ SkPMColor4f fColor;
};
const char* name() const override { return "AtlasTextOp"; }
@@ -78,6 +90,16 @@
private:
friend class GrOp; // for ctor
+ struct FlushInfo {
+ sk_sp<const GrBuffer> fVertexBuffer;
+ sk_sp<const GrBuffer> fIndexBuffer;
+ GrGeometryProcessor* fGeometryProcessor;
+ const GrSurfaceProxy** fPrimProcProxies;
+ int fGlyphsToFlush = 0;
+ int fVertexOffset = 0;
+ int fNumDraws = 0;
+ };
+
GrAtlasTextOp(MaskType maskType,
bool needsTransform,
int glyphCount,
@@ -95,16 +117,6 @@
const Geometry& geo,
GrPaint&& paint);
- struct FlushInfo {
- sk_sp<const GrBuffer> fVertexBuffer;
- sk_sp<const GrBuffer> fIndexBuffer;
- GrGeometryProcessor* fGeometryProcessor;
- const GrSurfaceProxy** fPrimProcProxies;
- int fGlyphsToFlush = 0;
- int fVertexOffset = 0;
- int fNumDraws = 0;
- };
-
GrProgramInfo* programInfo() override {
// TODO [PI]: implement
return nullptr;
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 7374f87..1451c56 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -725,9 +725,9 @@
for (auto[quad, glyph, leftTop] : quadData) {
auto[al, at, ar, ab] = glyph->fAtlasLocator.getUVs();
SkScalar dl = leftTop[0] + integralOriginOffset.x(),
- dt = leftTop[1] + integralOriginOffset.y(),
- dr = dl + (ar - al),
- db = dt + (ab - at);
+ dt = leftTop[1] + integralOriginOffset.y(),
+ dr = dl + (ar - al),
+ db = dt + (ab - at);
quad[0] = {{dl, dt}, color, {al, at}}; // L,T
quad[1] = {{dl, db}, color, {al, ab}}; // L,B