Skip to content

Commit fe5b133

Browse files
herbderbySkCQ
authored andcommitted
don't rely on GlyphRunList for position
Change-Id: Ia8ad1851400d677ca6a65f9927322697f5e69102 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471762 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
1 parent 7b64e13 commit fe5b133

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

src/gpu/ops/AtlasTextOp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ GrOp::Owner AtlasTextOp::CreateOpTestingOnly(SurfaceDrawContext* sdc,
517517
SkASSERT(subRun);
518518
GrOp::Owner op;
519519
std::tie(std::ignore, op) = subRun->makeAtlasTextOp(
520-
nullptr, mtxProvider, glyphRunList, skPaint, sdc, nullptr);
520+
nullptr, mtxProvider, glyphRunList.origin(), skPaint, sdc, nullptr);
521521
return op;
522522
}
523523

src/gpu/text/GrTextBlob.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ class DirectMaskSubRun final : public GrSubRun, public GrAtlasSubRun {
468468
std::tuple<const GrClip*, GrOp::Owner>
469469
makeAtlasTextOp(const GrClip* clip,
470470
const SkMatrixProvider& viewMatrix,
471-
const SkGlyphRunList& glyphRunList,
471+
SkPoint drawOrigin,
472472
const SkPaint& paint,
473473
skgpu::v1::SurfaceDrawContext* sdc,
474474
GrAtlasSubRunOwner) const override;
@@ -594,7 +594,7 @@ void DirectMaskSubRun::draw(const GrClip* clip,
594594
const SkPaint& paint,
595595
skgpu::v1::SurfaceDrawContext* sdc) const{
596596
auto[drawingClip, op] = this->makeAtlasTextOp(
597-
clip, viewMatrix, glyphRunList, paint, sdc, nullptr);
597+
clip, viewMatrix, glyphRunList.origin(), paint, sdc, nullptr);
598598
if (op != nullptr) {
599599
sdc->addDrawOp(drawingClip, std::move(op));
600600
}
@@ -643,15 +643,15 @@ calculate_clip(const GrClip* clip, SkRect deviceBounds, SkRect glyphBounds) {
643643
} // namespace
644644

645645
std::tuple<const GrClip*, GrOp::Owner>
646-
DirectMaskSubRun::makeAtlasTextOp(const GrClip* clip, const SkMatrixProvider& viewMatrix,
647-
const SkGlyphRunList& glyphRunList,
646+
DirectMaskSubRun::makeAtlasTextOp(const GrClip* clip,
647+
const SkMatrixProvider& viewMatrix,
648+
SkPoint drawOrigin,
648649
const SkPaint& paint,
649650
skgpu::v1::SurfaceDrawContext* sdc,
650651
GrAtlasSubRunOwner) const {
651652
SkASSERT(this->glyphCount() != 0);
652653

653654
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
654-
const SkPoint drawOrigin = glyphRunList.origin();
655655

656656
// We can clip geometrically using clipRect and ignore clip when an axis-aligned rectangular
657657
// non-AA clip is used. If clipRect is empty, and clip is nullptr, then there is no clipping
@@ -862,7 +862,7 @@ class TransformedMaskSubRun final : public GrSubRun, public GrAtlasSubRun {
862862
std::tuple<const GrClip*, GrOp::Owner>
863863
makeAtlasTextOp(const GrClip*,
864864
const SkMatrixProvider& viewMatrix,
865-
const SkGlyphRunList&,
865+
SkPoint drawOrigin,
866866
const SkPaint&,
867867
skgpu::v1::SurfaceDrawContext*,
868868
GrAtlasSubRunOwner) const override;
@@ -949,7 +949,7 @@ void TransformedMaskSubRun::draw(const GrClip* clip,
949949
const SkPaint& paint,
950950
skgpu::v1::SurfaceDrawContext* sdc) const {
951951
auto[drawingClip, op] = this->makeAtlasTextOp(
952-
clip, viewMatrix, glyphRunList, paint, sdc, nullptr);
952+
clip, viewMatrix, glyphRunList.origin(), paint, sdc, nullptr);
953953
if (op != nullptr) {
954954
sdc->addDrawOp(drawingClip, std::move(op));
955955
}
@@ -958,13 +958,12 @@ void TransformedMaskSubRun::draw(const GrClip* clip,
958958
std::tuple<const GrClip*, GrOp::Owner>
959959
TransformedMaskSubRun::makeAtlasTextOp(const GrClip* clip,
960960
const SkMatrixProvider& viewMatrix,
961-
const SkGlyphRunList& glyphRunList,
961+
SkPoint drawOrigin,
962962
const SkPaint& paint,
963963
skgpu::v1::SurfaceDrawContext* sdc,
964964
GrAtlasSubRunOwner) const {
965965
SkASSERT(this->glyphCount() != 0);
966966

967-
SkPoint drawOrigin = glyphRunList.origin();
968967
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
969968

970969
GrPaint grPaint;
@@ -1122,7 +1121,7 @@ class SDFTSubRun final : public GrSubRun, public GrAtlasSubRun {
11221121
std::tuple<const GrClip*, GrOp::Owner>
11231122
makeAtlasTextOp(const GrClip*,
11241123
const SkMatrixProvider& viewMatrix,
1125-
const SkGlyphRunList&,
1124+
SkPoint drawOrigin,
11261125
const SkPaint&,
11271126
skgpu::v1::SurfaceDrawContext*,
11281127
GrAtlasSubRunOwner) const override;
@@ -1227,7 +1226,7 @@ void SDFTSubRun::draw(const GrClip* clip,
12271226
const SkPaint& paint,
12281227
skgpu::v1::SurfaceDrawContext* sdc) const {
12291228
auto[drawingClip, op] = this->makeAtlasTextOp(
1230-
clip, viewMatrix, glyphRunList, paint, sdc, nullptr);
1229+
clip, viewMatrix, glyphRunList.origin(), paint, sdc, nullptr);
12311230
if (op != nullptr) {
12321231
sdc->addDrawOp(drawingClip, std::move(op));
12331232
}
@@ -1264,14 +1263,13 @@ static std::tuple<AtlasTextOp::MaskType, uint32_t, bool> calculate_sdf_parameter
12641263
std::tuple<const GrClip*, GrOp::Owner >
12651264
SDFTSubRun::makeAtlasTextOp(const GrClip* clip,
12661265
const SkMatrixProvider& viewMatrix,
1267-
const SkGlyphRunList& glyphRunList,
1266+
SkPoint drawOrigin,
12681267
const SkPaint& paint,
12691268
skgpu::v1::SurfaceDrawContext* sdc,
12701269
GrAtlasSubRunOwner) const {
12711270
SkASSERT(this->glyphCount() != 0);
12721271
SkASSERT(!viewMatrix.localToDevice().hasPerspective());
12731272

1274-
SkPoint drawOrigin = glyphRunList.origin();
12751273
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
12761274

12771275
GrPaint grPaint;
@@ -1685,7 +1683,7 @@ class DirectMaskSubRunNoCache final : public GrAtlasSubRun {
16851683
std::tuple<const GrClip*, GrOp::Owner>
16861684
makeAtlasTextOp(const GrClip*,
16871685
const SkMatrixProvider& viewMatrix,
1688-
const SkGlyphRunList&,
1686+
SkPoint,
16891687
const SkPaint&,
16901688
skgpu::v1::SurfaceDrawContext*,
16911689
GrAtlasSubRunOwner) const override;
@@ -1781,14 +1779,13 @@ int DirectMaskSubRunNoCache::glyphCount() const {
17811779
std::tuple<const GrClip*, GrOp::Owner>
17821780
DirectMaskSubRunNoCache::makeAtlasTextOp(const GrClip* clip,
17831781
const SkMatrixProvider& viewMatrix,
1784-
const SkGlyphRunList& glyphRunList,
1782+
SkPoint drawOrigin,
17851783
const SkPaint& paint,
17861784
skgpu::v1::SurfaceDrawContext* sdc,
17871785
GrAtlasSubRunOwner subRunOwner) const {
17881786
SkASSERT(this->glyphCount() != 0);
17891787

17901788
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
1791-
const SkPoint drawOrigin = glyphRunList.origin();
17921789

17931790
// We can clip geometrically using clipRect and ignore clip when an axis-aligned rectangular
17941791
// non-AA clip is used. If clipRect is empty, and clip is nullptr, then there is no clipping
@@ -1923,7 +1920,7 @@ class TransformedMaskSubRunNoCache final : public GrAtlasSubRun {
19231920
std::tuple<const GrClip*, GrOp::Owner>
19241921
makeAtlasTextOp(const GrClip*,
19251922
const SkMatrixProvider& viewMatrix,
1926-
const SkGlyphRunList&,
1923+
SkPoint drawOrigin,
19271924
const SkPaint&,
19281925
skgpu::v1::SurfaceDrawContext*,
19291926
GrAtlasSubRunOwner) const override;
@@ -2002,13 +1999,12 @@ GrAtlasSubRunOwner TransformedMaskSubRunNoCache::Make(
20021999
std::tuple<const GrClip*, GrOp::Owner>
20032000
TransformedMaskSubRunNoCache::makeAtlasTextOp(const GrClip* clip,
20042001
const SkMatrixProvider& viewMatrix,
2005-
const SkGlyphRunList& glyphRunList,
2002+
SkPoint drawOrigin,
20062003
const SkPaint& paint,
20072004
skgpu::v1::SurfaceDrawContext* sdc,
20082005
GrAtlasSubRunOwner subRunOwner) const {
20092006
SkASSERT(this->glyphCount() != 0);
20102007

2011-
SkPoint drawOrigin = glyphRunList.origin();
20122008
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
20132009

20142010
GrPaint grPaint;
@@ -2124,7 +2120,6 @@ SkRect TransformedMaskSubRunNoCache::deviceRect(
21242120
return drawMatrix.mapRect(outBounds);
21252121
}
21262122

2127-
21282123
// -- SDFTSubRunNoCache ----------------------------------------------------------------------------
21292124
class SDFTSubRunNoCache final : public GrAtlasSubRun {
21302125
public:
@@ -2151,7 +2146,7 @@ class SDFTSubRunNoCache final : public GrAtlasSubRun {
21512146
std::tuple<const GrClip*, GrOp::Owner>
21522147
makeAtlasTextOp(const GrClip*,
21532148
const SkMatrixProvider& viewMatrix,
2154-
const SkGlyphRunList&,
2149+
SkPoint drawOrigin,
21552150
const SkPaint&,
21562151
skgpu::v1::SurfaceDrawContext*,
21572152
GrAtlasSubRunOwner) const override;
@@ -2244,13 +2239,12 @@ GrAtlasSubRunOwner SDFTSubRunNoCache::Make(
22442239
std::tuple<const GrClip*, GrOp::Owner>
22452240
SDFTSubRunNoCache::makeAtlasTextOp(const GrClip* clip,
22462241
const SkMatrixProvider& viewMatrix,
2247-
const SkGlyphRunList& glyphRunList,
2242+
SkPoint drawOrigin,
22482243
const SkPaint& paint,
22492244
skgpu::v1::SurfaceDrawContext* sdc,
22502245
GrAtlasSubRunOwner subRunOwner) const {
22512246
SkASSERT(this->glyphCount() != 0);
22522247

2253-
SkPoint drawOrigin = glyphRunList.origin();
22542248
const SkMatrix& drawMatrix = viewMatrix.localToDevice();
22552249

22562250
GrPaint grPaint;
@@ -2461,7 +2455,7 @@ void GrSubRunNoCachePainter::draw(GrAtlasSubRunOwner subRun) {
24612455
}
24622456
GrAtlasSubRun* subRunPtr = subRun.get();
24632457
auto [drawingClip, op] = subRunPtr->makeAtlasTextOp(
2464-
fClip, fViewMatrix, fGlyphRunList, fPaint, fSDC, std::move(subRun));
2458+
fClip, fViewMatrix, fGlyphRunList.origin(), fPaint, fSDC, std::move(subRun));
24652459
if (op != nullptr) {
24662460
fSDC->addDrawOp(drawingClip, std::move(op));
24672461
}

src/gpu/text/GrTextBlob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class GrAtlasSubRun {
7777
makeAtlasTextOp(
7878
const GrClip*,
7979
const SkMatrixProvider& viewMatrix,
80-
const SkGlyphRunList&,
80+
SkPoint drawOrigin,
8181
const SkPaint&,
8282
skgpu::v1::SurfaceDrawContext*,
8383
GrAtlasSubRunOwner subRun) const = 0;

0 commit comments

Comments
 (0)