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

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

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. Created 5 years, 7 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_gdipext.cpp ('k') | fpdfsdk/src/fsdk_baseform.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 <windows.h> 9 #include <windows.h>
10 #include "../../../include/fxge/fx_ge_win32.h" 10 #include "../../../include/fxge/fx_ge_win32.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 m_pPSOutput = new CPSOutput(hDC); 288 m_pPSOutput = new CPSOutput(hDC);
289 ((CPSOutput*)m_pPSOutput)->Init(); 289 ((CPSOutput*)m_pPSOutput)->Init();
290 m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); 290 m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput);
291 m_bCmykOutput = bCmykOutput; 291 m_bCmykOutput = bCmykOutput;
292 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1); 292 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1);
293 int ret = ::GetClipRgn(hDC, hRgn); 293 int ret = ::GetClipRgn(hDC, hRgn);
294 if (ret == 1) { 294 if (ret == 1) {
295 ret = ::GetRegionData(hRgn, 0, NULL); 295 ret = ::GetRegionData(hRgn, 0, NULL);
296 if (ret) { 296 if (ret) {
297 RGNDATA* pData = (RGNDATA*)FX_Alloc(FX_BYTE, ret); 297 RGNDATA* pData = (RGNDATA*)FX_Alloc(FX_BYTE, ret);
298 if (!pData) {
299 return FALSE;
300 }
301 ret = ::GetRegionData(hRgn, ret, pData); 298 ret = ::GetRegionData(hRgn, ret, pData);
302 if (ret) { 299 if (ret) {
303 CFX_PathData path; 300 CFX_PathData path;
304 path.AllocPointCount(pData->rdh.nCount * 5); 301 path.AllocPointCount(pData->rdh.nCount * 5);
305 for (FX_DWORD i = 0; i < pData->rdh.nCount; i ++) { 302 for (FX_DWORD i = 0; i < pData->rdh.nCount; i ++) {
306 RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize * i); 303 RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize * i);
307 path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bott om, (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top); 304 path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bott om, (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top);
308 } 305 }
309 m_PSRenderer.SetClip_PathFill(&path, NULL, FXFILL_WINDING); 306 m_PSRenderer.SetClip_PathFill(&path, NULL, FXFILL_WINDING);
310 } 307 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 handle = NULL; 405 handle = NULL;
409 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_ flag, pIccTransform); 406 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_ flag, pIccTransform);
410 } 407 }
411 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar Pos, CFX_Font* pFont, 408 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar Pos, CFX_Font* pFont,
412 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, 409 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color,
413 int alpha_flag, void* pIccTransform) 410 int alpha_flag, void* pIccTransform)
414 { 411 {
415 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device , font_size, color, alpha_flag, pIccTransform); 412 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device , font_size, color, alpha_flag, pIccTransform);
416 } 413 }
417 #endif 414 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_gdipext.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698