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 <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "core/include/fxge/fx_dib.h" | 9 #include "core/include/fxge/fx_dib.h" |
10 #include "core/include/fxge/fx_ge.h" | 10 #include "core/include/fxge/fx_ge.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } else { | 267 } else { |
268 m_Flags = FXDIB_NOSMOOTH; | 268 m_Flags = FXDIB_NOSMOOTH; |
269 if (flags & FXDIB_DOWNSAMPLE) { | 269 if (flags & FXDIB_DOWNSAMPLE) { |
270 m_Flags |= FXDIB_DOWNSAMPLE; | 270 m_Flags |= FXDIB_DOWNSAMPLE; |
271 } | 271 } |
272 } | 272 } |
273 double scale_x = FXSYS_Div((FX_FLOAT)(m_SrcWidth), (FX_FLOAT)(m_DestWidth)); | 273 double scale_x = FXSYS_Div((FX_FLOAT)(m_SrcWidth), (FX_FLOAT)(m_DestWidth)); |
274 double scale_y = FXSYS_Div((FX_FLOAT)(m_SrcHeight), (FX_FLOAT)(m_DestHeight)); | 274 double scale_y = FXSYS_Div((FX_FLOAT)(m_SrcHeight), (FX_FLOAT)(m_DestHeight)); |
275 double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth); | 275 double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth); |
276 double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight); | 276 double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight); |
277 double src_left = FXSYS_Mul(scale_x, (FX_FLOAT)(clip_rect.left) + base_x); | 277 double src_left = scale_x * ((FX_FLOAT)(clip_rect.left) + base_x); |
278 double src_right = FXSYS_Mul(scale_x, (FX_FLOAT)(clip_rect.right) + base_x); | 278 double src_right = scale_x * ((FX_FLOAT)(clip_rect.right) + base_x); |
279 double src_top = FXSYS_Mul(scale_y, (FX_FLOAT)(clip_rect.top) + base_y); | 279 double src_top = scale_y * ((FX_FLOAT)(clip_rect.top) + base_y); |
280 double src_bottom = FXSYS_Mul(scale_y, (FX_FLOAT)(clip_rect.bottom) + base_y); | 280 double src_bottom = scale_y * ((FX_FLOAT)(clip_rect.bottom) + base_y); |
281 if (src_left > src_right) { | 281 if (src_left > src_right) { |
282 double temp = src_left; | 282 double temp = src_left; |
283 src_left = src_right; | 283 src_left = src_right; |
284 src_right = temp; | 284 src_right = temp; |
285 } | 285 } |
286 if (src_top > src_bottom) { | 286 if (src_top > src_bottom) { |
287 double temp = src_top; | 287 double temp = src_top; |
288 src_top = src_bottom; | 288 src_top = src_bottom; |
289 src_bottom = temp; | 289 src_bottom = temp; |
290 } | 290 } |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 m_bFlipX, m_ClipRect.left, result_width); | 908 m_bFlipX, m_ClipRect.left, result_width); |
909 if (m_pMaskScanline) { | 909 if (m_pMaskScanline) { |
910 m_pSource->m_pAlphaMask->DownSampleScanline( | 910 m_pSource->m_pAlphaMask->DownSampleScanline( |
911 src_y, m_pMaskScanline, 1, m_DestWidth, m_bFlipX, m_ClipRect.left, | 911 src_y, m_pMaskScanline, 1, m_DestWidth, m_bFlipX, m_ClipRect.left, |
912 result_width); | 912 result_width); |
913 } | 913 } |
914 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); | 914 m_pDest->ComposeScanline(dest_y, m_pScanline, m_pMaskScanline); |
915 } | 915 } |
916 return FALSE; | 916 return FALSE; |
917 } | 917 } |
OLD | NEW |