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_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if ((1 << 30) / pitch < height) { | 77 if ((1 << 30) / pitch < height) { |
78 return FALSE; | 78 return FALSE; |
79 } | 79 } |
80 if (pBuffer) { | 80 if (pBuffer) { |
81 m_pBuffer = pBuffer; | 81 m_pBuffer = pBuffer; |
82 m_bExtBuf = TRUE; | 82 m_bExtBuf = TRUE; |
83 } else { | 83 } else { |
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_TryAlloc(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 } | 94 } |
95 m_Width = width; | 95 m_Width = width; |
96 m_Height = height; | 96 m_Height = height; |
97 m_Pitch = pitch; | 97 m_Pitch = pitch; |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 if (!m_pBitmap->Create(width, height, src_format)) { | 1681 if (!m_pBitmap->Create(width, height, src_format)) { |
1682 delete m_pBitmap; | 1682 delete m_pBitmap; |
1683 m_pBitmap = NULL; | 1683 m_pBitmap = NULL; |
1684 return FALSE; | 1684 return FALSE; |
1685 } | 1685 } |
1686 if (pSrcPalette) { | 1686 if (pSrcPalette) { |
1687 m_pBitmap->CopyPalette(pSrcPalette); | 1687 m_pBitmap->CopyPalette(pSrcPalette); |
1688 } | 1688 } |
1689 return TRUE; | 1689 return TRUE; |
1690 } | 1690 } |
OLD | NEW |