OLD | NEW |
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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 SkTypeface* SkFontMgr_DirectWrite::createTypefaceFromDWriteFont( | 428 SkTypeface* SkFontMgr_DirectWrite::createTypefaceFromDWriteFont( |
429 IDWriteFontFace* fontFace, | 429 IDWriteFontFace* fontFace, |
430 IDWriteFont* font, | 430 IDWriteFont* font, |
431 IDWriteFontFamily* fontFamily) const { | 431 IDWriteFontFamily* fontFamily) const { |
432 SkAutoMutexAcquire ama(fTFCacheMutex); | 432 SkAutoMutexAcquire ama(fTFCacheMutex); |
433 ProtoDWriteTypeface spec = { fontFace, font, fontFamily }; | 433 ProtoDWriteTypeface spec = { fontFace, font, fontFamily }; |
434 SkTypeface* face = fTFCache.findByProcAndRef(FindByDWriteFont, &spec); | 434 SkTypeface* face = fTFCache.findByProcAndRef(FindByDWriteFont, &spec); |
435 if (NULL == face) { | 435 if (NULL == face) { |
436 face = DWriteFontTypeface::Create(fFactory.get(), fontFace, font, fontFa
mily); | 436 face = DWriteFontTypeface::Create(fFactory.get(), fontFace, font, fontFa
mily); |
437 if (face) { | 437 if (face) { |
438 fTFCache.add(face, get_style(font), true); | 438 fTFCache.add(face, get_style(font)); |
439 } | 439 } |
440 } | 440 } |
441 return face; | 441 return face; |
442 } | 442 } |
443 | 443 |
444 int SkFontMgr_DirectWrite::onCountFamilies() const { | 444 int SkFontMgr_DirectWrite::onCountFamilies() const { |
445 return fFontCollection->GetFontFamilyCount(); | 445 return fFontCollection->GetFontFamilyCount(); |
446 } | 446 } |
447 | 447 |
448 void SkFontMgr_DirectWrite::onGetFamilyName(int index, SkString* familyName) con
st { | 448 void SkFontMgr_DirectWrite::onGetFamilyName(int index, SkString* familyName) con
st { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 755 } |
756 | 756 |
757 #include "SkFontMgr_indirect.h" | 757 #include "SkFontMgr_indirect.h" |
758 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { | 758 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { |
759 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); | 759 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); |
760 if (impl.get() == NULL) { | 760 if (impl.get() == NULL) { |
761 return NULL; | 761 return NULL; |
762 } | 762 } |
763 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); | 763 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); |
764 } | 764 } |
OLD | NEW |