Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: src/fonts/SkFontMgr_fontconfig.cpp

Issue 134643028: Make SkFontMgr interface const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dw fixes Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkFontHost.cpp ('k') | src/ports/SkFontHost_linux.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/fonts/SkFontMgr_fontconfig.cpp
diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp
index a0ca7e4f3332018637fca032f2b12e2410af28be..bd4c8ddc1db2a275b51c4d0b586efadcbf183b0d 100644
--- a/src/fonts/SkFontMgr_fontconfig.cpp
+++ b/src/fonts/SkFontMgr_fontconfig.cpp
@@ -184,40 +184,30 @@ class SkFontMgr_fontconfig : public SkFontMgr {
SkAutoTUnref<SkFontConfigInterface> fFCI;
SkDataTable* fFamilyNames;
- void init() {
- if (!fFamilyNames) {
- fFamilyNames = fFCI->getFamilyNames();
- }
- }
public:
SkFontMgr_fontconfig(SkFontConfigInterface* fci)
: fFCI(fci)
- , fFamilyNames(NULL) {}
+ , fFamilyNames(fFCI->getFamilyNames()) {}
virtual ~SkFontMgr_fontconfig() {
SkSafeUnref(fFamilyNames);
}
protected:
- virtual int onCountFamilies() {
- this->init();
+ virtual int onCountFamilies() const SK_OVERRIDE {
return fFamilyNames->count();
}
- virtual void onGetFamilyName(int index, SkString* familyName) {
- this->init();
+ virtual void onGetFamilyName(int index, SkString* familyName) const SK_OVERRIDE {
familyName->set(fFamilyNames->atStr(index));
}
- virtual SkFontStyleSet* onCreateStyleSet(int index) {
- this->init();
+ virtual SkFontStyleSet* onCreateStyleSet(int index) const SK_OVERRIDE {
return this->onMatchFamily(fFamilyNames->atStr(index));
}
- virtual SkFontStyleSet* onMatchFamily(const char familyName[]) {
- this->init();
-
+ virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const SK_OVERRIDE {
FcPattern* pattern = FcPatternCreate();
FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
@@ -261,13 +251,13 @@ protected:
}
virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
- const SkFontStyle&) { return NULL; }
+ const SkFontStyle&) const SK_OVERRIDE { return NULL; }
virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
- const SkFontStyle&) { return NULL; }
+ const SkFontStyle&) const SK_OVERRIDE { return NULL; }
- virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) { return NULL; }
+ virtual SkTypeface* onCreateFromData(SkData*, int ttcIndex) const SK_OVERRIDE { return NULL; }
- virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) {
+ virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
const size_t length = stream->getLength();
if (!length) {
return NULL;
@@ -287,13 +277,13 @@ protected:
return face;
}
- virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) {
+ virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERRIDE {
SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
return stream.get() ? this->createFromStream(stream, ttcIndex) : NULL;
}
virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
- unsigned styleBits) SK_OVERRIDE {
+ unsigned styleBits) const SK_OVERRIDE {
return FontConfigTypeface::LegacyCreateTypeface(NULL, familyName,
(SkTypeface::Style)styleBits);
}
« no previous file with comments | « src/core/SkFontHost.cpp ('k') | src/ports/SkFontHost_linux.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698