| 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 "SkTypes.h" | 8 #include "SkTypes.h" |
| 9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
| 10 | 10 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 //////////////////////////////////////////////////////////////////////////////// | 263 //////////////////////////////////////////////////////////////////////////////// |
| 264 | 264 |
| 265 class SkFontMgr_DirectWrite : public SkFontMgr { | 265 class SkFontMgr_DirectWrite : public SkFontMgr { |
| 266 public: | 266 public: |
| 267 /** localeNameLength must include the null terminator. */ | 267 /** localeNameLength must include the null terminator. */ |
| 268 SkFontMgr_DirectWrite(IDWriteFactory* factory, IDWriteFontCollection* fontCo
llection, | 268 SkFontMgr_DirectWrite(IDWriteFactory* factory, IDWriteFontCollection* fontCo
llection, |
| 269 WCHAR* localeName, int localeNameLength, IDWriteFontFa
llback* fallback) | 269 WCHAR* localeName, int localeNameLength, IDWriteFontFa
llback* fallback) |
| 270 : fFactory(SkRefComPtr(factory)) | 270 : fFactory(SkRefComPtr(factory)) |
| 271 , fFontCollection(SkRefComPtr(fontCollection)) | |
| 272 , fLocaleName(localeNameLength) | |
| 273 #if SK_HAS_DWRITE_2_H | 271 #if SK_HAS_DWRITE_2_H |
| 274 , fFontFallback(SkSafeRefComPtr(fallback)) | 272 , fFontFallback(SkSafeRefComPtr(fallback)) |
| 275 #endif | 273 #endif |
| 274 , fFontCollection(SkRefComPtr(fontCollection)) |
| 275 , fLocaleName(localeNameLength) |
| 276 { | 276 { |
| 277 #if SK_HAS_DWRITE_2_H | 277 #if SK_HAS_DWRITE_2_H |
| 278 if (!SUCCEEDED(fFactory->QueryInterface(&fFactory2))) { | 278 if (!SUCCEEDED(fFactory->QueryInterface(&fFactory2))) { |
| 279 // IUnknown::QueryInterface states that if it fails, punk will be se
t to nullptr. | 279 // IUnknown::QueryInterface states that if it fails, punk will be se
t to nullptr. |
| 280 // http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx | 280 // http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx |
| 281 SkASSERT_RELEASE(nullptr == fFactory2.get()); | 281 SkASSERT_RELEASE(nullptr == fFactory2.get()); |
| 282 } | 282 } |
| 283 #endif | 283 #endif |
| 284 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); | 284 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); |
| 285 } | 285 } |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 | 1120 |
| 1121 #include "SkFontMgr_indirect.h" | 1121 #include "SkFontMgr_indirect.h" |
| 1122 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { | 1122 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { |
| 1123 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); | 1123 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); |
| 1124 if (impl.get() == nullptr) { | 1124 if (impl.get() == nullptr) { |
| 1125 return nullptr; | 1125 return nullptr; |
| 1126 } | 1126 } |
| 1127 return new SkFontMgr_Indirect(impl.get(), proxy); | 1127 return new SkFontMgr_Indirect(impl.get(), proxy); |
| 1128 } | 1128 } |
| 1129 #endif//defined(SK_BUILD_FOR_WIN32) | 1129 #endif//defined(SK_BUILD_FOR_WIN32) |
| OLD | NEW |