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

Side by Side Diff: core/src/fxge/dib/fx_dib_convert.cpp

Issue 1144683002: Merge to XFA: Abort on OOM by default in FX_Alloc(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Suppress failing tests 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/fxcrt/fx_basic_memmgr_unittest.cpp ('k') | core/src/fxge/dib/fx_dib_engine.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_dib.h" 7 #include "../../../include/fxge/fx_dib.h"
8 #include "../../../include/fxge/fx_ge.h" 8 #include "../../../include/fxge/fx_ge.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 const FX_DWORD g_dwWinPalette[256] = { 10 const FX_DWORD g_dwWinPalette[256] = {
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 FX_LPBYTE scanline = m_pBuffer + row * m_Pitch + 3; 1008 FX_LPBYTE scanline = m_pBuffer + row * m_Pitch + 3;
1009 for (int col = 0; col < m_Width; col ++) { 1009 for (int col = 0; col < m_Width; col ++) {
1010 *scanline = 0xff; 1010 *scanline = 0xff;
1011 scanline += 4; 1011 scanline += 4;
1012 } 1012 }
1013 } 1013 }
1014 return TRUE; 1014 return TRUE;
1015 } 1015 }
1016 int dest_bpp = dest_format & 0xff; 1016 int dest_bpp = dest_format & 0xff;
1017 int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; 1017 int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4;
1018 FX_LPBYTE dest_buf = FX_AllocNL(FX_BYTE, dest_pitch * m_Height + 4); 1018 FX_LPBYTE dest_buf = FX_TryAlloc(FX_BYTE, dest_pitch * m_Height + 4);
1019 if (dest_buf == NULL) { 1019 if (dest_buf == NULL) {
1020 return FALSE; 1020 return FALSE;
1021 } 1021 }
1022 CFX_DIBitmap* pAlphaMask = NULL; 1022 CFX_DIBitmap* pAlphaMask = NULL;
1023 if (dest_format == FXDIB_Argb) { 1023 if (dest_format == FXDIB_Argb) {
1024 FXSYS_memset8(dest_buf, 0xff, dest_pitch * m_Height + 4); 1024 FXSYS_memset8(dest_buf, 0xff, dest_pitch * m_Height + 4);
1025 if (m_pAlphaMask) { 1025 if (m_pAlphaMask) {
1026 for (int row = 0; row < m_Height; row ++) { 1026 for (int row = 0; row < m_Height; row ++) {
1027 FX_LPBYTE pDstScanline = dest_buf + row * dest_pitch + 3; 1027 FX_LPBYTE pDstScanline = dest_buf + row * dest_pitch + 3;
1028 FX_LPCBYTE pSrcScanline = m_pAlphaMask->GetScanline(row); 1028 FX_LPCBYTE pSrcScanline = m_pAlphaMask->GetScanline(row);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 if (!m_bExtBuf) { 1078 if (!m_bExtBuf) {
1079 FX_Free(m_pBuffer); 1079 FX_Free(m_pBuffer);
1080 } 1080 }
1081 m_bExtBuf = FALSE; 1081 m_bExtBuf = FALSE;
1082 m_pBuffer = dest_buf; 1082 m_pBuffer = dest_buf;
1083 m_bpp = (FX_BYTE)dest_format; 1083 m_bpp = (FX_BYTE)dest_format;
1084 m_AlphaFlag = (FX_BYTE)(dest_format >> 8); 1084 m_AlphaFlag = (FX_BYTE)(dest_format >> 8);
1085 m_Pitch = dest_pitch; 1085 m_Pitch = dest_pitch;
1086 return TRUE; 1086 return TRUE;
1087 } 1087 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_memmgr_unittest.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698