| 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 "SkDataTable.h" |
| 8 #include "SkDWrite.h" | 9 #include "SkDWrite.h" |
| 9 #include "SkDWriteFontFileStream.h" | 10 #include "SkDWriteFontFileStream.h" |
| 10 #include "SkDataTable.h" | |
| 11 #include "SkHRESULT.h" | 11 #include "SkHRESULT.h" |
| 12 #include "SkMutex.h" | |
| 13 #include "SkRemotableFontMgr.h" | 12 #include "SkRemotableFontMgr.h" |
| 14 #include "SkStream.h" | 13 #include "SkStream.h" |
| 15 #include "SkString.h" | 14 #include "SkString.h" |
| 16 #include "SkTArray.h" | 15 #include "SkTArray.h" |
| 16 #include "SkThread.h" |
| 17 #include "SkTScopedComPtr.h" | 17 #include "SkTScopedComPtr.h" |
| 18 #include "SkTypeface_win.h" | 18 #include "SkTypeface_win.h" |
| 19 #include "SkTypes.h" | 19 #include "SkTypes.h" |
| 20 #include "SkUtils.h" | 20 #include "SkUtils.h" |
| 21 | 21 |
| 22 #include <dwrite.h> | 22 #include <dwrite.h> |
| 23 | 23 |
| 24 class SK_API SkRemotableFontMgr_DirectWrite : public SkRemotableFontMgr { | 24 class SK_API SkRemotableFontMgr_DirectWrite : public SkRemotableFontMgr { |
| 25 private: | 25 private: |
| 26 struct DataId { | 26 struct DataId { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 DataId& added = fDataIdCache.push_back(); | 73 DataId& added = fDataIdCache.push_back(); |
| 74 added.fLoader = fontFileLoaderId.release(); // Ref is passed. | 74 added.fLoader = fontFileLoaderId.release(); // Ref is passed. |
| 75 added.fKey = sk_malloc_throw(refKeySize); | 75 added.fKey = sk_malloc_throw(refKeySize); |
| 76 memcpy(added.fKey, refKey, refKeySize); | 76 memcpy(added.fKey, refKey, refKeySize); |
| 77 added.fKeySize = refKeySize; | 77 added.fKeySize = refKeySize; |
| 78 | 78 |
| 79 return i; | 79 return i; |
| 80 } | 80 } |
| 81 | 81 |
| 82 public: | 82 public: |
| 83 | 83 |
| 84 | 84 |
| 85 /** localeNameLength must include the null terminator. */ | 85 /** localeNameLength must include the null terminator. */ |
| 86 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, | 86 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, |
| 87 WCHAR* localeName, int localeNameLength) | 87 WCHAR* localeName, int localeNameLength) |
| 88 : fFontCollection(SkRefComPtr(fontCollection)) | 88 : fFontCollection(SkRefComPtr(fontCollection)) |
| 89 , fLocaleName(localeNameLength) | 89 , fLocaleName(localeNameLength) |
| 90 { | 90 { |
| 91 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); | 91 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); |
| 92 } | 92 } |
| 93 | 93 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } else { | 498 } else { |
| 499 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 499 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
| 500 if (localeNameLen) { | 500 if (localeNameLen) { |
| 501 localeName = localeNameStorage; | 501 localeName = localeNameStorage; |
| 502 }; | 502 }; |
| 503 } | 503 } |
| 504 | 504 |
| 505 return SkNEW_ARGS(SkRemotableFontMgr_DirectWrite, (sysFontCollection.get(), | 505 return SkNEW_ARGS(SkRemotableFontMgr_DirectWrite, (sysFontCollection.get(), |
| 506 localeName, localeNameLen
)); | 506 localeName, localeNameLen
)); |
| 507 } | 507 } |
| OLD | NEW |