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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 339 } |
340 if (m_pSource->SkipToScanline(m_CurRow, pPause)) { | 340 if (m_pSource->SkipToScanline(m_CurRow, pPause)) { |
341 return TRUE; | 341 return TRUE; |
342 } | 342 } |
343 int Bpp = m_DestBpp / 8; | 343 int Bpp = m_DestBpp / 8; |
344 int rows_to_go = FX_STRECH_PAUSE_ROWS; | 344 int rows_to_go = FX_STRECH_PAUSE_ROWS; |
345 for (; m_CurRow < m_SrcClip.bottom; m_CurRow ++) { | 345 for (; m_CurRow < m_SrcClip.bottom; m_CurRow ++) { |
346 if (rows_to_go == 0) { | 346 if (rows_to_go == 0) { |
347 if (pPause && pPause->NeedToPauseNow()) { | 347 if (pPause && pPause->NeedToPauseNow()) { |
348 return TRUE; | 348 return TRUE; |
349 } else { | |
350 rows_to_go = FX_STRECH_PAUSE_ROWS; | |
351 } | 349 } |
| 350 rows_to_go = FX_STRECH_PAUSE_ROWS; |
352 } | 351 } |
353 const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow); | 352 const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow); |
354 uint8_t* dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterP
itch; | 353 uint8_t* dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterP
itch; |
355 const uint8_t* src_scan_mask = NULL; | 354 const uint8_t* src_scan_mask = NULL; |
356 uint8_t* dest_scan_mask = NULL; | 355 uint8_t* dest_scan_mask = NULL; |
357 if (m_pExtraAlphaBuf) { | 356 if (m_pExtraAlphaBuf) { |
358 src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); | 357 src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); |
359 dest_scan_mask = m_pExtraAlphaBuf + (m_CurRow - m_SrcClip.top) * m_E
xtraMaskPitch; | 358 dest_scan_mask = m_pExtraAlphaBuf + (m_CurRow - m_SrcClip.top) * m_E
xtraMaskPitch; |
360 } | 359 } |
361 switch (m_TransMethod) { | 360 switch (m_TransMethod) { |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 pal[i] = CmykEncode(c, m, y, k); | 737 pal[i] = CmykEncode(c, m, y, k); |
739 } | 738 } |
740 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { | 739 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { |
741 return FALSE; | 740 return FALSE; |
742 } | 741 } |
743 } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL))
{ | 742 } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL))
{ |
744 return FALSE; | 743 return FALSE; |
745 } | 744 } |
746 if (flags & FXDIB_DOWNSAMPLE) { | 745 if (flags & FXDIB_DOWNSAMPLE) { |
747 return StartQuickStretch(); | 746 return StartQuickStretch(); |
748 } else { | |
749 return StartStretch(); | |
750 } | 747 } |
| 748 return StartStretch(); |
751 } | 749 } |
752 FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) | 750 FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) |
753 { | 751 { |
754 if (m_Flags & FXDIB_DOWNSAMPLE) { | 752 if (m_Flags & FXDIB_DOWNSAMPLE) { |
755 return ContinueQuickStretch(pPause); | 753 return ContinueQuickStretch(pPause); |
756 } else { | |
757 return ContinueStretch(pPause); | |
758 } | 754 } |
| 755 return ContinueStretch(pPause); |
759 } | 756 } |
760 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 | 757 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 |
761 FX_BOOL CFX_ImageStretcher::StartStretch() | 758 FX_BOOL CFX_ImageStretcher::StartStretch() |
762 { | 759 { |
763 m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_
DestHeight, m_ClipRect, m_pSource, m_Flags); | 760 m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_
DestHeight, m_ClipRect, m_pSource, m_Flags); |
764 m_pStretchEngine->StartStretchHorz(); | 761 m_pStretchEngine->StartStretchHorz(); |
765 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { | 762 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { |
766 m_pStretchEngine->Continue(NULL); | 763 m_pStretchEngine->Continue(NULL); |
767 return FALSE; | 764 return FALSE; |
768 } | 765 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 return TRUE; | 826 return TRUE; |
830 } | 827 } |
831 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); | 828 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); |
832 if (m_pMaskScanline) { | 829 if (m_pMaskScanline) { |
833 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); | 830 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); |
834 } | 831 } |
835 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); | 832 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); |
836 } | 833 } |
837 return FALSE; | 834 return FALSE; |
838 } | 835 } |
OLD | NEW |