From 0389d93314ed8f706ba7adc4969110712b67416b Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 7 May 2012 21:06:55 +0000 Subject: [PATCH] remove unused ptr/len parameters from CreateTypeface Review URL: https://codereview.appspot.com/6201056 git-svn-id: http://skia.googlecode.com/svn/trunk@3862 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkFontHost.h | 4 +--- include/core/SkTypeface.h | 12 ------------ src/core/SkTypeface.cpp | 12 +++--------- src/ports/SkFontHost_FONTPATH.cpp | 1 - src/ports/SkFontHost_android.cpp | 3 +-- src/ports/SkFontHost_fontconfig.cpp | 1 - src/ports/SkFontHost_freetype_mac.cpp | 1 - src/ports/SkFontHost_linux.cpp | 5 ++--- src/ports/SkFontHost_mac_atsui.cpp | 1 - src/ports/SkFontHost_mac_coretext.cpp | 1 - src/ports/SkFontHost_none.cpp | 1 - src/ports/SkFontHost_simple.cpp | 3 +-- src/ports/SkFontHost_win.cpp | 1 - 13 files changed, 8 insertions(+), 38 deletions(-) diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h index 7015ee992..732de5c3c 100644 --- a/include/core/SkFontHost.h +++ b/include/core/SkFontHost.h @@ -50,15 +50,13 @@ class SK_API SkFontHost { public: /** Return a new, closest matching typeface given either an existing family (specified by a typeface in that family) or by a familyName and a - requested style, or by a set of Unicode codepoitns to cover in a given - style. + requested style. 1) If familyFace is null, use familyName. 2) If familyName is null, use data (UTF-16 to cover). 3) If all are null, return the default font that best matches style */ static SkTypeface* CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style); /** Return a new typeface given the data buffer. If the data does not diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 0476f780a..bfa7d839e 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -85,18 +85,6 @@ public: */ static SkTypeface* CreateFromName(const char familyName[], Style style); - /** Return a new reference to the typeface that covers a set of Unicode - code points with the specified Style. Use this call if you want to - pick any font that covers a given string of text. - - @param data UTF-16 characters - @param bytelength length of data, in bytes - @return reference to the closest-matching typeface. Call must call - unref() when they are done. - */ - static SkTypeface* CreateForChars(const void* data, size_t bytelength, - Style s); - /** Return a new reference to the typeface that most closely matches the requested typeface and specified Style. Use this call if you want to pick a new style from the same family of the existing typeface. diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 798099cad..77ad9ce8f 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -42,8 +42,7 @@ static SkTypeface* get_default_typeface() { if (NULL == gDefaultTypeface) { gDefaultTypeface = - SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, - SkTypeface::kNormal); + SkFontHost::CreateTypeface(NULL, NULL, SkTypeface::kNormal); } return gDefaultTypeface; } @@ -62,16 +61,11 @@ bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) { /////////////////////////////////////////////////////////////////////////////// SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) { - return SkFontHost::CreateTypeface(NULL, name, NULL, 0, style); -} - -SkTypeface* SkTypeface::CreateForChars(const void* data, size_t bytelength, - Style s) { - return SkFontHost::CreateTypeface(NULL, NULL, data, bytelength, s); + return SkFontHost::CreateTypeface(NULL, name, style); } SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) { - return SkFontHost::CreateTypeface(family, NULL, NULL, 0, s); + return SkFontHost::CreateTypeface(family, NULL, s); } SkTypeface* SkTypeface::CreateFromStream(SkStream* stream) { diff --git a/src/ports/SkFontHost_FONTPATH.cpp b/src/ports/SkFontHost_FONTPATH.cpp index ba1c823ad..04e49345f 100644 --- a/src/ports/SkFontHost_FONTPATH.cpp +++ b/src/ports/SkFontHost_FONTPATH.cpp @@ -233,7 +233,6 @@ static uint32_t ptr2uint32(const void* p) SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { const FontFamilyRec* family; diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp index 6ee99438e..df240ab44 100644 --- a/src/ports/SkFontHost_android.cpp +++ b/src/ports/SkFontHost_android.cpp @@ -813,7 +813,7 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { for (int j = i; j >= 0; --j) { if (rec[j].fNames != NULL) { return SkFontHost::CreateTypeface(NULL, - rec[j].fNames[0], NULL, 0, + rec[j].fNames[0], (SkTypeface::Style)style); } } @@ -828,7 +828,6 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { SkAutoMutexAcquire ac(gFamilyHeadAndNameListMutex); diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 775a7c7b1..e028a012a 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -208,7 +208,6 @@ static unsigned FileIdFromFilename(const char* filename) // static SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { const char* resolved_family_name = NULL; diff --git a/src/ports/SkFontHost_freetype_mac.cpp b/src/ports/SkFontHost_freetype_mac.cpp index e51f802e9..8b1272aef 100644 --- a/src/ports/SkFontHost_freetype_mac.cpp +++ b/src/ports/SkFontHost_freetype_mac.cpp @@ -51,7 +51,6 @@ static SkTypeface* ref_default_typeface() { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { return ref_default_typeface(); } diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp index be99576dc..805dc2202 100644 --- a/src/ports/SkFontHost_linux.cpp +++ b/src/ports/SkFontHost_linux.cpp @@ -500,14 +500,14 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { // backup until we hit the fNames for (int j = i; j >= 0; --j) { if (rec[j].fNames != NULL) { - return SkFontHost::CreateTypeface(NULL, rec[j].fNames[0], NULL, 0, + return SkFontHost::CreateTypeface(NULL, rec[j].fNames[0], (SkTypeface::Style)style); } } } } } - return SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, (SkTypeface::Style)style); + return SkFontHost::CreateTypeface(NULL, NULL, (SkTypeface::Style)style); #endif sk_throw(); return NULL; @@ -517,7 +517,6 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { load_system_fonts(); diff --git a/src/ports/SkFontHost_mac_atsui.cpp b/src/ports/SkFontHost_mac_atsui.cpp index ae3203668..f8251ab0b 100644 --- a/src/ports/SkFontHost_mac_atsui.cpp +++ b/src/ports/SkFontHost_mac_atsui.cpp @@ -494,7 +494,6 @@ SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { // todo: we don't know how to respect style bits if (NULL == familyName && NULL != familyFace) { diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp index 1e308e487..c43d1a654 100644 --- a/src/ports/SkFontHost_mac_coretext.cpp +++ b/src/ports/SkFontHost_mac_coretext.cpp @@ -526,7 +526,6 @@ static const char* map_css_names(const char* name) { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { if (familyName) { familyName = map_css_names(familyName); diff --git a/src/ports/SkFontHost_none.cpp b/src/ports/SkFontHost_none.cpp index cea7e901d..5bee4d6d7 100644 --- a/src/ports/SkFontHost_none.cpp +++ b/src/ports/SkFontHost_none.cpp @@ -11,7 +11,6 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char famillyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { SkDEBUGFAIL("SkFontHost::FindTypeface unimplemented"); return NULL; diff --git a/src/ports/SkFontHost_simple.cpp b/src/ports/SkFontHost_simple.cpp index 733b0cc68..ac3c713fd 100644 --- a/src/ports/SkFontHost_simple.cpp +++ b/src/ports/SkFontHost_simple.cpp @@ -519,7 +519,7 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { for (int j = i; j >= 0; --j) { if (rec[j].fNames != NULL) { return SkFontHost::CreateTypeface(NULL, - rec[j].fNames[0], NULL, 0, (SkTypeface::Style)style); + rec[j].fNames[0], (SkTypeface::Style)style); } } } @@ -532,7 +532,6 @@ SkTypeface* SkFontHost::Deserialize(SkStream* stream) { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { load_system_fonts(); diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 21a2d3cc7..20c54a3c8 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -1350,7 +1350,6 @@ SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc) { SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], - const void* data, size_t bytelength, SkTypeface::Style style) { LOGFONT lf; if (NULL == familyFace && NULL == familyName) {