Skip to content

Commit 7225788

Browse files
herbderbySkia Commit-Bot
authored andcommitted
update size GrTextBlob size calculation
Update calculating GrTextBlob size to reflect different VertexData sizes. Change-Id: I8127c5ec5b6fdc3c7722cacd316cade5e467b4b9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307220 Reviewed-by: Robert Phillips <[email protected]> Commit-Queue: Herb Derby <[email protected]>
1 parent d5a7f1f commit 7225788

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/gpu/text/GrTextBlob.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,12 +904,21 @@ GrTextBlob::~GrTextBlob() = default;
904904

905905
sk_sp<GrTextBlob> GrTextBlob::Make(const SkGlyphRunList& glyphRunList, const SkMatrix& drawMatrix) {
906906
// The difference in alignment from the storage of VertexData to SubRun;
907-
using AllSubRuns = std::aligned_union_t<1, GrSDFTSubRun, GrDirectMaskSubRun, GrPathSubRun>;
908-
constexpr size_t alignDiff = alignof(AllSubRuns) - alignof(GrSDFTSubRun::VertexData);
907+
using AllSubRuns = std::aligned_union_t<1,
908+
GrDirectMaskSubRun,
909+
GrTransformedMaskSubRun,
910+
GrSDFTSubRun,
911+
GrPathSubRun>;
912+
913+
using AllVertexData = std::aligned_union<1,
914+
GrDirectMaskSubRun::VertexData,
915+
GrTransformedMaskSubRun::VertexData,
916+
GrSDFTSubRun::VertexData>;
917+
constexpr size_t alignDiff = alignof(AllSubRuns) - alignof(AllVertexData);
909918
constexpr size_t vertexDataToSubRunPadding = alignDiff > 0 ? alignDiff : 0;
910919
size_t totalGlyphCount = glyphRunList.totalGlyphCount();
911920
size_t arenaSize =
912-
totalGlyphCount * sizeof(GrSDFTSubRun::VertexData)
921+
totalGlyphCount * sizeof(AllVertexData)
913922
+ GrGlyphVector::GlyphVectorSize(totalGlyphCount)
914923
+ glyphRunList.runCount() * (sizeof(AllSubRuns) + vertexDataToSubRunPadding)
915924
+ 32; // Misc arena overhead.

src/gpu/text/GrTextBlob.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,6 @@ class GrAtlasSubRun : public GrSubRun {
246246
int begin, int end, GrMeshDrawOp::Target* target) const = 0;
247247

248248
protected:
249-
using VertexData = std::tuple<
250-
SkPoint, // glyph position.
251-
GrIRect16 // glyph bounding rectangle.
252-
>;
253-
254249
struct AtlasPt {
255250
uint16_t u;
256251
uint16_t v;
@@ -315,6 +310,11 @@ class GrGlyphVector {
315310
// -- GrDirectMaskSubRun ---------------------------------------------------------------------------
316311
class GrDirectMaskSubRun final : public GrAtlasSubRun {
317312
public:
313+
using VertexData = std::tuple<
314+
SkPoint, // glyph position.
315+
GrIRect16 // glyph bounding rectangle.
316+
>;
317+
318318
GrDirectMaskSubRun(GrMaskFormat format,
319319
GrTextBlob* blob,
320320
const SkRect& bounds,

0 commit comments

Comments
 (0)