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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; | 162 const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; |
162 for (int col = col_start; col < col_end; col++) { | 163 for (int col = col_start; col < col_end; col++) { |
163 *dest_scan = *src_scan++; | 164 *dest_scan = *src_scan++; |
164 dest_scan += dest_step; | 165 dest_scan += dest_step; |
165 } | 166 } |
166 } | 167 } |
167 } | 168 } |
168 return pTransBitmap; | 169 return pTransBitmap; |
169 } | 170 } |
170 #define FIX16_005 0.05f | 171 #define FIX16_005 0.05f |
171 FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, | 172 FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, |
172 int width, | 173 int width, |
173 int height, | 174 int height, |
174 FX_BOOL bFlipX, | 175 FX_BOOL bFlipX, |
175 FX_BOOL bFlipY) { | 176 FX_BOOL bFlipY) { |
176 FX_RECT rect; | 177 FX_RECT rect; |
177 if (bFlipY) { | 178 if (bFlipY) { |
178 rect.left = height - clip.top; | 179 rect.left = height - clip.top; |
179 rect.right = height - clip.bottom; | 180 rect.right = height - clip.bottom; |
180 } else { | 181 } else { |
181 rect.left = clip.top; | 182 rect.left = clip.top; |
182 rect.right = clip.bottom; | 183 rect.right = clip.bottom; |
183 } | 184 } |
184 if (bFlipX) { | 185 if (bFlipX) { |
185 rect.top = width - clip.left; | 186 rect.top = width - clip.left; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 m_ResultTop = result_clip.top; | 250 m_ResultTop = result_clip.top; |
250 m_ResultWidth = result_clip.Width(); | 251 m_ResultWidth = result_clip.Width(); |
251 m_ResultHeight = result_clip.Height(); | 252 m_ResultHeight = result_clip.Height(); |
252 m_Flags = flags; | 253 m_Flags = flags; |
253 if (FXSYS_fabs(pDestMatrix->a) < FXSYS_fabs(pDestMatrix->b) / 20 && | 254 if (FXSYS_fabs(pDestMatrix->a) < FXSYS_fabs(pDestMatrix->b) / 20 && |
254 FXSYS_fabs(pDestMatrix->d) < FXSYS_fabs(pDestMatrix->c) / 20 && | 255 FXSYS_fabs(pDestMatrix->d) < FXSYS_fabs(pDestMatrix->c) / 20 && |
255 FXSYS_fabs(pDestMatrix->a) < 0.5f && FXSYS_fabs(pDestMatrix->d) < 0.5f) { | 256 FXSYS_fabs(pDestMatrix->a) < 0.5f && FXSYS_fabs(pDestMatrix->d) < 0.5f) { |
256 int dest_width = result_rect.Width(); | 257 int dest_width = result_rect.Width(); |
257 int dest_height = result_rect.Height(); | 258 int dest_height = result_rect.Height(); |
258 result_clip.Offset(-result_rect.left, -result_rect.top); | 259 result_clip.Offset(-result_rect.left, -result_rect.top); |
259 result_clip = _FXDIB_SwapClipBox(result_clip, dest_width, dest_height, | 260 result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height, |
260 pDestMatrix->c > 0, pDestMatrix->b < 0); | 261 pDestMatrix->c > 0, pDestMatrix->b < 0); |
261 m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, | 262 m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, |
262 flags); | 263 flags); |
263 m_Status = 1; | 264 m_Status = 1; |
264 return TRUE; | 265 return TRUE; |
265 } | 266 } |
266 if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && | 267 if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && |
267 FXSYS_fabs(pDestMatrix->c) < FIX16_005) { | 268 FXSYS_fabs(pDestMatrix->c) < FIX16_005) { |
268 int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) | 269 int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) |
269 : (int)FXSYS_floor(pDestMatrix->a); | 270 : (int)FXSYS_floor(pDestMatrix->a); |
270 int dest_height = pDestMatrix->d > 0 ? (int)-FXSYS_ceil(pDestMatrix->d) | 271 int dest_height = pDestMatrix->d > 0 ? (int)-FXSYS_ceil(pDestMatrix->d) |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } | 936 } |
936 dest_pos += destBpp; | 937 dest_pos += destBpp; |
937 } | 938 } |
938 } | 939 } |
939 } | 940 } |
940 } | 941 } |
941 } | 942 } |
942 m_Storer.Replace(pTransformed); | 943 m_Storer.Replace(pTransformed); |
943 return FALSE; | 944 return FALSE; |
944 } | 945 } |
OLD | NEW |