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 "dib_int.h" | 9 #include "dib_int.h" |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 m_bFlipY = TRUE; | 789 m_bFlipY = TRUE; |
790 m_DestHeight = -m_DestHeight; | 790 m_DestHeight = -m_DestHeight; |
791 } | 791 } |
792 m_LineIndex = 0; | 792 m_LineIndex = 0; |
793 FX_DWORD size = m_ClipRect.Width(); | 793 FX_DWORD size = m_ClipRect.Width(); |
794 if (size && m_DestBPP > (int)(INT_MAX / size)) { | 794 if (size && m_DestBPP > (int)(INT_MAX / size)) { |
795 return FALSE; | 795 return FALSE; |
796 } | 796 } |
797 size *= m_DestBPP; | 797 size *= m_DestBPP; |
798 m_pScanline = FX_Alloc(FX_BYTE, (size / 8 + 3) / 4 * 4); | 798 m_pScanline = FX_Alloc(FX_BYTE, (size / 8 + 3) / 4 * 4); |
| 799 if (!m_pScanline) { |
| 800 return FALSE; |
| 801 } |
799 if (m_pSource->m_pAlphaMask) { | 802 if (m_pSource->m_pAlphaMask) { |
800 m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); | 803 m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); |
| 804 if (!m_pMaskScanline) { |
| 805 return FALSE; |
| 806 } |
801 } | 807 } |
802 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { | 808 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { |
803 ContinueQuickStretch(NULL); | 809 ContinueQuickStretch(NULL); |
804 return FALSE; | 810 return FALSE; |
805 } | 811 } |
806 return TRUE; | 812 return TRUE; |
807 } | 813 } |
808 FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) | 814 FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) |
809 { | 815 { |
810 if (m_pScanline == NULL) { | 816 if (m_pScanline == NULL) { |
(...skipping 20 matching lines...) Expand all Loading... |
831 return TRUE; | 837 return TRUE; |
832 } | 838 } |
833 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); | 839 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); |
834 if (m_pMaskScanline) { | 840 if (m_pMaskScanline) { |
835 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); | 841 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); |
836 } | 842 } |
837 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); | 843 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); |
838 } | 844 } |
839 return FALSE; | 845 return FALSE; |
840 } | 846 } |
OLD | NEW |