Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: core/src/fxge/win32/fx_win32_dwrite.cpp

Issue 1088733002: Kill CFX_Object. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/skia/fx_skia_device.cpp ('k') | core/src/fxge/win32/fx_win32_gdipext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 FX_FINAL : public IDWriteFontFileStream, public CFX_Obje ct 29 class CDwFontFileStream FX_FINAL : public IDWriteFontFileStream
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 FX_FINAL : public IDWriteFontFileLoader, public CFX_Obje ct 49 class CDwFontFileLoader FX_FINAL : public IDWriteFontFileLoader
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) {
60 instance_ = FX_NEW CDwFontFileLoader(); 60 instance_ = FX_NEW CDwFontFileLoader();
61 return instance_; 61 return instance_;
62 } 62 }
63 return instance_; 63 return instance_;
64 } 64 }
65 static bool IsLoaderInitialized() 65 static bool IsLoaderInitialized()
66 { 66 {
67 return instance_ != NULL; 67 return instance_ != NULL;
68 } 68 }
69 private: 69 private:
70 CDwFontFileLoader(); 70 CDwFontFileLoader();
71 ULONG refCount_; 71 ULONG refCount_;
72 static IDWriteFontFileLoader* instance_; 72 static IDWriteFontFileLoader* instance_;
73 }; 73 };
74 class CDwFontContext : public CFX_Object 74 class CDwFontContext
75 { 75 {
76 public: 76 public:
77 CDwFontContext(IDWriteFactory* dwriteFactory); 77 CDwFontContext(IDWriteFactory* dwriteFactory);
78 ~CDwFontContext(); 78 ~CDwFontContext();
79 HRESULT Initialize(); 79 HRESULT Initialize();
80 private: 80 private:
81 CDwFontContext(CDwFontContext const&); 81 CDwFontContext(CDwFontContext const&);
82 void operator=(CDwFontContext const&); 82 void operator=(CDwFontContext const&);
83 HRESULT hr_; 83 HRESULT hr_;
84 IDWriteFactory* dwriteFactory_; 84 IDWriteFactory* dwriteFactory_;
85 }; 85 };
86 class CDwGdiTextRenderer : public CFX_Object 86 class CDwGdiTextRenderer
87 { 87 {
88 public: 88 public:
89 CDwGdiTextRenderer( 89 CDwGdiTextRenderer(
90 CFX_DIBitmap* pBitmap, 90 CFX_DIBitmap* pBitmap,
91 IDWriteBitmapRenderTarget* bitmapRenderTarget, 91 IDWriteBitmapRenderTarget* bitmapRenderTarget,
92 IDWriteRenderingParams* renderingParams 92 IDWriteRenderingParams* renderingParams
93 ); 93 );
94 CDwGdiTextRenderer::~CDwGdiTextRenderer(); 94 CDwGdiTextRenderer::~CDwGdiTextRenderer();
95 HRESULT STDMETHODCALLTYPE DrawGlyphRun( 95 HRESULT STDMETHODCALLTYPE DrawGlyphRun(
96 const FX_RECT& text_bbox, 96 const FX_RECT& text_bbox,
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « core/src/fxge/skia/fx_skia_device.cpp ('k') | core/src/fxge/win32/fx_win32_gdipext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698