OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
9 #include "../../../include/fxge/fx_ge_win32.h" | 9 #include "../../../include/fxge/fx_ge_win32.h" |
10 #include "dwrite_int.h" | 10 #include "dwrite_int.h" |
11 #include <dwrite.h> | 11 #include <dwrite.h> |
12 typedef HRESULT (__stdcall *FuncType_DWriteCreateFactory)(__in DWRITE_FACTORY_T
YPE, __in REFIID, __out IUnknown **); | 12 typedef HRESULT (__stdcall *FuncType_DWriteCreateFactory)(__in DWRITE_FACTORY_T
YPE, __in REFIID, __out IUnknown **); |
13 template <typename InterfaceType> | 13 template <typename InterfaceType> |
14 inline void SafeRelease(InterfaceType** currentObject) | 14 inline void SafeRelease(InterfaceType** currentObject) |
15 { | 15 { |
16 if (*currentObject != NULL) { | 16 if (*currentObject != NULL) { |
17 (*currentObject)->Release(); | 17 (*currentObject)->Release(); |
18 *currentObject = NULL; | 18 *currentObject = NULL; |
19 } | 19 } |
20 } | 20 } |
21 template <typename InterfaceType> | 21 template <typename InterfaceType> |
22 inline InterfaceType* SafeAcquire(InterfaceType* newObject) | 22 inline InterfaceType* SafeAcquire(InterfaceType* newObject) |
23 { | 23 { |
24 if (newObject != NULL) { | 24 if (newObject != NULL) { |
25 newObject->AddRef(); | 25 newObject->AddRef(); |
26 } | 26 } |
27 return newObject; | 27 return newObject; |
28 } | 28 } |
29 class CDwFontFileStream : public IDWriteFontFileStream, public CFX_Object | 29 class CDwFontFileStream FX_FINAL : public IDWriteFontFileStream, public CFX_Obje
ct |
30 { | 30 { |
31 public: | 31 public: |
32 explicit CDwFontFileStream(void const* fontFileReferenceKey, UINT32 fontFile
ReferenceKeySize); | 32 explicit CDwFontFileStream(void const* fontFileReferenceKey, UINT32 fontFile
ReferenceKeySize); |
33 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObjec
t); | 33 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObjec
t); |
34 virtual ULONG STDMETHODCALLTYPE AddRef(); | 34 virtual ULONG STDMETHODCALLTYPE AddRef(); |
35 virtual ULONG STDMETHODCALLTYPE Release(); | 35 virtual ULONG STDMETHODCALLTYPE Release(); |
36 virtual HRESULT STDMETHODCALLTYPE ReadFileFragment(void const** fragmentStar
t, UINT64 fileOffset, UINT64 fragmentSize, OUT void** fragmentContext); | 36 virtual HRESULT STDMETHODCALLTYPE ReadFileFragment(void const** fragmentStar
t, UINT64 fileOffset, UINT64 fragmentSize, OUT void** fragmentContext); |
37 virtual void STDMETHODCALLTYPE ReleaseFileFragment(void* fragmentContext)
; | 37 virtual void STDMETHODCALLTYPE ReleaseFileFragment(void* fragmentContext)
; |
38 virtual HRESULT STDMETHODCALLTYPE GetFileSize(OUT UINT64* fileSize); | 38 virtual HRESULT STDMETHODCALLTYPE GetFileSize(OUT UINT64* fileSize); |
39 virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64* lastWriteTime
); | 39 virtual HRESULT STDMETHODCALLTYPE GetLastWriteTime(OUT UINT64* lastWriteTime
); |
40 bool IsInitialized() | 40 bool IsInitialized() |
41 { | 41 { |
42 return resourcePtr_ != NULL; | 42 return resourcePtr_ != NULL; |
43 } | 43 } |
44 private: | 44 private: |
45 ULONG refCount_; | 45 ULONG refCount_; |
46 void const* resourcePtr_; | 46 void const* resourcePtr_; |
47 DWORD resourceSize_; | 47 DWORD resourceSize_; |
48 }; | 48 }; |
49 class CDwFontFileLoader : public IDWriteFontFileLoader, public CFX_Object | 49 class CDwFontFileLoader FX_FINAL : public IDWriteFontFileLoader, public CFX_Obje
ct |
50 { | 50 { |
51 public: | 51 public: |
52 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObjec
t); | 52 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void** ppvObjec
t); |
53 virtual ULONG STDMETHODCALLTYPE AddRef(); | 53 virtual ULONG STDMETHODCALLTYPE AddRef(); |
54 virtual ULONG STDMETHODCALLTYPE Release(); | 54 virtual ULONG STDMETHODCALLTYPE Release(); |
55 virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey(void const* fontFileRe
ferenceKey, UINT32 fontFileReferenceKeySize, OUT IDWriteFontFileStream** fontFil
eStream); | 55 virtual HRESULT STDMETHODCALLTYPE CreateStreamFromKey(void const* fontFileRe
ferenceKey, UINT32 fontFileReferenceKeySize, OUT IDWriteFontFileStream** fontFil
eStream); |
56 | 56 |
57 static IDWriteFontFileLoader* GetLoader() | 57 static IDWriteFontFileLoader* GetLoader() |
58 { | 58 { |
59 if (instance_ == NULL) { | 59 if (instance_ == NULL) { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 text_bbox.Height(), | 471 text_bbox.Height(), |
472 &dib, | 472 &dib, |
473 text_bbox.left, | 473 text_bbox.left, |
474 text_bbox.top, | 474 text_bbox.top, |
475 FXDIB_BLEND_NORMAL, | 475 FXDIB_BLEND_NORMAL, |
476 pClipRgn | 476 pClipRgn |
477 ); | 477 ); |
478 return hr; | 478 return hr; |
479 } | 479 } |
480 #endif | 480 #endif |
OLD | NEW |