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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 FXSYS_memset(m_pDestScanline, 255, size); | 210 FXSYS_memset(m_pDestScanline, 255, size); |
211 } | 211 } |
212 m_InterPitch = (m_DestClip.Width() * m_DestBpp + 31) / 32 * 4; | 212 m_InterPitch = (m_DestClip.Width() * m_DestBpp + 31) / 32 * 4; |
213 m_ExtraMaskPitch = (m_DestClip.Width() * 8 + 31) / 32 * 4; | 213 m_ExtraMaskPitch = (m_DestClip.Width() * 8 + 31) / 32 * 4; |
214 m_pInterBuf = NULL; | 214 m_pInterBuf = NULL; |
215 m_pSource = pSrcBitmap; | 215 m_pSource = pSrcBitmap; |
216 m_SrcWidth = pSrcBitmap->GetWidth(); | 216 m_SrcWidth = pSrcBitmap->GetWidth(); |
217 m_SrcHeight = pSrcBitmap->GetHeight(); | 217 m_SrcHeight = pSrcBitmap->GetHeight(); |
218 m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4; | 218 m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4; |
219 if ((flags & FXDIB_NOSMOOTH) == 0) { | 219 if ((flags & FXDIB_NOSMOOTH) == 0) { |
220 FX_BOOL bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTE
RPOL; | 220 bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPO
L; |
221 if (!bInterpol && FXSYS_abs(dest_width) != 0 && FXSYS_abs(dest_height) <
m_SrcWidth * m_SrcHeight * 8 / FXSYS_abs(dest_width)) { | 221 if (!bInterpol && FXSYS_abs(dest_width) != 0 && FXSYS_abs(dest_height) <
m_SrcWidth * m_SrcHeight * 8 / FXSYS_abs(dest_width)) { |
222 flags = FXDIB_INTERPOL; | 222 flags = FXDIB_INTERPOL; |
223 } | 223 } |
224 m_Flags = flags; | 224 m_Flags = flags; |
225 } else { | 225 } else { |
226 m_Flags = FXDIB_NOSMOOTH; | 226 m_Flags = FXDIB_NOSMOOTH; |
227 if (flags & FXDIB_DOWNSAMPLE) { | 227 if (flags & FXDIB_DOWNSAMPLE) { |
228 m_Flags |= FXDIB_DOWNSAMPLE; | 228 m_Flags |= FXDIB_DOWNSAMPLE; |
229 } | 229 } |
230 } | 230 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 } | 274 } |
275 } else { | 275 } else { |
276 if (!m_bHasAlpha) { | 276 if (!m_bHasAlpha) { |
277 m_TransMethod = 7; | 277 m_TransMethod = 7; |
278 } else { | 278 } else { |
279 m_TransMethod = 8; | 279 m_TransMethod = 8; |
280 } | 280 } |
281 } | 281 } |
282 } | 282 } |
283 FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause) | 283 bool CStretchEngine::Continue(IFX_Pause* pPause) |
284 { | 284 { |
285 while (m_State == 1) { | 285 while (m_State == 1) { |
286 if (ContinueStretchHorz(pPause)) { | 286 if (ContinueStretchHorz(pPause)) { |
287 return TRUE; | 287 return true; |
288 } | 288 } |
289 m_State = 2; | 289 m_State = 2; |
290 StretchVert(); | 290 StretchVert(); |
291 } | 291 } |
292 return FALSE; | 292 return false; |
293 } | 293 } |
294 CStretchEngine::~CStretchEngine() | 294 CStretchEngine::~CStretchEngine() |
295 { | 295 { |
296 if (m_pDestScanline) { | 296 if (m_pDestScanline) { |
297 FX_Free(m_pDestScanline); | 297 FX_Free(m_pDestScanline); |
298 } | 298 } |
299 if (m_pInterBuf) { | 299 if (m_pInterBuf) { |
300 FX_Free(m_pInterBuf); | 300 FX_Free(m_pInterBuf); |
301 } | 301 } |
302 if (m_pExtraAlphaBuf) { | 302 if (m_pExtraAlphaBuf) { |
303 FX_Free(m_pExtraAlphaBuf); | 303 FX_Free(m_pExtraAlphaBuf); |
304 } | 304 } |
305 if (m_pDestMaskScanline) { | 305 if (m_pDestMaskScanline) { |
306 FX_Free(m_pDestMaskScanline); | 306 FX_Free(m_pDestMaskScanline); |
307 } | 307 } |
308 } | 308 } |
309 FX_BOOL CStretchEngine::StartStretchHorz() | 309 bool CStretchEngine::StartStretchHorz() |
310 { | 310 { |
311 if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int
)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) { | 311 if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int
)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) { |
312 return FALSE; | 312 return false; |
313 } | 313 } |
314 m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch); | 314 m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch); |
315 if (m_pInterBuf == NULL) { | 315 if (m_pInterBuf == NULL) { |
316 return FALSE; | 316 return false; |
317 } | 317 } |
318 if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) { | 318 if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) { |
319 m_pExtraAlphaBuf = FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_Extra
MaskPitch); | 319 m_pExtraAlphaBuf = FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_Extra
MaskPitch); |
320 FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4; | 320 FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4; |
321 m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); | 321 m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); |
322 if (!m_pDestMaskScanline) { | 322 if (!m_pDestMaskScanline) { |
323 return FALSE; | 323 return false; |
324 } | 324 } |
325 } | 325 } |
326 m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidt
h, m_SrcClip.left, m_SrcClip.right, m_Flags); | 326 m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidt
h, m_SrcClip.left, m_SrcClip.right, m_Flags); |
327 if (m_WeightTable.m_pWeightTables == NULL) { | 327 if (m_WeightTable.m_pWeightTables == NULL) { |
328 return FALSE; | 328 return false; |
329 } | 329 } |
330 m_CurRow = m_SrcClip.top; | 330 m_CurRow = m_SrcClip.top; |
331 m_State = 1; | 331 m_State = 1; |
332 return TRUE; | 332 return true; |
333 } | 333 } |
334 #define FX_STRECH_PAUSE_ROWS 10 | 334 #define FX_STRECH_PAUSE_ROWS 10 |
335 FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) | 335 bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) |
336 { | 336 { |
337 if (!m_DestWidth) { | 337 if (!m_DestWidth) { |
338 return 0; | 338 return 0; |
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 { | 349 } else { |
350 rows_to_go = FX_STRECH_PAUSE_ROWS; | 350 rows_to_go = FX_STRECH_PAUSE_ROWS; |
351 } | 351 } |
352 } | 352 } |
353 const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow); | 353 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; | 354 uint8_t* dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterP
itch; |
355 const uint8_t* src_scan_mask = NULL; | 355 const uint8_t* src_scan_mask = NULL; |
356 uint8_t* dest_scan_mask = NULL; | 356 uint8_t* dest_scan_mask = NULL; |
357 if (m_pExtraAlphaBuf) { | 357 if (m_pExtraAlphaBuf) { |
358 src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); | 358 src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 if (dest_scan_mask) { | 526 if (dest_scan_mask) { |
527 *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); | 527 *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); |
528 } | 528 } |
529 dest_scan += Bpp - 3; | 529 dest_scan += Bpp - 3; |
530 } | 530 } |
531 break; | 531 break; |
532 } | 532 } |
533 } | 533 } |
534 rows_to_go --; | 534 rows_to_go --; |
535 } | 535 } |
536 return FALSE; | 536 return false; |
537 } | 537 } |
538 void CStretchEngine::StretchVert() | 538 void CStretchEngine::StretchVert() |
539 { | 539 { |
540 if (m_DestHeight == 0) { | 540 if (m_DestHeight == 0) { |
541 return; | 541 return; |
542 } | 542 } |
543 CWeightTable table; | 543 CWeightTable table; |
544 table.Calc(m_DestHeight, m_DestClip.top, m_DestClip.bottom, m_SrcHeight, m_S
rcClip.top, m_SrcClip.bottom, m_Flags); | 544 table.Calc(m_DestHeight, m_DestClip.top, m_DestClip.bottom, m_SrcHeight, m_S
rcClip.top, m_SrcClip.bottom, m_Flags); |
545 if (table.m_pWeightTables == NULL) { | 545 if (table.m_pWeightTables == NULL) { |
546 return; | 546 return; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 format = FXDIB_8bppMask; | 691 format = FXDIB_8bppMask; |
692 } else if (format == FXDIB_1bppRgb) { | 692 } else if (format == FXDIB_1bppRgb) { |
693 format = FXDIB_8bppRgb; | 693 format = FXDIB_8bppRgb; |
694 } else if (format == FXDIB_8bppRgb) { | 694 } else if (format == FXDIB_8bppRgb) { |
695 if (pSrc->GetPalette()) { | 695 if (pSrc->GetPalette()) { |
696 format = FXDIB_Rgb; | 696 format = FXDIB_Rgb; |
697 } | 697 } |
698 } | 698 } |
699 return format; | 699 return format; |
700 } | 700 } |
701 FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, | 701 bool CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, |
702 const CFX_DIBSource* pSource, int dest_width,
int dest_height, | 702 const CFX_DIBSource* pSource, int dest_width,
int dest_height, |
703 const FX_RECT& rect, FX_DWORD flags) | 703 const FX_RECT& rect, FX_DWORD flags) |
704 { | 704 { |
705 m_DestFormat = _GetStretchedFormat(pSource); | 705 m_DestFormat = _GetStretchedFormat(pSource); |
706 m_DestBPP = m_DestFormat & 0xff; | 706 m_DestBPP = m_DestFormat & 0xff; |
707 m_pDest = pDest; | 707 m_pDest = pDest; |
708 m_pSource = pSource; | 708 m_pSource = pSource; |
709 m_DestWidth = dest_width; | 709 m_DestWidth = dest_width; |
710 m_DestHeight = dest_height; | 710 m_DestHeight = dest_height; |
711 m_ClipRect = rect; | 711 m_ClipRect = rect; |
712 m_Flags = flags; | 712 m_Flags = flags; |
713 if (pSource->GetFormat() == FXDIB_1bppRgb && pSource->GetPalette()) { | 713 if (pSource->GetFormat() == FXDIB_1bppRgb && pSource->GetPalette()) { |
714 FX_ARGB pal[256]; | 714 FX_ARGB pal[256]; |
715 int a0, r0, g0, b0, a1, r1, g1, b1; | 715 int a0, r0, g0, b0, a1, r1, g1, b1; |
716 ArgbDecode(pSource->GetPaletteEntry(0), a0, r0, g0, b0); | 716 ArgbDecode(pSource->GetPaletteEntry(0), a0, r0, g0, b0); |
717 ArgbDecode(pSource->GetPaletteEntry(1), a1, r1, g1, b1); | 717 ArgbDecode(pSource->GetPaletteEntry(1), a1, r1, g1, b1); |
718 for (int i = 0; i < 256; i ++) { | 718 for (int i = 0; i < 256; i ++) { |
719 int a = a0 + (a1 - a0) * i / 255; | 719 int a = a0 + (a1 - a0) * i / 255; |
720 int r = r0 + (r1 - r0) * i / 255; | 720 int r = r0 + (r1 - r0) * i / 255; |
721 int g = g0 + (g1 - g0) * i / 255; | 721 int g = g0 + (g1 - g0) * i / 255; |
722 int b = b0 + (b1 - b0) * i / 255; | 722 int b = b0 + (b1 - b0) * i / 255; |
723 pal[i] = ArgbEncode(a, r, g, b); | 723 pal[i] = ArgbEncode(a, r, g, b); |
724 } | 724 } |
725 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { | 725 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { |
726 return FALSE; | 726 return false; |
727 } | 727 } |
728 } else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette())
{ | 728 } else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette())
{ |
729 FX_CMYK pal[256]; | 729 FX_CMYK pal[256]; |
730 int c0, m0, y0, k0, c1, m1, y1, k1; | 730 int c0, m0, y0, k0, c1, m1, y1, k1; |
731 CmykDecode(pSource->GetPaletteEntry(0), c0, m0, y0, k0); | 731 CmykDecode(pSource->GetPaletteEntry(0), c0, m0, y0, k0); |
732 CmykDecode(pSource->GetPaletteEntry(1), c1, m1, y1, k1); | 732 CmykDecode(pSource->GetPaletteEntry(1), c1, m1, y1, k1); |
733 for (int i = 0; i < 256; i ++) { | 733 for (int i = 0; i < 256; i ++) { |
734 int c = c0 + (c1 - c0) * i / 255; | 734 int c = c0 + (c1 - c0) * i / 255; |
735 int m = m0 + (m1 - m0) * i / 255; | 735 int m = m0 + (m1 - m0) * i / 255; |
736 int y = y0 + (y1 - y0) * i / 255; | 736 int y = y0 + (y1 - y0) * i / 255; |
737 int k = k0 + (k1 - k0) * i / 255; | 737 int k = k0 + (k1 - k0) * i / 255; |
738 pal[i] = CmykEncode(c, m, y, k); | 738 pal[i] = CmykEncode(c, m, y, k); |
739 } | 739 } |
740 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { | 740 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { |
741 return FALSE; | 741 return false; |
742 } | 742 } |
743 } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL))
{ | 743 } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL))
{ |
744 return FALSE; | 744 return false; |
745 } | 745 } |
746 if (flags & FXDIB_DOWNSAMPLE) { | 746 if (flags & FXDIB_DOWNSAMPLE) { |
747 return StartQuickStretch(); | 747 return StartQuickStretch(); |
748 } else { | 748 } else { |
749 return StartStretch(); | 749 return StartStretch(); |
750 } | 750 } |
751 } | 751 } |
752 FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) | 752 bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) |
753 { | 753 { |
754 if (m_Flags & FXDIB_DOWNSAMPLE) { | 754 if (m_Flags & FXDIB_DOWNSAMPLE) { |
755 return ContinueQuickStretch(pPause); | 755 return ContinueQuickStretch(pPause); |
756 } else { | 756 } else { |
757 return ContinueStretch(pPause); | 757 return ContinueStretch(pPause); |
758 } | 758 } |
759 } | 759 } |
760 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 | 760 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 |
761 FX_BOOL CFX_ImageStretcher::StartStretch() | 761 bool CFX_ImageStretcher::StartStretch() |
762 { | 762 { |
763 m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_
DestHeight, m_ClipRect, m_pSource, m_Flags); | 763 m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_
DestHeight, m_ClipRect, m_pSource, m_Flags); |
764 m_pStretchEngine->StartStretchHorz(); | 764 m_pStretchEngine->StartStretchHorz(); |
765 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { | 765 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { |
766 m_pStretchEngine->Continue(NULL); | 766 m_pStretchEngine->Continue(NULL); |
767 return FALSE; | 767 return false; |
768 } | 768 } |
769 return TRUE; | 769 return true; |
770 } | 770 } |
771 FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) | 771 bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) |
772 { | 772 { |
773 if (m_pStretchEngine == NULL) { | 773 if (m_pStretchEngine == NULL) { |
774 return FALSE; | 774 return false; |
775 } | 775 } |
776 return m_pStretchEngine->Continue(pPause); | 776 return m_pStretchEngine->Continue(pPause); |
777 } | 777 } |
778 FX_BOOL CFX_ImageStretcher::StartQuickStretch() | 778 bool CFX_ImageStretcher::StartQuickStretch() |
779 { | 779 { |
780 m_bFlipX = FALSE; | 780 m_bFlipX = false; |
781 m_bFlipY = FALSE; | 781 m_bFlipY = false; |
782 if (m_DestWidth < 0) { | 782 if (m_DestWidth < 0) { |
783 m_bFlipX = TRUE; | 783 m_bFlipX = true; |
784 m_DestWidth = -m_DestWidth; | 784 m_DestWidth = -m_DestWidth; |
785 } | 785 } |
786 if (m_DestHeight < 0) { | 786 if (m_DestHeight < 0) { |
787 m_bFlipY = TRUE; | 787 m_bFlipY = true; |
788 m_DestHeight = -m_DestHeight; | 788 m_DestHeight = -m_DestHeight; |
789 } | 789 } |
790 m_LineIndex = 0; | 790 m_LineIndex = 0; |
791 FX_DWORD size = m_ClipRect.Width(); | 791 FX_DWORD size = m_ClipRect.Width(); |
792 if (size && m_DestBPP > (int)(INT_MAX / size)) { | 792 if (size && m_DestBPP > (int)(INT_MAX / size)) { |
793 return FALSE; | 793 return false; |
794 } | 794 } |
795 size *= m_DestBPP; | 795 size *= m_DestBPP; |
796 m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); | 796 m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); |
797 if (m_pSource->m_pAlphaMask) { | 797 if (m_pSource->m_pAlphaMask) { |
798 m_pMaskScanline = FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4); | 798 m_pMaskScanline = FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4); |
799 } | 799 } |
800 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { | 800 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH
_PIXELS) { |
801 ContinueQuickStretch(NULL); | 801 ContinueQuickStretch(NULL); |
802 return FALSE; | 802 return false; |
803 } | 803 } |
804 return TRUE; | 804 return true; |
805 } | 805 } |
806 FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) | 806 bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) |
807 { | 807 { |
808 if (m_pScanline == NULL) { | 808 if (m_pScanline == NULL) { |
809 return FALSE; | 809 return false; |
810 } | 810 } |
811 int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height(); | 811 int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height(); |
812 int src_height = m_pSource->GetHeight(); | 812 int src_height = m_pSource->GetHeight(); |
813 for (; m_LineIndex < result_height; m_LineIndex ++) { | 813 for (; m_LineIndex < result_height; m_LineIndex ++) { |
814 int dest_y, src_y; | 814 int dest_y, src_y; |
815 if (m_bFlipY) { | 815 if (m_bFlipY) { |
816 dest_y = result_height - m_LineIndex - 1; | 816 dest_y = result_height - m_LineIndex - 1; |
817 src_y = (m_DestHeight - (dest_y + m_ClipRect.top) - 1) * src_height
/ m_DestHeight; | 817 src_y = (m_DestHeight - (dest_y + m_ClipRect.top) - 1) * src_height
/ m_DestHeight; |
818 } else { | 818 } else { |
819 dest_y = m_LineIndex; | 819 dest_y = m_LineIndex; |
820 src_y = (dest_y + m_ClipRect.top) * src_height / m_DestHeight; | 820 src_y = (dest_y + m_ClipRect.top) * src_height / m_DestHeight; |
821 } | 821 } |
822 if (src_y >= src_height) { | 822 if (src_y >= src_height) { |
823 src_y = src_height - 1; | 823 src_y = src_height - 1; |
824 } | 824 } |
825 if (src_y < 0) { | 825 if (src_y < 0) { |
826 src_y = 0; | 826 src_y = 0; |
827 } | 827 } |
828 if (m_pSource->SkipToScanline(src_y, pPause)) { | 828 if (m_pSource->SkipToScanline(src_y, pPause)) { |
829 return TRUE; | 829 return true; |
830 } | 830 } |
831 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); | 831 m_pSource->DownSampleScanline(src_y, m_pScanline, m_DestBPP, m_DestWidth
, m_bFlipX, m_ClipRect.left, result_width); |
832 if (m_pMaskScanline) { | 832 if (m_pMaskScanline) { |
833 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); | 833 m_pSource->m_pAlphaMask->DownSampleScanline(src_y, m_pMaskScanline,
1, m_DestWidth, m_bFlipX, m_ClipRect.left, result_width); |
834 } | 834 } |
835 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); | 835 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); |
836 } | 836 } |
837 return FALSE; | 837 return false; |
838 } | 838 } |
OLD | NEW |