aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-05-03 15:48:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-04 14:51:03 +0000
commit342a9fa8e1c0bccff0d2d1569042bce29f2bbe85 (patch)
tree86847274a2792d9135a0461981800318609163c9 /src
parent060d9820364b0cf09c7eb3bda449f24c3dcba2e2 (diff)
add virtual to support CTFontRef
Bug: skia:6583 Change-Id: I8525e63d3f43467289360d4b15c0153d2a43539e Reviewed-on: https://skia-review.googlesource.com/15194 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkFontHost_mac.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 4774eab87f..a43cf22c98 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -62,6 +62,10 @@
// Set to make glyph bounding boxes visible.
#define SK_SHOW_TEXT_BLIT_COVERAGE 0
+CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) {
+ return face ? (CTFontRef)face->internal_private_getCTFontRef() : nullptr;
+}
+
class SkScalerContext_Mac;
struct CFSafeRelease {
@@ -528,6 +532,8 @@ protected:
uint16_t glyphs[], int glyphCount) const override;
int onCountGlyphs() const override;
+ void* onGetCTFontRef() const override { return (void*)fFontRef.get(); }
+
private:
bool fIsLocalStream;
@@ -536,7 +542,7 @@ private:
static bool find_by_CTFontRef(SkTypeface* cached, void* context) {
CTFontRef self = (CTFontRef)context;
- CTFontRef other = ((SkTypeface_Mac*)cached)->fFontRef.get();
+ CTFontRef other = (CTFontRef)cached->internal_private_getCTFontRef();
return CFEqual(self, other);
}
@@ -653,12 +659,6 @@ static SkTypeface* create_from_name(const char familyName[], const SkFontStyle&
///////////////////////////////////////////////////////////////////////////////
-extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face);
-CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face) {
- const SkTypeface_Mac* macface = (const SkTypeface_Mac*)face;
- return macface ? macface->fFontRef.get() : nullptr;
-}
-
/* This function is visible on the outside. It first searches the cache, and if
* not found, returns a new entry (after adding it to the cache).
*/
@@ -779,7 +779,7 @@ SkScalerContext_Mac::SkScalerContext_Mac(sk_sp<SkTypeface_Mac> typeface,
{
AUTO_CG_LOCK();
- CTFontRef ctFont = static_cast<SkTypeface_Mac*>(this->getTypeface())->fFontRef.get();
+ CTFontRef ctFont = (CTFontRef)this->getTypeface()->internal_private_getCTFontRef();
CFIndex numGlyphs = CTFontGetGlyphCount(ctFont);
SkASSERT(numGlyphs >= 1 && numGlyphs <= 0xFFFF);
fGlyphCount = SkToU16(numGlyphs);