Make GrFontScaler not be ref-counted
This object is made invalid when the SkGlyphCache that it points to is destroyed. BUG=chromium:608566 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1982303002 Review-Url: https://codereview.chromium.org/1982303002
This commit is contained in:
parent
835acc7619
commit
4bb7ce7b3d
@ -43,10 +43,10 @@ private:
|
||||
* The client is responsible for instantiating this. The instance is created
|
||||
* for a specific font+size+matrix.
|
||||
*/
|
||||
class GrFontScaler : public SkRefCnt {
|
||||
class GrFontScaler final : public SkNoncopyable {
|
||||
public:
|
||||
explicit GrFontScaler(SkGlyphCache* strike);
|
||||
virtual ~GrFontScaler();
|
||||
~GrFontScaler();
|
||||
|
||||
const GrFontDescKey* getKey();
|
||||
GrMaskFormat getMaskFormat() const;
|
||||
@ -60,10 +60,12 @@ public:
|
||||
const SkGlyph& grToSkGlyph(GrGlyph::PackedID);
|
||||
|
||||
private:
|
||||
// The SkGlyphCache actually owns this GrFontScaler. The GrFontScaler is deleted when the
|
||||
// SkGlyphCache is deleted.
|
||||
SkGlyphCache* fStrike;
|
||||
GrFontDescKey* fKey;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
typedef SkNoncopyable INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -572,7 +572,7 @@ uint32_t GrTextUtils::FilterTextFlags(const SkSurfaceProps& surfaceProps, const
|
||||
|
||||
static void glyph_cache_aux_proc(void* data) {
|
||||
GrFontScaler* scaler = (GrFontScaler*)data;
|
||||
SkSafeUnref(scaler);
|
||||
delete scaler;
|
||||
}
|
||||
|
||||
GrFontScaler* GrTextUtils::GetGrFontScaler(SkGlyphCache* cache) {
|
||||
|
Loading…
Reference in New Issue
Block a user