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 } | |
802 if (m_pSource->m_pAlphaMask) { | 799 if (m_pSource->m_pAlphaMask) { |
803 m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); | 800 m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); |
804 if (!m_pMaskScanline) { | |
805 return FALSE; | |
806 } | |
807 } | 801 } |
808 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { | 802 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { |
809 ContinueQuickStretch(NULL); | 803 ContinueQuickStretch(NULL); |
810 return FALSE; | 804 return FALSE; |
811 } | 805 } |
812 return TRUE; | 806 return TRUE; |
813 } | 807 } |
814 FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) | 808 FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) |
815 { | 809 { |
816 if (m_pScanline == NULL) { | 810 if (m_pScanline == NULL) { |
(...skipping 20 matching lines...) Expand all Loading... |
837 return TRUE; | 831 return TRUE; |
838 } | 832 } |
839 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); | 833 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); |
840 if (m_pMaskScanline) { | 834 if (m_pMaskScanline) { |
841 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); | 835 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); |
842 } | 836 } |
843 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); | 837 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); |
844 } | 838 } |
845 return FALSE; | 839 return FALSE; |
846 } | 840 } |
OLD | NEW |