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

Side by Side Diff: src/ports/SkFontMgr_win_dw.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/ports/SkFontMgr_fontconfig.cpp ('k') | src/ports/SkImageDecoder_WIC.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDWrite.h" 8 #include "SkDWrite.h"
9 #include "SkDWriteFontFileStream.h" 9 #include "SkDWriteFontFileStream.h"
10 #include "SkFontMgr.h" 10 #include "SkFontMgr.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 SkFontMgr_DirectWrite(IDWriteFactory* factory, IDWriteFontCollection* fontCo llection, 257 SkFontMgr_DirectWrite(IDWriteFactory* factory, IDWriteFontCollection* fontCo llection,
258 WCHAR* localeName, int localeNameLength) 258 WCHAR* localeName, int localeNameLength)
259 : fFactory(SkRefComPtr(factory)) 259 : fFactory(SkRefComPtr(factory))
260 , fFontCollection(SkRefComPtr(fontCollection)) 260 , fFontCollection(SkRefComPtr(fontCollection))
261 , fLocaleName(localeNameLength) 261 , fLocaleName(localeNameLength)
262 { 262 {
263 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); 263 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR));
264 } 264 }
265 265
266 protected: 266 protected:
267 virtual int onCountFamilies() const SK_OVERRIDE; 267 int onCountFamilies() const SK_OVERRIDE;
268 virtual void onGetFamilyName(int index, SkString* familyName) const SK_OVERR IDE; 268 void onGetFamilyName(int index, SkString* familyName) const SK_OVERRIDE;
269 virtual SkFontStyleSet* onCreateStyleSet(int index) const SK_OVERRIDE; 269 SkFontStyleSet* onCreateStyleSet(int index) const SK_OVERRIDE;
270 virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const SK_OVER RIDE; 270 SkFontStyleSet* onMatchFamily(const char familyName[]) const SK_OVERRIDE;
271 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], 271 virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
272 const SkFontStyle& fontstyle) const S K_OVERRIDE; 272 const SkFontStyle& fontstyle) const S K_OVERRIDE;
273 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&, 273 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&,
274 const char* bcp47[], int bcp 47Count, 274 const char* bcp47[], int bcp 47Count,
275 SkUnichar character) const S K_OVERRIDE; 275 SkUnichar character) const S K_OVERRIDE;
276 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember, 276 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
277 const SkFontStyle& fontstyle) const SK_ OVERRIDE; 277 const SkFontStyle& fontstyle) const SK_ OVERRIDE;
278 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE; 278 SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVER RIDE;
279 virtual SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OV ERRIDE; 279 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OVERRIDE;
280 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERRIDE; 280 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERR IDE;
281 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 281 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
282 unsigned styleBits) const SK_OVER RIDE; 282 unsigned styleBits) const SK_OVER RIDE;
283 283
284 private: 284 private:
285 HRESULT getByFamilyName(const WCHAR familyName[], IDWriteFontFamily** fontFa mily) const; 285 HRESULT getByFamilyName(const WCHAR familyName[], IDWriteFontFamily** fontFa mily) const;
286 HRESULT getDefaultFontFamily(IDWriteFontFamily** fontFamily) const; 286 HRESULT getDefaultFontFamily(IDWriteFontFamily** fontFamily) const;
287 287
288 /** Creates a typeface using a typeface cache. */ 288 /** Creates a typeface using a typeface cache. */
289 SkTypeface* createTypefaceFromDWriteFont(IDWriteFontFace* fontFace, 289 SkTypeface* createTypefaceFromDWriteFont(IDWriteFontFace* fontFace,
290 IDWriteFont* font, 290 IDWriteFont* font,
291 IDWriteFontFamily* fontFamily) cons t; 291 IDWriteFontFamily* fontFamily) cons t;
292 292
293 SkTScopedComPtr<IDWriteFactory> fFactory; 293 SkTScopedComPtr<IDWriteFactory> fFactory;
294 SkTScopedComPtr<IDWriteFontCollection> fFontCollection; 294 SkTScopedComPtr<IDWriteFontCollection> fFontCollection;
295 SkSMallocWCHAR fLocaleName; 295 SkSMallocWCHAR fLocaleName;
296 mutable SkMutex fTFCacheMutex; 296 mutable SkMutex fTFCacheMutex;
297 mutable SkTypefaceCache fTFCache; 297 mutable SkTypefaceCache fTFCache;
298 298
299 friend class SkFontStyleSet_DirectWrite; 299 friend class SkFontStyleSet_DirectWrite;
300 }; 300 };
301 301
302 class SkFontStyleSet_DirectWrite : public SkFontStyleSet { 302 class SkFontStyleSet_DirectWrite : public SkFontStyleSet {
303 public: 303 public:
304 SkFontStyleSet_DirectWrite(const SkFontMgr_DirectWrite* fontMgr, 304 SkFontStyleSet_DirectWrite(const SkFontMgr_DirectWrite* fontMgr,
305 IDWriteFontFamily* fontFamily) 305 IDWriteFontFamily* fontFamily)
306 : fFontMgr(SkRef(fontMgr)) 306 : fFontMgr(SkRef(fontMgr))
307 , fFontFamily(SkRefComPtr(fontFamily)) 307 , fFontFamily(SkRefComPtr(fontFamily))
308 { } 308 { }
309 309
310 virtual int count() SK_OVERRIDE; 310 int count() SK_OVERRIDE;
311 virtual void getStyle(int index, SkFontStyle* fs, SkString* styleName) SK_OV ERRIDE; 311 void getStyle(int index, SkFontStyle* fs, SkString* styleName) SK_OVERRIDE;
312 virtual SkTypeface* createTypeface(int index) SK_OVERRIDE; 312 SkTypeface* createTypeface(int index) SK_OVERRIDE;
313 virtual SkTypeface* matchStyle(const SkFontStyle& pattern) SK_OVERRIDE; 313 SkTypeface* matchStyle(const SkFontStyle& pattern) SK_OVERRIDE;
314 314
315 private: 315 private:
316 SkAutoTUnref<const SkFontMgr_DirectWrite> fFontMgr; 316 SkAutoTUnref<const SkFontMgr_DirectWrite> fFontMgr;
317 SkTScopedComPtr<IDWriteFontFamily> fFontFamily; 317 SkTScopedComPtr<IDWriteFontFamily> fFontFamily;
318 }; 318 };
319 319
320 static HRESULT are_same(IUnknown* a, IUnknown* b, bool& same) { 320 static HRESULT are_same(IUnknown* a, IUnknown* b, bool& same) {
321 SkTScopedComPtr<IUnknown> iunkA; 321 SkTScopedComPtr<IUnknown> iunkA;
322 HRM(a->QueryInterface(&iunkA), "Failed to QI<IUnknown> for a."); 322 HRM(a->QueryInterface(&iunkA), "Failed to QI<IUnknown> for a.");
323 323
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 } 765 }
766 766
767 #include "SkFontMgr_indirect.h" 767 #include "SkFontMgr_indirect.h"
768 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { 768 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) {
769 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); 769 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite());
770 if (impl.get() == NULL) { 770 if (impl.get() == NULL) {
771 return NULL; 771 return NULL;
772 } 772 }
773 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); 773 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy));
774 } 774 }
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_fontconfig.cpp ('k') | src/ports/SkImageDecoder_WIC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698