generalize text geometry back pointer
This change allows types other than GrTextBlob to use the geometry's lifetime to manage refs. Change-Id: Iacb726cd4d097c87df146e119c476c014d4df99e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471616 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
25deba3516
commit
c1bbd1f190
@ -44,14 +44,14 @@ public:
|
||||
GrAtlasSubRunOwner subRunOwner,
|
||||
const SkPMColor4f& color)
|
||||
: fSubRun{subRun}
|
||||
, fBlob{std::move(blob)}
|
||||
, fSupportDataKeepAlive{std::move(blob)}
|
||||
, fSubRunDtor{std::move(subRunOwner)}
|
||||
, fDrawMatrix{drawMatrix}
|
||||
, fDrawOrigin{drawOrigin}
|
||||
, fClipRect{clipRect}
|
||||
, fColor{color} {
|
||||
SkASSERT(fBlob != nullptr || fSubRunDtor != nullptr);
|
||||
SkASSERT(SkToBool(fSubRunDtor) != SkToBool(fBlob));
|
||||
SkASSERT(fSupportDataKeepAlive != nullptr || fSubRunDtor != nullptr);
|
||||
SkASSERT(SkToBool(fSubRunDtor) != SkToBool(fSupportDataKeepAlive));
|
||||
}
|
||||
|
||||
static Geometry* MakeForBlob(const GrAtlasSubRun& subRun,
|
||||
@ -66,10 +66,10 @@ public:
|
||||
|
||||
const GrAtlasSubRun& fSubRun;
|
||||
|
||||
// Either this Geometry holds a ref to the GrTextBlob in the case of a text blob based
|
||||
// Either this Geometry holds a ref to the support data in the case of a blob based
|
||||
// SubRun (WithCaching case), or it holds a unique_ptr to a SubRun allocated on the
|
||||
// GrTextBlobAllocator in the NoCache case. It must hold one, and can't hold both.
|
||||
sk_sp<GrTextBlob> fBlob; // mutable to make unref call in Op dtor.
|
||||
sk_sp<SkRefCnt> fSupportDataKeepAlive;
|
||||
GrAtlasSubRunOwner fSubRunDtor;
|
||||
|
||||
const SkMatrix fDrawMatrix;
|
||||
|
@ -178,7 +178,7 @@ struct GrSubRunList {
|
||||
// with.
|
||||
//
|
||||
//
|
||||
class GrTextBlob final : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterface {
|
||||
class GrTextBlob final : public SkRefCnt, 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
|
||||
|
Loading…
Reference in New Issue
Block a user