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

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

Issue 1062863006: Remove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing |new| typo. 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/win32/fx_win32_dib.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"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_ = new CDwFontFileLoader();
61 return instance_;
62 } 61 }
63 return instance_; 62 return instance_;
64 } 63 }
65 static bool IsLoaderInitialized() 64 static bool IsLoaderInitialized()
66 { 65 {
67 return instance_ != NULL; 66 return instance_ != NULL;
68 } 67 }
69 private: 68 private:
70 CDwFontFileLoader(); 69 CDwFontFileLoader();
71 ULONG refCount_; 70 ULONG refCount_;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 DWRITE_RENDERING_MODE_DEFAULT, 201 DWRITE_RENDERING_MODE_DEFAULT,
203 &pRenderingParams 202 &pRenderingParams
204 ); 203 );
205 if (FAILED(hr)) { 204 if (FAILED(hr)) {
206 goto failed; 205 goto failed;
207 } 206 }
208 hr = pBitmapRenderTarget->SetPixelsPerDip(1.0f); 207 hr = pBitmapRenderTarget->SetPixelsPerDip(1.0f);
209 if (FAILED(hr)) { 208 if (FAILED(hr)) {
210 goto failed; 209 goto failed;
211 } 210 }
212 *(CDwGdiTextRenderer**)renderTarget = FX_NEW CDwGdiTextRenderer(pBitmap, pBi tmapRenderTarget, pRenderingParams); 211 *(CDwGdiTextRenderer**)renderTarget = new CDwGdiTextRenderer(pBitmap, pBitma pRenderTarget, pRenderingParams);
213 if (*(CDwGdiTextRenderer**)renderTarget == NULL) {
214 goto failed;
215 }
216 SafeRelease(&pGdiInterop); 212 SafeRelease(&pGdiInterop);
217 SafeRelease(&pBitmapRenderTarget); 213 SafeRelease(&pBitmapRenderTarget);
218 SafeRelease(&pRenderingParams); 214 SafeRelease(&pRenderingParams);
219 return TRUE; 215 return TRUE;
220 failed: 216 failed:
221 SafeRelease(&pGdiInterop); 217 SafeRelease(&pGdiInterop);
222 SafeRelease(&pBitmapRenderTarget); 218 SafeRelease(&pBitmapRenderTarget);
223 SafeRelease(&pRenderingParams); 219 SafeRelease(&pRenderingParams);
224 return FALSE; 220 return FALSE;
225 } 221 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 361 }
366 return newCount; 362 return newCount;
367 } 363 }
368 HRESULT STDMETHODCALLTYPE CDwFontFileLoader::CreateStreamFromKey( 364 HRESULT STDMETHODCALLTYPE CDwFontFileLoader::CreateStreamFromKey(
369 void const* fontFileReferenceKey, 365 void const* fontFileReferenceKey,
370 UINT32 fontFileReferenceKeySize, 366 UINT32 fontFileReferenceKeySize,
371 OUT IDWriteFontFileStream** fontFileStream 367 OUT IDWriteFontFileStream** fontFileStream
372 ) 368 )
373 { 369 {
374 *fontFileStream = NULL; 370 *fontFileStream = NULL;
375 CDwFontFileStream* stream = FX_NEW CDwFontFileStream(fontFileReferenceKey, f ontFileReferenceKeySize); 371 CDwFontFileStream* stream = new CDwFontFileStream(fontFileReferenceKey, font FileReferenceKeySize);
376 if (stream == NULL)»{
377 return E_OUTOFMEMORY;
378 }
379 if (!stream->IsInitialized()) { 372 if (!stream->IsInitialized()) {
380 delete stream; 373 delete stream;
381 return E_FAIL; 374 return E_FAIL;
382 } 375 }
383 *fontFileStream = SafeAcquire(stream); 376 *fontFileStream = SafeAcquire(stream);
384 return S_OK; 377 return S_OK;
385 } 378 }
386 CDwFontContext::CDwFontContext(IDWriteFactory* dwriteFactory) : 379 CDwFontContext::CDwFontContext(IDWriteFactory* dwriteFactory) :
387 hr_(S_FALSE), 380 hr_(S_FALSE),
388 dwriteFactory_(SafeAcquire(dwriteFactory)) 381 dwriteFactory_(SafeAcquire(dwriteFactory))
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 text_bbox.Height(), 464 text_bbox.Height(),
472 &dib, 465 &dib,
473 text_bbox.left, 466 text_bbox.left,
474 text_bbox.top, 467 text_bbox.top,
475 FXDIB_BLEND_NORMAL, 468 FXDIB_BLEND_NORMAL,
476 pClipRgn 469 pClipRgn
477 ); 470 );
478 return hr; 471 return hr;
479 } 472 }
480 #endif 473 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_dib.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