Skip to content

Commit 008d63e

Browse files
Mike KleinSkia Commit-Bot
Mike Klein
authored and
Skia Commit-Bot
committed
replace std::aligned_union
Since we're only describing the type size and alignment, we can just use ordinary unions here. This fixes the size and alignment of AllVertexData, I think. Bug: skia:10921 Change-Id: Ife5c1a1f52caf463d28a78b1f35d78e0bbeaeddc Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333478 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
1 parent 4888cda commit 008d63e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/gpu/text/GrTextBlob.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,16 +1336,19 @@ GrTextBlob::~GrTextBlob() = default;
13361336

13371337
sk_sp<GrTextBlob> GrTextBlob::Make(const SkGlyphRunList& glyphRunList, const SkMatrix& drawMatrix) {
13381338
// The difference in alignment from the storage of VertexData to SubRun;
1339-
using AllSubRuns = std::aligned_union_t<1,
1340-
DirectMaskSubRun,
1341-
TransformedMaskSubRun,
1342-
SDFTSubRun,
1343-
PathSubRun>;
1344-
1345-
using AllVertexData = std::aligned_union<1,
1346-
DirectMaskSubRun::VertexData,
1347-
TransformedMaskSubRun::VertexData,
1348-
SDFTSubRun::VertexData>;
1339+
union AllSubRuns {
1340+
~AllSubRuns() = delete; // MSVC warns this is implicit if we don't write it explicitly.
1341+
DirectMaskSubRun d;
1342+
TransformedMaskSubRun t;
1343+
SDFTSubRun s;
1344+
PathSubRun p;
1345+
};
1346+
union AllVertexData {
1347+
DirectMaskSubRun ::VertexData d;
1348+
TransformedMaskSubRun::VertexData t;
1349+
SDFTSubRun ::VertexData s;
1350+
};
1351+
13491352
constexpr size_t alignDiff = alignof(AllSubRuns) - alignof(AllVertexData);
13501353
constexpr size_t vertexDataToSubRunPadding = alignDiff > 0 ? alignDiff : 0;
13511354
size_t totalGlyphCount = glyphRunList.totalGlyphCount();

0 commit comments

Comments
 (0)