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 17 matching lines...) Expand all Loading... |
28 virtual ULONG STDMETHODCALLTYPE AddRef(); | 28 virtual ULONG STDMETHODCALLTYPE AddRef(); |
29 virtual ULONG STDMETHODCALLTYPE Release(); | 29 virtual ULONG STDMETHODCALLTYPE Release(); |
30 | 30 |
31 // IDWriteFontFileLoader methods | 31 // IDWriteFontFileLoader methods |
32 virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey( | 32 virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey( |
33 void const* fontFileReferenceKey, | 33 void const* fontFileReferenceKey, |
34 UINT32 fontFileReferenceKeySize, | 34 UINT32 fontFileReferenceKeySize, |
35 IDWriteFontFileStream** fontFileStream); | 35 IDWriteFontFileStream** fontFileStream); |
36 | 36 |
37 // Takes ownership of stream. | 37 // Takes ownership of stream. |
38 static HRESULT Create(SkStream* stream, StreamFontFileLoader** streamFontFil
eLoader) { | 38 static HRESULT Create(SkStreamAsset* stream, StreamFontFileLoader** streamFo
ntFileLoader) { |
39 *streamFontFileLoader = new StreamFontFileLoader(stream); | 39 *streamFontFileLoader = new StreamFontFileLoader(stream); |
40 if (NULL == streamFontFileLoader) { | 40 if (NULL == streamFontFileLoader) { |
41 return E_OUTOFMEMORY; | 41 return E_OUTOFMEMORY; |
42 } | 42 } |
43 return S_OK; | 43 return S_OK; |
44 } | 44 } |
45 | 45 |
46 SkAutoTDelete<SkStream> fStream; | 46 SkAutoTDelete<SkStreamAsset> fStream; |
47 | 47 |
48 private: | 48 private: |
49 StreamFontFileLoader(SkStream* stream) : fRefCount(1), fStream(stream) { } | 49 StreamFontFileLoader(SkStreamAsset* stream) : fRefCount(1), fStream(stream)
{ } |
50 virtual ~StreamFontFileLoader() { } | 50 virtual ~StreamFontFileLoader() { } |
51 | 51 |
52 ULONG fRefCount; | 52 ULONG fRefCount; |
53 }; | 53 }; |
54 | 54 |
55 HRESULT StreamFontFileLoader::QueryInterface(REFIID iid, void** ppvObject) { | 55 HRESULT StreamFontFileLoader::QueryInterface(REFIID iid, void** ppvObject) { |
56 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) { | 56 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) { |
57 *ppvObject = this; | 57 *ppvObject = this; |
58 AddRef(); | 58 AddRef(); |
59 return S_OK; | 59 return S_OK; |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 765 } |
766 | 766 |
767 #include "SkFontMgr_indirect.h" | 767 #include "SkFontMgr_indirect.h" |
768 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { | 768 SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) { |
769 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); | 769 SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite()); |
770 if (impl.get() == NULL) { | 770 if (impl.get() == NULL) { |
771 return NULL; | 771 return NULL; |
772 } | 772 } |
773 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); | 773 return SkNEW_ARGS(SkFontMgr_Indirect, (impl.get(), proxy)); |
774 } | 774 } |
OLD | NEW |