Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: core/src/fxge/dib/fx_dib_engine.cpp

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/dib/fx_dib_convert.cpp ('k') | core/src/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 } 349 }
350 rows_to_go = FX_STRECH_PAUSE_ROWS; 350 rows_to_go = FX_STRECH_PAUSE_ROWS;
351 } 351 }
352 const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow); 352 const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow);
353 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;
354 const uint8_t* src_scan_mask = NULL; 354 const uint8_t* src_scan_mask = NULL;
355 uint8_t* dest_scan_mask = NULL; 355 uint8_t* dest_scan_mask = NULL;
356 if (m_pExtraAlphaBuf) { 356 if (m_pExtraAlphaBuf) {
357 src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow); 357 src_scan_mask = m_pSource->m_pAlphaMask->GetScanline(m_CurRow);
358 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;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (dest_scan_mask) { 525 if (dest_scan_mask) {
526 *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16); 526 *dest_scan_mask++ = (uint8_t)((dest_a * 255) >> 16);
527 } 527 }
528 dest_scan += Bpp - 3; 528 dest_scan += Bpp - 3;
529 } 529 }
530 break; 530 break;
531 } 531 }
532 } 532 }
533 rows_to_go --; 533 rows_to_go --;
534 } 534 }
535 return FALSE; 535 return false;
536 } 536 }
537 void CStretchEngine::StretchVert() 537 void CStretchEngine::StretchVert()
538 { 538 {
539 if (m_DestHeight == 0) { 539 if (m_DestHeight == 0) {
540 return; 540 return;
541 } 541 }
542 CWeightTable table; 542 CWeightTable table;
543 table.Calc(m_DestHeight, m_DestClip.top, m_DestClip.bottom, m_SrcHeight, m_S rcClip.top, m_SrcClip.bottom, m_Flags); 543 table.Calc(m_DestHeight, m_DestClip.top, m_DestClip.bottom, m_SrcHeight, m_S rcClip.top, m_SrcClip.bottom, m_Flags);
544 if (table.m_pWeightTables == NULL) { 544 if (table.m_pWeightTables == NULL) {
545 return; 545 return;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 format = FXDIB_8bppMask; 690 format = FXDIB_8bppMask;
691 } else if (format == FXDIB_1bppRgb) { 691 } else if (format == FXDIB_1bppRgb) {
692 format = FXDIB_8bppRgb; 692 format = FXDIB_8bppRgb;
693 } else if (format == FXDIB_8bppRgb) { 693 } else if (format == FXDIB_8bppRgb) {
694 if (pSrc->GetPalette()) { 694 if (pSrc->GetPalette()) {
695 format = FXDIB_Rgb; 695 format = FXDIB_Rgb;
696 } 696 }
697 } 697 }
698 return format; 698 return format;
699 } 699 }
700 FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, 700 bool CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
701 const CFX_DIBSource* pSource, int dest_width, int dest_height, 701 const CFX_DIBSource* pSource, int dest_width, int dest_height,
702 const FX_RECT& rect, FX_DWORD flags) 702 const FX_RECT& rect, FX_DWORD flags)
703 { 703 {
704 m_DestFormat = _GetStretchedFormat(pSource); 704 m_DestFormat = _GetStretchedFormat(pSource);
705 m_DestBPP = m_DestFormat & 0xff; 705 m_DestBPP = m_DestFormat & 0xff;
706 m_pDest = pDest; 706 m_pDest = pDest;
707 m_pSource = pSource; 707 m_pSource = pSource;
708 m_DestWidth = dest_width; 708 m_DestWidth = dest_width;
709 m_DestHeight = dest_height; 709 m_DestHeight = dest_height;
710 m_ClipRect = rect; 710 m_ClipRect = rect;
711 m_Flags = flags; 711 m_Flags = flags;
712 if (pSource->GetFormat() == FXDIB_1bppRgb && pSource->GetPalette()) { 712 if (pSource->GetFormat() == FXDIB_1bppRgb && pSource->GetPalette()) {
713 FX_ARGB pal[256]; 713 FX_ARGB pal[256];
714 int a0, r0, g0, b0, a1, r1, g1, b1; 714 int a0, r0, g0, b0, a1, r1, g1, b1;
715 ArgbDecode(pSource->GetPaletteEntry(0), a0, r0, g0, b0); 715 ArgbDecode(pSource->GetPaletteEntry(0), a0, r0, g0, b0);
716 ArgbDecode(pSource->GetPaletteEntry(1), a1, r1, g1, b1); 716 ArgbDecode(pSource->GetPaletteEntry(1), a1, r1, g1, b1);
717 for (int i = 0; i < 256; i ++) { 717 for (int i = 0; i < 256; i ++) {
718 int a = a0 + (a1 - a0) * i / 255; 718 int a = a0 + (a1 - a0) * i / 255;
719 int r = r0 + (r1 - r0) * i / 255; 719 int r = r0 + (r1 - r0) * i / 255;
720 int g = g0 + (g1 - g0) * i / 255; 720 int g = g0 + (g1 - g0) * i / 255;
721 int b = b0 + (b1 - b0) * i / 255; 721 int b = b0 + (b1 - b0) * i / 255;
722 pal[i] = ArgbEncode(a, r, g, b); 722 pal[i] = ArgbEncode(a, r, g, b);
723 } 723 }
724 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { 724 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) {
725 return FALSE; 725 return false;
726 } 726 }
727 } else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette()) { 727 } else if (pSource->GetFormat() == FXDIB_1bppCmyk && pSource->GetPalette()) {
728 FX_CMYK pal[256]; 728 FX_CMYK pal[256];
729 int c0, m0, y0, k0, c1, m1, y1, k1; 729 int c0, m0, y0, k0, c1, m1, y1, k1;
730 CmykDecode(pSource->GetPaletteEntry(0), c0, m0, y0, k0); 730 CmykDecode(pSource->GetPaletteEntry(0), c0, m0, y0, k0);
731 CmykDecode(pSource->GetPaletteEntry(1), c1, m1, y1, k1); 731 CmykDecode(pSource->GetPaletteEntry(1), c1, m1, y1, k1);
732 for (int i = 0; i < 256; i ++) { 732 for (int i = 0; i < 256; i ++) {
733 int c = c0 + (c1 - c0) * i / 255; 733 int c = c0 + (c1 - c0) * i / 255;
734 int m = m0 + (m1 - m0) * i / 255; 734 int m = m0 + (m1 - m0) * i / 255;
735 int y = y0 + (y1 - y0) * i / 255; 735 int y = y0 + (y1 - y0) * i / 255;
736 int k = k0 + (k1 - k0) * i / 255; 736 int k = k0 + (k1 - k0) * i / 255;
737 pal[i] = CmykEncode(c, m, y, k); 737 pal[i] = CmykEncode(c, m, y, k);
738 } 738 }
739 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) { 739 if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, pal)) {
740 return FALSE; 740 return false;
741 } 741 }
742 } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL)) { 742 } else if (!pDest->SetInfo(rect.Width(), rect.Height(), m_DestFormat, NULL)) {
743 return FALSE; 743 return false;
744 } 744 }
745 if (flags & FXDIB_DOWNSAMPLE) { 745 if (flags & FXDIB_DOWNSAMPLE) {
746 return StartQuickStretch(); 746 return StartQuickStretch();
747 } 747 }
748 return StartStretch(); 748 return StartStretch();
749 } 749 }
750 FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) 750 bool CFX_ImageStretcher::Continue(IFX_Pause* pPause)
751 { 751 {
752 if (m_Flags & FXDIB_DOWNSAMPLE) { 752 if (m_Flags & FXDIB_DOWNSAMPLE) {
753 return ContinueQuickStretch(pPause); 753 return ContinueQuickStretch(pPause);
754 } 754 }
755 return ContinueStretch(pPause); 755 return ContinueStretch(pPause);
756 } 756 }
757 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 757 #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000
758 FX_BOOL CFX_ImageStretcher::StartStretch() 758 bool CFX_ImageStretcher::StartStretch()
759 { 759 {
760 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);
761 m_pStretchEngine->StartStretchHorz(); 761 m_pStretchEngine->StartStretchHorz();
762 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH _PIXELS) { 762 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH _PIXELS) {
763 m_pStretchEngine->Continue(NULL); 763 m_pStretchEngine->Continue(NULL);
764 return FALSE; 764 return false;
765 } 765 }
766 return TRUE; 766 return true;
767 } 767 }
768 FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) 768 bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause)
769 { 769 {
770 if (m_pStretchEngine == NULL) { 770 if (m_pStretchEngine == NULL) {
771 return FALSE; 771 return false;
772 } 772 }
773 return m_pStretchEngine->Continue(pPause); 773 return m_pStretchEngine->Continue(pPause);
774 } 774 }
775 FX_BOOL CFX_ImageStretcher::StartQuickStretch() 775 bool CFX_ImageStretcher::StartQuickStretch()
776 { 776 {
777 m_bFlipX = FALSE; 777 m_bFlipX = false;
778 m_bFlipY = FALSE; 778 m_bFlipY = false;
779 if (m_DestWidth < 0) { 779 if (m_DestWidth < 0) {
780 m_bFlipX = TRUE; 780 m_bFlipX = true;
781 m_DestWidth = -m_DestWidth; 781 m_DestWidth = -m_DestWidth;
782 } 782 }
783 if (m_DestHeight < 0) { 783 if (m_DestHeight < 0) {
784 m_bFlipY = TRUE; 784 m_bFlipY = true;
785 m_DestHeight = -m_DestHeight; 785 m_DestHeight = -m_DestHeight;
786 } 786 }
787 m_LineIndex = 0; 787 m_LineIndex = 0;
788 FX_DWORD size = m_ClipRect.Width(); 788 FX_DWORD size = m_ClipRect.Width();
789 if (size && m_DestBPP > (int)(INT_MAX / size)) { 789 if (size && m_DestBPP > (int)(INT_MAX / size)) {
790 return FALSE; 790 return false;
791 } 791 }
792 size *= m_DestBPP; 792 size *= m_DestBPP;
793 m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4); 793 m_pScanline = FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4);
794 if (m_pSource->m_pAlphaMask) { 794 if (m_pSource->m_pAlphaMask) {
795 m_pMaskScanline = FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4); 795 m_pMaskScanline = FX_Alloc(uint8_t, (m_ClipRect.Width() + 3) / 4 * 4);
796 } 796 }
797 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH _PIXELS) { 797 if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH _PIXELS) {
798 ContinueQuickStretch(NULL); 798 ContinueQuickStretch(NULL);
799 return FALSE; 799 return false;
800 } 800 }
801 return TRUE; 801 return true;
802 } 802 }
803 FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) 803 bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause)
804 { 804 {
805 if (m_pScanline == NULL) { 805 if (m_pScanline == NULL) {
806 return FALSE; 806 return false;
807 } 807 }
808 int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height(); 808 int result_width = m_ClipRect.Width(), result_height = m_ClipRect.Height();
809 int src_height = m_pSource->GetHeight(); 809 int src_height = m_pSource->GetHeight();
810 for (; m_LineIndex < result_height; m_LineIndex ++) { 810 for (; m_LineIndex < result_height; m_LineIndex ++) {
811 int dest_y, src_y; 811 int dest_y, src_y;
812 if (m_bFlipY) { 812 if (m_bFlipY) {
813 dest_y = result_height - m_LineIndex - 1; 813 dest_y = result_height - m_LineIndex - 1;
814 src_y = (m_DestHeight - (dest_y + m_ClipRect.top) - 1) * src_height / m_DestHeight; 814 src_y = (m_DestHeight - (dest_y + m_ClipRect.top) - 1) * src_height / m_DestHeight;
815 } else { 815 } else {
816 dest_y = m_LineIndex; 816 dest_y = m_LineIndex;
817 src_y = (dest_y + m_ClipRect.top) * src_height / m_DestHeight; 817 src_y = (dest_y + m_ClipRect.top) * src_height / m_DestHeight;
818 } 818 }
819 if (src_y >= src_height) { 819 if (src_y >= src_height) {
820 src_y = src_height - 1; 820 src_y = src_height - 1;
821 } 821 }
822 if (src_y < 0) { 822 if (src_y < 0) {
823 src_y = 0; 823 src_y = 0;
824 } 824 }
825 if (m_pSource->SkipToScanline(src_y, pPause)) { 825 if (m_pSource->SkipToScanline(src_y, pPause)) {
826 return TRUE; 826 return true;
827 } 827 }
828 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);
829 if (m_pMaskScanline) { 829 if (m_pMaskScanline) {
830 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);
831 } 831 }
832 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); 832 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline);
833 } 833 }
834 return FALSE; 834 return false;
835 } 835 }
OLDNEW
« no previous file with comments | « core/src/fxge/dib/fx_dib_convert.cpp ('k') | core/src/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698