Move SubRun from .h to .cpp
Change-Id: I168df05e7cd77987d6bc501ceebf1b8aaa255e73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259170
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 56bec65..11d1f12 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -61,6 +61,88 @@
, fOrigin(origin) {}
// -- GrTextBlob::SubRun ---------------------------------------------------------------------------
+// Hold data to draw the different types of sub run. SubRuns are produced knowing all the
+// glyphs that are included in them.
+class GrTextBlob::SubRun {
+public:
+ // SubRun for masks
+ SubRun(SubRunType type,
+ GrTextBlob* textBlob,
+ const SkStrikeSpec& strikeSpec,
+ GrMaskFormat format,
+ const SubRunBufferSpec& bufferSpec,
+ sk_sp<GrTextStrike>&& grStrike);
+
+ // SubRun for paths
+ SubRun(GrTextBlob* textBlob, const SkStrikeSpec& strikeSpec);
+
+ void appendGlyphs(const SkZip<SkGlyphVariant, SkPoint>& drawables);
+
+ // TODO when this object is more internal, drop the privacy
+ void resetBulkUseToken();
+ GrDrawOpAtlas::BulkUseTokenUpdater* bulkUseToken();
+ void setStrike(sk_sp<GrTextStrike> strike);
+ GrTextStrike* strike() const;
+ sk_sp<GrTextStrike> refStrike() const;
+
+ void setAtlasGeneration(uint64_t atlasGeneration);
+ uint64_t atlasGeneration() const;
+
+ size_t vertexStartIndex() const;
+ uint32_t glyphCount() const;
+ uint32_t glyphStartIndex() const;
+
+ void setColor(GrColor color);
+ GrColor color() const;
+
+ GrMaskFormat maskFormat() const;
+
+ const SkRect& vertexBounds() const;
+ void joinGlyphBounds(const SkRect& glyphBounds);
+
+ void init(const SkMatrix& viewMatrix, SkScalar x, SkScalar y);
+
+ // This function assumes the translation will be applied before it is called again
+ void computeTranslation(const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
+ SkScalar* transX, SkScalar* transY);
+
+ bool drawAsDistanceFields() const;
+ bool drawAsPaths() const;
+ bool needsTransform() const;
+ bool hasW() const;
+
+ // df properties
+ void setUseLCDText(bool useLCDText);
+ bool hasUseLCDText() const;
+ void setAntiAliased(bool antiAliased);
+ bool isAntiAliased() const;
+
+ const SkStrikeSpec& strikeSpec() const;
+
+ SubRun* fNextSubRun{nullptr};
+ const SubRunType fType;
+ GrTextBlob* const fBlob;
+ const GrMaskFormat fMaskFormat;
+ const uint32_t fGlyphStartIndex;
+ const uint32_t fGlyphEndIndex;
+ const size_t fVertexStartIndex;
+ const size_t fVertexEndIndex;
+ const SkStrikeSpec fStrikeSpec;
+ sk_sp<GrTextStrike> fStrike;
+ struct {
+ bool useLCDText:1;
+ bool antiAliased:1;
+ } fFlags{false, false};
+ GrColor fColor;
+ GrDrawOpAtlas::BulkUseTokenUpdater fBulkUseToken;
+ SkRect fVertexBounds = SkRectPriv::MakeLargestInverted();
+ uint64_t fAtlasGeneration{GrDrawOpAtlas::kInvalidAtlasGeneration};
+ SkScalar fX;
+ SkScalar fY;
+ SkMatrix fCurrentViewMatrix;
+ std::vector<PathGlyph> fPaths;
+}; // SubRun
+
GrTextBlob::SubRun::SubRun(SubRunType type, GrTextBlob* textBlob, const SkStrikeSpec& strikeSpec,
GrMaskFormat format, const GrTextBlob::SubRunBufferSpec& bufferSpec,
sk_sp<GrTextStrike>&& grStrike)
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 6d98bdb..dd70cff 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -80,88 +80,6 @@
SkPoint fOrigin;
};
- // Hold data to draw the different types of sub run. SubRuns are produced knowing all the
- // glyphs that are included in them.
- class SubRun {
- public:
- // SubRun for masks
- SubRun(SubRunType type,
- GrTextBlob* textBlob,
- const SkStrikeSpec& strikeSpec,
- GrMaskFormat format,
- const SubRunBufferSpec& bufferSpec,
- sk_sp<GrTextStrike>&& grStrike);
-
- // SubRun for paths
- SubRun(GrTextBlob* textBlob, const SkStrikeSpec& strikeSpec);
-
- void appendGlyphs(const SkZip<SkGlyphVariant, SkPoint>& drawables);
-
- // TODO when this object is more internal, drop the privacy
- void resetBulkUseToken();
- GrDrawOpAtlas::BulkUseTokenUpdater* bulkUseToken();
- void setStrike(sk_sp<GrTextStrike> strike);
- GrTextStrike* strike() const;
- sk_sp<GrTextStrike> refStrike() const;
-
- void setAtlasGeneration(uint64_t atlasGeneration);
- uint64_t atlasGeneration() const;
-
- size_t vertexStartIndex() const;
- uint32_t glyphCount() const;
- uint32_t glyphStartIndex() const;
-
- void setColor(GrColor color);
- GrColor color() const;
-
- GrMaskFormat maskFormat() const;
-
- const SkRect& vertexBounds() const;
- void joinGlyphBounds(const SkRect& glyphBounds);
-
- void init(const SkMatrix& viewMatrix, SkScalar x, SkScalar y);
-
- // This function assumes the translation will be applied before it is called again
- void computeTranslation(const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
- SkScalar* transX, SkScalar* transY);
-
- bool drawAsDistanceFields() const;
- bool drawAsPaths() const;
- bool needsTransform() const;
- bool hasW() const;
-
- // df properties
- void setUseLCDText(bool useLCDText);
- bool hasUseLCDText() const;
- void setAntiAliased(bool antiAliased);
- bool isAntiAliased() const;
-
- const SkStrikeSpec& strikeSpec() const;
-
- SubRun* fNextSubRun{nullptr};
- const SubRunType fType;
- GrTextBlob* const fBlob;
- const GrMaskFormat fMaskFormat;
- const uint32_t fGlyphStartIndex;
- const uint32_t fGlyphEndIndex;
- const size_t fVertexStartIndex;
- const size_t fVertexEndIndex;
- const SkStrikeSpec fStrikeSpec;
- sk_sp<GrTextStrike> fStrike;
- struct {
- bool useLCDText:1;
- bool antiAliased:1;
- } fFlags{false, false};
- GrColor fColor;
- GrDrawOpAtlas::BulkUseTokenUpdater fBulkUseToken;
- SkRect fVertexBounds = SkRectPriv::MakeLargestInverted();
- uint64_t fAtlasGeneration{GrDrawOpAtlas::kInvalidAtlasGeneration};
- SkScalar fX;
- SkScalar fY;
- SkMatrix fCurrentViewMatrix;
- std::vector<PathGlyph> fPaths;
- }; // SubRun
-
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrTextBlob);
// Change memory management to handle the data after GrTextBlob, but in the same allocation