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

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

Issue 1879423002: Remove requestedStyle from SkTypefaceCache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More interesting coverage. Created 4 years, 8 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') | tests/TypefaceTest.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 "SkTypes.h" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 10
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 same = (iunkA.get() == iunkB.get()); 346 same = (iunkA.get() == iunkB.get());
347 return S_OK; 347 return S_OK;
348 } 348 }
349 349
350 struct ProtoDWriteTypeface { 350 struct ProtoDWriteTypeface {
351 IDWriteFontFace* fDWriteFontFace; 351 IDWriteFontFace* fDWriteFontFace;
352 IDWriteFont* fDWriteFont; 352 IDWriteFont* fDWriteFont;
353 IDWriteFontFamily* fDWriteFontFamily; 353 IDWriteFontFamily* fDWriteFontFamily;
354 }; 354 };
355 355
356 static bool FindByDWriteFont(SkTypeface* cached, const SkFontStyle&, void* ctx) { 356 static bool FindByDWriteFont(SkTypeface* cached, void* ctx) {
357 DWriteFontTypeface* cshFace = reinterpret_cast<DWriteFontTypeface*>(cached); 357 DWriteFontTypeface* cshFace = reinterpret_cast<DWriteFontTypeface*>(cached);
358 ProtoDWriteTypeface* ctxFace = reinterpret_cast<ProtoDWriteTypeface*>(ctx); 358 ProtoDWriteTypeface* ctxFace = reinterpret_cast<ProtoDWriteTypeface*>(ctx);
359 bool same; 359 bool same;
360 360
361 //Check to see if the two fonts are identical. 361 //Check to see if the two fonts are identical.
362 HRB(are_same(cshFace->fDWriteFont.get(), ctxFace->fDWriteFont, same)); 362 HRB(are_same(cshFace->fDWriteFont.get(), ctxFace->fDWriteFont, same));
363 if (same) { 363 if (same) {
364 return true; 364 return true;
365 } 365 }
366 366
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 SkTypeface* SkFontMgr_DirectWrite::createTypefaceFromDWriteFont( 450 SkTypeface* SkFontMgr_DirectWrite::createTypefaceFromDWriteFont(
451 IDWriteFontFace* fontFace, 451 IDWriteFontFace* fontFace,
452 IDWriteFont* font, 452 IDWriteFont* font,
453 IDWriteFontFamily* fontFamily) const { 453 IDWriteFontFamily* fontFamily) const {
454 SkAutoMutexAcquire ama(fTFCacheMutex); 454 SkAutoMutexAcquire ama(fTFCacheMutex);
455 ProtoDWriteTypeface spec = { fontFace, font, fontFamily }; 455 ProtoDWriteTypeface spec = { fontFace, font, fontFamily };
456 SkTypeface* face = fTFCache.findByProcAndRef(FindByDWriteFont, &spec); 456 SkTypeface* face = fTFCache.findByProcAndRef(FindByDWriteFont, &spec);
457 if (nullptr == face) { 457 if (nullptr == face) {
458 face = DWriteFontTypeface::Create(fFactory.get(), fontFace, font, fontFa mily); 458 face = DWriteFontTypeface::Create(fFactory.get(), fontFace, font, fontFa mily);
459 if (face) { 459 if (face) {
460 fTFCache.add(face, get_style(font)); 460 fTFCache.add(face);
461 } 461 }
462 } 462 }
463 return face; 463 return face;
464 } 464 }
465 465
466 int SkFontMgr_DirectWrite::onCountFamilies() const { 466 int SkFontMgr_DirectWrite::onCountFamilies() const {
467 return fFontCollection->GetFontFamilyCount(); 467 return fFontCollection->GetFontFamilyCount();
468 } 468 }
469 469
470 void SkFontMgr_DirectWrite::onGetFamilyName(int index, SkString* familyName) con st { 470 void SkFontMgr_DirectWrite::onGetFamilyName(int index, SkString* familyName) con st {
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 1100
1101 #include "SkFontMgr_indirect.h" 1101 #include "SkFontMgr_indirect.h"
1102 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { 1102 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) {
1103 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); 1103 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite());
1104 if (impl.get() == nullptr) { 1104 if (impl.get() == nullptr) {
1105 return nullptr; 1105 return nullptr;
1106 } 1106 }
1107 return new SkFontMgr_Indirect(impl.get(), proxy); 1107 return new SkFontMgr_Indirect(impl.get(), proxy);
1108 } 1108 }
1109 #endif//defined(SK_BUILD_FOR_WIN32) 1109 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_fontconfig.cpp ('k') | tests/TypefaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698