| 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 "dib_int.h" | 8 #include "dib_int.h" |
| 9 int SDP_Table[513] = { | 9 |
| 10 const int SDP_Table[513] = { |
| 10 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, | 11 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, |
| 11 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250, | 12 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250, |
| 12 249, 249, 249, 248, 248, 247, 247, 246, 246, 245, 244, 244, 243, 243, 242, | 13 249, 249, 249, 248, 248, 247, 247, 246, 246, 245, 244, 244, 243, 243, 242, |
| 13 242, 241, 240, 240, 239, 238, 238, 237, 236, 236, 235, 234, 233, 233, 232, | 14 242, 241, 240, 240, 239, 238, 238, 237, 236, 236, 235, 234, 233, 233, 232, |
| 14 231, 230, 230, 229, 228, 227, 226, 226, 225, 224, 223, 222, 221, 220, 219, | 15 231, 230, 230, 229, 228, 227, 226, 226, 225, 224, 223, 222, 221, 220, 219, |
| 15 218, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, | 16 218, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, |
| 16 204, 203, 202, 201, 200, 199, 198, 196, 195, 194, 193, 192, 191, 190, 189, | 17 204, 203, 202, 201, 200, 199, 198, 196, 195, 194, 193, 192, 191, 190, 189, |
| 17 188, 186, 185, 184, 183, 182, 181, 179, 178, 177, 176, 175, 173, 172, 171, | 18 188, 186, 185, 184, 183, 182, 181, 179, 178, 177, 176, 175, 173, 172, 171, |
| 18 170, 169, 167, 166, 165, 164, 162, 161, 160, 159, 157, 156, 155, 154, 152, | 19 170, 169, 167, 166, 165, 164, 162, 161, 160, 159, 157, 156, 155, 154, 152, |
| 19 151, 150, 149, 147, 146, 145, 143, 142, 141, 140, 138, 137, 136, 134, 133, | 20 151, 150, 149, 147, 146, 145, 143, 142, 141, 140, 138, 137, 136, 134, 133, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; | 159 const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; |
| 159 for (int col = col_start; col < col_end; col++) { | 160 for (int col = col_start; col < col_end; col++) { |
| 160 *dest_scan = *src_scan++; | 161 *dest_scan = *src_scan++; |
| 161 dest_scan += dest_step; | 162 dest_scan += dest_step; |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 return pTransBitmap; | 166 return pTransBitmap; |
| 166 } | 167 } |
| 167 #define FIX16_005 0.05f | 168 #define FIX16_005 0.05f |
| 168 FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, | 169 FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, |
| 169 int width, | 170 int width, |
| 170 int height, | 171 int height, |
| 171 FX_BOOL bFlipX, | 172 FX_BOOL bFlipX, |
| 172 FX_BOOL bFlipY) { | 173 FX_BOOL bFlipY) { |
| 173 FX_RECT rect; | 174 FX_RECT rect; |
| 174 if (bFlipY) { | 175 if (bFlipY) { |
| 175 rect.left = height - clip.top; | 176 rect.left = height - clip.top; |
| 176 rect.right = height - clip.bottom; | 177 rect.right = height - clip.bottom; |
| 177 } else { | 178 } else { |
| 178 rect.left = clip.top; | 179 rect.left = clip.top; |
| 179 rect.right = clip.bottom; | 180 rect.right = clip.bottom; |
| 180 } | 181 } |
| 181 if (bFlipX) { | 182 if (bFlipX) { |
| 182 rect.top = width - clip.left; | 183 rect.top = width - clip.left; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 m_ResultTop = result_clip.top; | 247 m_ResultTop = result_clip.top; |
| 247 m_ResultWidth = result_clip.Width(); | 248 m_ResultWidth = result_clip.Width(); |
| 248 m_ResultHeight = result_clip.Height(); | 249 m_ResultHeight = result_clip.Height(); |
| 249 m_Flags = flags; | 250 m_Flags = flags; |
| 250 if (FXSYS_fabs(pDestMatrix->a) < FXSYS_fabs(pDestMatrix->b) / 20 && | 251 if (FXSYS_fabs(pDestMatrix->a) < FXSYS_fabs(pDestMatrix->b) / 20 && |
| 251 FXSYS_fabs(pDestMatrix->d) < FXSYS_fabs(pDestMatrix->c) / 20 && | 252 FXSYS_fabs(pDestMatrix->d) < FXSYS_fabs(pDestMatrix->c) / 20 && |
| 252 FXSYS_fabs(pDestMatrix->a) < 0.5f && FXSYS_fabs(pDestMatrix->d) < 0.5f) { | 253 FXSYS_fabs(pDestMatrix->a) < 0.5f && FXSYS_fabs(pDestMatrix->d) < 0.5f) { |
| 253 int dest_width = result_rect.Width(); | 254 int dest_width = result_rect.Width(); |
| 254 int dest_height = result_rect.Height(); | 255 int dest_height = result_rect.Height(); |
| 255 result_clip.Offset(-result_rect.left, -result_rect.top); | 256 result_clip.Offset(-result_rect.left, -result_rect.top); |
| 256 result_clip = _FXDIB_SwapClipBox(result_clip, dest_width, dest_height, | 257 result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height, |
| 257 pDestMatrix->c > 0, pDestMatrix->b < 0); | 258 pDestMatrix->c > 0, pDestMatrix->b < 0); |
| 258 m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, | 259 m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, |
| 259 flags); | 260 flags); |
| 260 m_Status = 1; | 261 m_Status = 1; |
| 261 return TRUE; | 262 return TRUE; |
| 262 } | 263 } |
| 263 if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && | 264 if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && |
| 264 FXSYS_fabs(pDestMatrix->c) < FIX16_005) { | 265 FXSYS_fabs(pDestMatrix->c) < FIX16_005) { |
| 265 int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) | 266 int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) |
| 266 : (int)FXSYS_floor(pDestMatrix->a); | 267 : (int)FXSYS_floor(pDestMatrix->a); |
| 267 int dest_height = pDestMatrix->d > 0 ? (int)-FXSYS_ceil(pDestMatrix->d) | 268 int dest_height = pDestMatrix->d > 0 ? (int)-FXSYS_ceil(pDestMatrix->d) |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 } | 930 } |
| 930 dest_pos += destBpp; | 931 dest_pos += destBpp; |
| 931 } | 932 } |
| 932 } | 933 } |
| 933 } | 934 } |
| 934 } | 935 } |
| 935 } | 936 } |
| 936 m_Storer.Replace(pTransformed); | 937 m_Storer.Replace(pTransformed); |
| 937 return FALSE; | 938 return FALSE; |
| 938 } | 939 } |
| OLD | NEW |