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 <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1; | 56 const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1; |
57 m_ItemSize = | 57 m_ItemSize = |
58 sizeof(int) * 2 + | 58 sizeof(int) * 2 + |
59 (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + ext_size)); | 59 (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((FX_FLOAT)scale)) + ext_size)); |
60 m_DestMin = dest_min; | 60 m_DestMin = dest_min; |
61 if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) | 61 if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) |
62 return false; | 62 return false; |
63 | 63 |
64 m_dwWeightTablesSize = (dest_max - dest_min) * m_ItemSize + 4; | 64 m_dwWeightTablesSize = (dest_max - dest_min) * m_ItemSize + 4; |
65 m_pWeightTables = FX_TryAlloc(uint8_t, m_dwWeightTablesSize); | 65 m_pWeightTables = FX_TryAlloc(uint8_t, m_dwWeightTablesSize); |
66 m_dwWeightTablesSize /= sizeof(int); | |
Lei Zhang
2016/09/23 21:32:01
I think it's weird for a variable to have 2 differ
| |
66 if (!m_pWeightTables) | 67 if (!m_pWeightTables) |
67 return false; | 68 return false; |
68 | 69 |
69 if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((FX_FLOAT)scale) < 1.0f) { | 70 if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((FX_FLOAT)scale) < 1.0f) { |
70 for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) { | 71 for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) { |
71 PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel); | 72 PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel); |
72 double src_pos = dest_pixel * scale + scale / 2 + base; | 73 double src_pos = dest_pixel * scale + scale / 2 + base; |
73 if (flags & FXDIB_INTERPOL) { | 74 if (flags & FXDIB_INTERPOL) { |
74 pixel_weights.m_SrcStart = | 75 pixel_weights.m_SrcStart = |
75 (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2); | 76 (int)FXSYS_floor((FX_FLOAT)src_pos - 1.0f / 2); |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
994 result_width); | 995 result_width); |
995 if (m_pMaskScanline) { | 996 if (m_pMaskScanline) { |
996 m_pSource->m_pAlphaMask->DownSampleScanline( | 997 m_pSource->m_pAlphaMask->DownSampleScanline( |
997 src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX, | 998 src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX, |
998 m_ClipRect.left, result_width); | 999 m_ClipRect.left, result_width); |
999 } | 1000 } |
1000 m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get()); | 1001 m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get()); |
1001 } | 1002 } |
1002 return FALSE; | 1003 return FALSE; |
1003 } | 1004 } |
OLD | NEW |