diff options
author | Herb Derby <herb@google.com> | 2019-01-22 14:45:16 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2019-01-23 18:52:09 +0000 |
commit | 087fad7900d21ac938b7628051fcd48e2b4f538b (patch) | |
tree | 02f22f29711c8b2f3f77538994c9040c5409c9d3 /include | |
parent | 08b0b7fd5bd5c2b6ab746246167b1f0f446c9830 (diff) | |
download | skqp-087fad7900d21ac938b7628051fcd48e2b4f538b.tar.gz |
Add getTypefaceOrDefault and refTypefaceOrDefault
* Remove GetTypefaceOrDefault from SkPaint and SkFont
* Remove RefTypefaceOrDefault from SkPaint and SkFont
Change-Id: I04ae777142c2bdec849508b611b844418bbaedff
Reviewed-on: https://skia-review.googlesource.com/c/185781
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkFont.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/core/SkFont.h b/include/core/SkFont.h index ec445abda9..61f7463f0a 100644 --- a/include/core/SkFont.h +++ b/include/core/SkFont.h @@ -188,7 +188,15 @@ public: @return SkTypeface if previously set, nullptr otherwise */ - SkTypeface* getTypeface() const { return fTypeface.get(); } + SkTypeface* getTypeface() const {return fTypeface.get(); } + + /** Returns SkTypeface if set, or the default typeface. + Does not alter SkTypeface SkRefCnt. + + @return SkTypeface if previously set or, a pointer to the default typeface if not + previously set. + */ + SkTypeface* getTypefaceOrDefault() const; /** Returns text size in points. @@ -216,6 +224,13 @@ public: */ sk_sp<SkTypeface> refTypeface() const { return fTypeface; } + /** Increases SkTypeface SkRefCnt by one. + + @return SkTypeface if previously set or, a pointer to the default typeface if not + previously set. + */ + sk_sp<SkTypeface> refTypefaceOrDefault() const; + /** Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface. Pass nullptr to clear SkTypeface and use the default typeface. Increments tf SkRefCnt by one. |