add SubRunType for each SubRun to facilitate deserialization
Change-Id: I058eb13d4efc20197d81f15d2261906950d6e92e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509397 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
10241484aa
commit
0ec59b90ab
@ -50,6 +50,16 @@ using AtlasTextOp = skgpu::v1::AtlasTextOp;
|
||||
// Note:
|
||||
// In order to use GrSlugs, you need to set the fSupportBilerpFromGlyphAtlas on GrContextOptions.
|
||||
|
||||
enum GrSubRun::SubRunType : int {
|
||||
kBad = 0, // Make this 0 to line up with errors from readInt.
|
||||
kDirectMask,
|
||||
kSDFT,
|
||||
kTransformMask,
|
||||
kPath,
|
||||
kDrawable,
|
||||
kSubRunTypeCount,
|
||||
};
|
||||
|
||||
// -- GrBlobSubRun ---------------------------------------------------------------------------------
|
||||
class GrBlobSubRun {
|
||||
public:
|
||||
@ -509,6 +519,9 @@ public:
|
||||
}
|
||||
const GrAtlasSubRun* testingOnly_atlasSubRun() const override { return nullptr; }
|
||||
|
||||
protected:
|
||||
SubRunType subRunType() const override { return kPath; }
|
||||
|
||||
private:
|
||||
PathOpSubmitter fPathDrawing;
|
||||
};
|
||||
@ -636,6 +649,9 @@ public:
|
||||
|
||||
int unflattenSize() const override { return 0; }
|
||||
|
||||
protected:
|
||||
SubRunType subRunType() const override { return kDrawable; }
|
||||
|
||||
private:
|
||||
DrawableOpSubmitter fDrawingDrawing;
|
||||
};
|
||||
@ -707,6 +723,10 @@ public:
|
||||
GrColor color,
|
||||
const SkMatrix& drawMatrix, SkPoint drawOrigin,
|
||||
SkIRect clip) const override;
|
||||
|
||||
protected:
|
||||
SubRunType subRunType() const override { return kDirectMask; }
|
||||
|
||||
private:
|
||||
// The rectangle that surrounds all the glyph bounding boxes in device space.
|
||||
SkRect deviceRect(const SkMatrix& drawMatrix, SkPoint drawOrigin) const;
|
||||
@ -1113,6 +1133,9 @@ public:
|
||||
size_t vertexStride(const SkMatrix& drawMatrix) const override;
|
||||
int glyphCount() const override;
|
||||
|
||||
protected:
|
||||
SubRunType subRunType() const override { return kTransformMask; }
|
||||
|
||||
private:
|
||||
// The rectangle that surrounds all the glyph bounding boxes in device space.
|
||||
SkRect deviceRect(const SkMatrix& drawMatrix, SkPoint drawOrigin) const;
|
||||
@ -1324,6 +1347,9 @@ public:
|
||||
size_t vertexStride(const SkMatrix& drawMatrix) const override;
|
||||
int glyphCount() const override;
|
||||
|
||||
protected:
|
||||
SubRunType subRunType() const override { return kSDFT; }
|
||||
|
||||
private:
|
||||
// The rectangle that surrounds all the glyph bounding boxes in device space.
|
||||
SkRect deviceRect(const SkMatrix& drawMatrix, SkPoint drawOrigin) const;
|
||||
@ -2725,6 +2751,9 @@ public:
|
||||
const SkMatrix& drawMatrix, SkPoint drawOrigin,
|
||||
SkIRect clip) const override;
|
||||
|
||||
protected:
|
||||
SubRunType subRunType() const override { return kDirectMask; }
|
||||
|
||||
private:
|
||||
// Return true if the positionMatrix represents an integer translation. Return the device
|
||||
// bounding box of all the glyphs. If the bounding box is empty, then something went singular
|
||||
|
@ -38,7 +38,7 @@ class SkSurfaceProps;
|
||||
class SkTextBlob;
|
||||
class SkTextBlobRunIterator;
|
||||
|
||||
namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
|
||||
namespace skgpu::v1 { class SurfaceDrawContext; }
|
||||
|
||||
// -- GrAtlasSubRun --------------------------------------------------------------------------------
|
||||
// GrAtlasSubRun is the API that AtlasTextOp uses to generate vertex data for drawing.
|
||||
@ -110,6 +110,10 @@ public:
|
||||
// of the slug. If it's off then there may be more allocations needed to unflatten.
|
||||
virtual int unflattenSize() const = 0;
|
||||
|
||||
protected:
|
||||
enum SubRunType : int;
|
||||
virtual SubRunType subRunType() const = 0;
|
||||
|
||||
private:
|
||||
friend class GrSubRunList;
|
||||
GrSubRunOwner fNext;
|
||||
@ -172,7 +176,6 @@ private:
|
||||
//
|
||||
class GrTextBlob final : public GrTextReferenceFrame, public SkGlyphRunPainterInterface {
|
||||
public:
|
||||
|
||||
// Key is not used as part of a hash map, so the hash is never taken. It's only used in a
|
||||
// list search using operator =().
|
||||
struct Key {
|
||||
|
Loading…
Reference in New Issue
Block a user