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

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

Issue 372473003: Remove custom memory manager (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Change malloc to calloc Created 6 years, 5 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/dib/fx_dib_engine.cpp ('k') | core/src/fxge/win32/fx_win32_dib.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 #include "dib_int.h" 10 #include "dib_int.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 int size = pitch * height + 4; 84 int size = pitch * height + 4;
85 int oomlimit = _MAX_OOM_LIMIT_; 85 int oomlimit = _MAX_OOM_LIMIT_;
86 if (oomlimit >= 0 && size >= oomlimit) { 86 if (oomlimit >= 0 && size >= oomlimit) {
87 m_pBuffer = FX_AllocNL(FX_BYTE, size); 87 m_pBuffer = FX_AllocNL(FX_BYTE, size);
88 } else { 88 } else {
89 m_pBuffer = FX_Alloc(FX_BYTE, size); 89 m_pBuffer = FX_Alloc(FX_BYTE, size);
90 } 90 }
91 if (m_pBuffer == NULL) { 91 if (m_pBuffer == NULL) {
92 return FALSE; 92 return FALSE;
93 } 93 }
94 FXSYS_memset32(m_pBuffer, 0, sizeof (FX_BYTE) * size);
95 } 94 }
96 m_Width = width; 95 m_Width = width;
97 m_Height = height; 96 m_Height = height;
98 m_Pitch = pitch; 97 m_Pitch = pitch;
99 if (HasAlpha() && format != FXDIB_Argb) { 98 if (HasAlpha() && format != FXDIB_Argb) {
100 FX_BOOL ret = TRUE; 99 FX_BOOL ret = TRUE;
101 ret = BuildAlphaMask(); 100 ret = BuildAlphaMask();
102 if (!ret) { 101 if (!ret) {
103 if (!m_bExtBuf && m_pBuffer) { 102 if (!m_bExtBuf && m_pBuffer) {
104 FX_Free(m_pBuffer); 103 FX_Free(m_pBuffer);
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 if (!m_pBitmap->Create(width, height, src_format)) { 1725 if (!m_pBitmap->Create(width, height, src_format)) {
1727 delete m_pBitmap; 1726 delete m_pBitmap;
1728 m_pBitmap = NULL; 1727 m_pBitmap = NULL;
1729 return FALSE; 1728 return FALSE;
1730 } 1729 }
1731 if (pSrcPalette) { 1730 if (pSrcPalette) {
1732 m_pBitmap->CopyPalette(pSrcPalette); 1731 m_pBitmap->CopyPalette(pSrcPalette);
1733 } 1732 }
1734 return TRUE; 1733 return TRUE;
1735 } 1734 }
OLDNEW
« no previous file with comments | « core/src/fxge/dib/fx_dib_engine.cpp ('k') | core/src/fxge/win32/fx_win32_dib.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698