| 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_DESKTOP_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
| 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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual ULONG STDMETHODCALLTYPE AddRef(); | 57 virtual ULONG STDMETHODCALLTYPE AddRef(); |
| 58 virtual ULONG STDMETHODCALLTYPE Release(); | 58 virtual ULONG STDMETHODCALLTYPE Release(); |
| 59 virtual HRESULT STDMETHODCALLTYPE | 59 virtual HRESULT STDMETHODCALLTYPE |
| 60 CreateStreamFromKey(void const* fontFileReferenceKey, | 60 CreateStreamFromKey(void const* fontFileReferenceKey, |
| 61 UINT32 fontFileReferenceKeySize, | 61 UINT32 fontFileReferenceKeySize, |
| 62 OUT IDWriteFontFileStream** fontFileStream); | 62 OUT IDWriteFontFileStream** fontFileStream); |
| 63 | 63 |
| 64 static IDWriteFontFileLoader* GetLoader() { | 64 static IDWriteFontFileLoader* GetLoader() { |
| 65 if (instance_ == NULL) { | 65 if (instance_ == NULL) { |
| 66 instance_ = new CDwFontFileLoader(); | 66 instance_ = new CDwFontFileLoader(); |
| 67 return instance_; | |
| 68 } | 67 } |
| 69 return instance_; | 68 return instance_; |
| 70 } | 69 } |
| 71 static bool IsLoaderInitialized() { return instance_ != NULL; } | 70 static bool IsLoaderInitialized() { return instance_ != NULL; } |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 CDwFontFileLoader(); | 73 CDwFontFileLoader(); |
| 75 ULONG refCount_; | 74 ULONG refCount_; |
| 76 static IDWriteFontFileLoader* instance_; | 75 static IDWriteFontFileLoader* instance_; |
| 77 }; | 76 }; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 DWRITE_RENDERING_MODE_DEFAULT, &pRenderingParams); | 183 DWRITE_RENDERING_MODE_DEFAULT, &pRenderingParams); |
| 185 if (FAILED(hr)) { | 184 if (FAILED(hr)) { |
| 186 goto failed; | 185 goto failed; |
| 187 } | 186 } |
| 188 hr = pBitmapRenderTarget->SetPixelsPerDip(1.0f); | 187 hr = pBitmapRenderTarget->SetPixelsPerDip(1.0f); |
| 189 if (FAILED(hr)) { | 188 if (FAILED(hr)) { |
| 190 goto failed; | 189 goto failed; |
| 191 } | 190 } |
| 192 *(CDwGdiTextRenderer**)renderTarget = | 191 *(CDwGdiTextRenderer**)renderTarget = |
| 193 new CDwGdiTextRenderer(pBitmap, pBitmapRenderTarget, pRenderingParams); | 192 new CDwGdiTextRenderer(pBitmap, pBitmapRenderTarget, pRenderingParams); |
| 194 if (*(CDwGdiTextRenderer**)renderTarget == NULL) { | |
| 195 goto failed; | |
| 196 } | |
| 197 SafeRelease(&pGdiInterop); | 193 SafeRelease(&pGdiInterop); |
| 198 SafeRelease(&pBitmapRenderTarget); | 194 SafeRelease(&pBitmapRenderTarget); |
| 199 SafeRelease(&pRenderingParams); | 195 SafeRelease(&pRenderingParams); |
| 200 return TRUE; | 196 return TRUE; |
| 201 failed: | 197 failed: |
| 202 SafeRelease(&pGdiInterop); | 198 SafeRelease(&pGdiInterop); |
| 203 SafeRelease(&pBitmapRenderTarget); | 199 SafeRelease(&pBitmapRenderTarget); |
| 204 SafeRelease(&pRenderingParams); | 200 SafeRelease(&pRenderingParams); |
| 205 return FALSE; | 201 return FALSE; |
| 206 } | 202 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 textColor); | 398 textColor); |
| 403 if (FAILED(hr)) { | 399 if (FAILED(hr)) { |
| 404 return hr; | 400 return hr; |
| 405 } | 401 } |
| 406 pBitmap_->CompositeBitmap(text_bbox.left, text_bbox.top, text_bbox.Width(), | 402 pBitmap_->CompositeBitmap(text_bbox.left, text_bbox.top, text_bbox.Width(), |
| 407 text_bbox.Height(), &dib, text_bbox.left, | 403 text_bbox.Height(), &dib, text_bbox.left, |
| 408 text_bbox.top, FXDIB_BLEND_NORMAL, pClipRgn); | 404 text_bbox.top, FXDIB_BLEND_NORMAL, pClipRgn); |
| 409 return hr; | 405 return hr; |
| 410 } | 406 } |
| 411 #endif | 407 #endif |
| OLD | NEW |