Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 | 38 |
| 39 // IDWriteFontFileLoader methods | 39 // IDWriteFontFileLoader methods |
| 40 virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey( | 40 virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey( |
| 41 void const* fontFileReferenceKey, | 41 void const* fontFileReferenceKey, |
| 42 UINT32 fontFileReferenceKeySize, | 42 UINT32 fontFileReferenceKeySize, |
| 43 IDWriteFontFileStream** fontFileStream); | 43 IDWriteFontFileStream** fontFileStream); |
| 44 | 44 |
| 45 // Takes ownership of stream. | 45 // Takes ownership of stream. |
| 46 static HRESULT Create(SkStreamAsset* stream, StreamFontFileLoader** streamFo ntFileLoader) { | 46 static HRESULT Create(SkStreamAsset* stream, StreamFontFileLoader** streamFo ntFileLoader) { |
| 47 *streamFontFileLoader = new StreamFontFileLoader(stream); | 47 *streamFontFileLoader = new StreamFontFileLoader(stream); |
| 48 if (nullptr == streamFontFileLoader) { | 48 if (nullptr == *streamFontFileLoader) { |
| 49 return E_OUTOFMEMORY; | 49 return E_OUTOFMEMORY; |
| 50 } | 50 } |
| 51 return S_OK; | 51 return S_OK; |
| 52 } | 52 } |
| 53 | 53 |
| 54 SkAutoTDelete<SkStreamAsset> fStream; | 54 SkAutoTDelete<SkStreamAsset> fStream; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 StreamFontFileLoader(SkStreamAsset* stream) : fStream(stream), fRefCount(1) { } | 57 StreamFontFileLoader(SkStreamAsset* stream) : fStream(stream), fRefCount(1) { } |
| 58 virtual ~StreamFontFileLoader() { } | 58 virtual ~StreamFontFileLoader() { } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObjec t); | 102 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObjec t); |
| 103 virtual ULONG STDMETHODCALLTYPE AddRef(); | 103 virtual ULONG STDMETHODCALLTYPE AddRef(); |
| 104 virtual ULONG STDMETHODCALLTYPE Release(); | 104 virtual ULONG STDMETHODCALLTYPE Release(); |
| 105 | 105 |
| 106 // IDWriteFontFileEnumerator methods | 106 // IDWriteFontFileEnumerator methods |
| 107 virtual HRESULT STDMETHODCALLTYPE MoveNext(BOOL* hasCurrentFile); | 107 virtual HRESULT STDMETHODCALLTYPE MoveNext(BOOL* hasCurrentFile); |
| 108 virtual HRESULT STDMETHODCALLTYPE GetCurrentFontFile(IDWriteFontFile** fontF ile); | 108 virtual HRESULT STDMETHODCALLTYPE GetCurrentFontFile(IDWriteFontFile** fontF ile); |
| 109 | 109 |
| 110 static HRESULT Create(IDWriteFactory* factory, IDWriteFontFileLoader* fontFi leLoader, | 110 static HRESULT Create(IDWriteFactory* factory, IDWriteFontFileLoader* fontFi leLoader, |
| 111 StreamFontFileEnumerator** streamFontFileEnumerator) { | 111 StreamFontFileEnumerator** streamFontFileEnumerator) { |
| 112 *streamFontFileEnumerator = new StreamFontFileEnumerator(factory, fontFi leLoader); | 112 *streamFontFileEnumerator = new StreamFontFileEnumerator(factory, fontFi leLoader); |
|
reed1
2016/06/08 10:35:10
This seems like a crazy test in the first place --
| |
| 113 if (nullptr == streamFontFileEnumerator) { | 113 if (nullptr == *streamFontFileEnumerator) { |
| 114 return E_OUTOFMEMORY; | 114 return E_OUTOFMEMORY; |
| 115 } | 115 } |
| 116 return S_OK; | 116 return S_OK; |
| 117 } | 117 } |
| 118 private: | 118 private: |
| 119 StreamFontFileEnumerator(IDWriteFactory* factory, IDWriteFontFileLoader* fon tFileLoader); | 119 StreamFontFileEnumerator(IDWriteFactory* factory, IDWriteFontFileLoader* fon tFileLoader); |
| 120 virtual ~StreamFontFileEnumerator() { } | 120 virtual ~StreamFontFileEnumerator() { } |
| 121 | 121 |
| 122 ULONG fRefCount; | 122 ULONG fRefCount; |
| 123 | 123 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 // IDWriteFontCollectionLoader methods | 200 // IDWriteFontCollectionLoader methods |
| 201 virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey( | 201 virtual HRESULT STDMETHODCALLTYPE CreateEnumeratorFromKey( |
| 202 IDWriteFactory* factory, | 202 IDWriteFactory* factory, |
| 203 void const* collectionKey, | 203 void const* collectionKey, |
| 204 UINT32 collectionKeySize, | 204 UINT32 collectionKeySize, |
| 205 IDWriteFontFileEnumerator** fontFileEnumerator); | 205 IDWriteFontFileEnumerator** fontFileEnumerator); |
| 206 | 206 |
| 207 static HRESULT Create(IDWriteFontFileLoader* fontFileLoader, | 207 static HRESULT Create(IDWriteFontFileLoader* fontFileLoader, |
| 208 StreamFontCollectionLoader** streamFontCollectionLoade r) { | 208 StreamFontCollectionLoader** streamFontCollectionLoade r) { |
| 209 *streamFontCollectionLoader = new StreamFontCollectionLoader(fontFileLoa der); | 209 *streamFontCollectionLoader = new StreamFontCollectionLoader(fontFileLoa der); |
| 210 if (nullptr == streamFontCollectionLoader) { | 210 if (nullptr == *streamFontCollectionLoader) { |
| 211 return E_OUTOFMEMORY; | 211 return E_OUTOFMEMORY; |
| 212 } | 212 } |
| 213 return S_OK; | 213 return S_OK; |
| 214 } | 214 } |
| 215 private: | 215 private: |
| 216 StreamFontCollectionLoader(IDWriteFontFileLoader* fontFileLoader) | 216 StreamFontCollectionLoader(IDWriteFontFileLoader* fontFileLoader) |
| 217 : fRefCount(1) | 217 : fRefCount(1) |
| 218 , fFontFileLoader(SkRefComPtr(fontFileLoader)) | 218 , fFontFileLoader(SkRefComPtr(fontFileLoader)) |
| 219 { } | 219 { } |
| 220 virtual ~StreamFontCollectionLoader() { } | 220 virtual ~StreamFontCollectionLoader() { } |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 | 1086 |
| 1087 #include "SkFontMgr_indirect.h" | 1087 #include "SkFontMgr_indirect.h" |
| 1088 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { | 1088 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { |
| 1089 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); | 1089 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); |
| 1090 if (impl.get() == nullptr) { | 1090 if (impl.get() == nullptr) { |
| 1091 return nullptr; | 1091 return nullptr; |
| 1092 } | 1092 } |
| 1093 return new SkFontMgr_Indirect(impl.get(), proxy); | 1093 return new SkFontMgr_Indirect(impl.get(), proxy); |
| 1094 } | 1094 } |
| 1095 #endif//defined(SK_BUILD_FOR_WIN32) | 1095 #endif//defined(SK_BUILD_FOR_WIN32) |
| OLD | NEW |