| 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 "dib_int.h" | 7 #include "dib_int.h" |
| 8 | 8 |
| 9 #include "core/include/fxge/fx_dib.h" | 9 #include "core/include/fxge/fx_dib.h" |
| 10 | 10 |
| 11 const int SDP_Table[513] = { | 11 namespace { |
| 12 |
| 13 uint8_t bilinear_interpol(const uint8_t* buf, |
| 14 int row_offset_l, |
| 15 int row_offset_r, |
| 16 int src_col_l, |
| 17 int src_col_r, |
| 18 int res_x, |
| 19 int res_y, |
| 20 int bpp, |
| 21 int c_offset) { |
| 22 int i_resx = 255 - res_x; |
| 23 int col_bpp_l = src_col_l * bpp; |
| 24 int col_bpp_r = src_col_r * bpp; |
| 25 const uint8_t* buf_u = buf + row_offset_l + c_offset; |
| 26 const uint8_t* buf_d = buf + row_offset_r + c_offset; |
| 27 const uint8_t* src_pos0 = buf_u + col_bpp_l; |
| 28 const uint8_t* src_pos1 = buf_u + col_bpp_r; |
| 29 const uint8_t* src_pos2 = buf_d + col_bpp_l; |
| 30 const uint8_t* src_pos3 = buf_d + col_bpp_r; |
| 31 uint8_t r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8; |
| 32 uint8_t r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8; |
| 33 return (r_pos_0 * (255 - res_y) + r_pos_1 * res_y) >> 8; |
| 34 } |
| 35 |
| 36 uint8_t bicubic_interpol(const uint8_t* buf, |
| 37 int pitch, |
| 38 int pos_pixel[], |
| 39 int u_w[], |
| 40 int v_w[], |
| 41 int res_x, |
| 42 int res_y, |
| 43 int bpp, |
| 44 int c_offset) { |
| 45 int s_result = 0; |
| 46 for (int i = 0; i < 4; i++) { |
| 47 int a_result = 0; |
| 48 for (int j = 0; j < 4; j++) { |
| 49 a_result += u_w[j] * (*(uint8_t*)(buf + pos_pixel[i + 4] * pitch + |
| 50 pos_pixel[j] * bpp + c_offset)); |
| 51 } |
| 52 s_result += a_result * v_w[i]; |
| 53 } |
| 54 s_result >>= 16; |
| 55 return (uint8_t)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result); |
| 56 } |
| 57 |
| 58 void bicubic_get_pos_weight(int pos_pixel[], |
| 59 int u_w[], |
| 60 int v_w[], |
| 61 int src_col_l, |
| 62 int src_row_l, |
| 63 int res_x, |
| 64 int res_y, |
| 65 int stretch_width, |
| 66 int stretch_height) { |
| 67 pos_pixel[0] = src_col_l - 1; |
| 68 pos_pixel[1] = src_col_l; |
| 69 pos_pixel[2] = src_col_l + 1; |
| 70 pos_pixel[3] = src_col_l + 2; |
| 71 pos_pixel[4] = src_row_l - 1; |
| 72 pos_pixel[5] = src_row_l; |
| 73 pos_pixel[6] = src_row_l + 1; |
| 74 pos_pixel[7] = src_row_l + 2; |
| 75 for (int i = 0; i < 4; i++) { |
| 76 if (pos_pixel[i] < 0) { |
| 77 pos_pixel[i] = 0; |
| 78 } |
| 79 if (pos_pixel[i] >= stretch_width) { |
| 80 pos_pixel[i] = stretch_width - 1; |
| 81 } |
| 82 if (pos_pixel[i + 4] < 0) { |
| 83 pos_pixel[i + 4] = 0; |
| 84 } |
| 85 if (pos_pixel[i + 4] >= stretch_height) { |
| 86 pos_pixel[i + 4] = stretch_height - 1; |
| 87 } |
| 88 } |
| 89 u_w[0] = SDP_Table[256 + res_x]; |
| 90 u_w[1] = SDP_Table[res_x]; |
| 91 u_w[2] = SDP_Table[256 - res_x]; |
| 92 u_w[3] = SDP_Table[512 - res_x]; |
| 93 v_w[0] = SDP_Table[256 + res_y]; |
| 94 v_w[1] = SDP_Table[res_y]; |
| 95 v_w[2] = SDP_Table[256 - res_y]; |
| 96 v_w[3] = SDP_Table[512 - res_y]; |
| 97 } |
| 98 |
| 99 FXDIB_Format GetTransformedFormat(const CFX_DIBSource* pDrc) { |
| 100 FXDIB_Format format = pDrc->GetFormat(); |
| 101 if (pDrc->IsAlphaMask()) { |
| 102 format = FXDIB_8bppMask; |
| 103 } else if (format >= 1025) { |
| 104 format = FXDIB_Cmyka; |
| 105 } else if (format <= 32 || format == FXDIB_Argb) { |
| 106 format = FXDIB_Argb; |
| 107 } else { |
| 108 format = FXDIB_Rgba; |
| 109 } |
| 110 return format; |
| 111 } |
| 112 |
| 113 } // namespace |
| 114 |
| 115 const int16_t SDP_Table[513] = { |
| 12 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, | 116 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, |
| 13 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250, | 117 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250, |
| 14 249, 249, 249, 248, 248, 247, 247, 246, 246, 245, 244, 244, 243, 243, 242, | 118 249, 249, 249, 248, 248, 247, 247, 246, 246, 245, 244, 244, 243, 243, 242, |
| 15 242, 241, 240, 240, 239, 238, 238, 237, 236, 236, 235, 234, 233, 233, 232, | 119 242, 241, 240, 240, 239, 238, 238, 237, 236, 236, 235, 234, 233, 233, 232, |
| 16 231, 230, 230, 229, 228, 227, 226, 226, 225, 224, 223, 222, 221, 220, 219, | 120 231, 230, 230, 229, 228, 227, 226, 226, 225, 224, 223, 222, 221, 220, 219, |
| 17 218, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, | 121 218, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, |
| 18 204, 203, 202, 201, 200, 199, 198, 196, 195, 194, 193, 192, 191, 190, 189, | 122 204, 203, 202, 201, 200, 199, 198, 196, 195, 194, 193, 192, 191, 190, 189, |
| 19 188, 186, 185, 184, 183, 182, 181, 179, 178, 177, 176, 175, 173, 172, 171, | 123 188, 186, 185, 184, 183, 182, 181, 179, 178, 177, 176, 175, 173, 172, 171, |
| 20 170, 169, 167, 166, 165, 164, 162, 161, 160, 159, 157, 156, 155, 154, 152, | 124 170, 169, 167, 166, 165, 164, 162, 161, 160, 159, 157, 156, 155, 154, 152, |
| 21 151, 150, 149, 147, 146, 145, 143, 142, 141, 140, 138, 137, 136, 134, 133, | 125 151, 150, 149, 147, 146, 145, 143, 142, 141, 140, 138, 137, 136, 134, 133, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 -29, -29, -29, -29, -28, -28, -28, -27, -27, -27, -27, -26, -26, -26, -25, | 142 -29, -29, -29, -29, -28, -28, -28, -27, -27, -27, -27, -26, -26, -26, -25, |
| 39 -25, -25, -24, -24, -24, -23, -23, -23, -22, -22, -22, -22, -21, -21, -21, | 143 -25, -25, -24, -24, -24, -23, -23, -23, -22, -22, -22, -22, -21, -21, -21, |
| 40 -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, | 144 -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, |
| 41 -15, -15, -15, -14, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -11, | 145 -15, -15, -15, -14, -14, -14, -13, -13, -13, -12, -12, -12, -11, -11, -11, |
| 42 -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -7, -7, -7, -7, -6, | 146 -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -7, -7, -7, -7, -6, |
| 43 -6, -6, -6, -5, -5, -5, -5, -4, -4, -4, -4, -3, -3, -3, -3, | 147 -6, -6, -6, -5, -5, -5, -5, -4, -4, -4, -4, -3, -3, -3, -3, |
| 44 -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 0, | 148 -3, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, 0, 0, 0, |
| 45 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 46 0, 0, 0, | 150 0, 0, 0, |
| 47 }; | 151 }; |
| 152 |
| 48 class CFX_BilinearMatrix : public CPDF_FixedMatrix { | 153 class CFX_BilinearMatrix : public CPDF_FixedMatrix { |
| 49 public: | 154 public: |
| 50 CFX_BilinearMatrix(const CFX_AffineMatrix& src, int bits) | 155 CFX_BilinearMatrix(const CFX_AffineMatrix& src, int bits) |
| 51 : CPDF_FixedMatrix(src, bits) {} | 156 : CPDF_FixedMatrix(src, bits) {} |
| 52 inline void Transform(int x, | 157 inline void Transform(int x, |
| 53 int y, | 158 int y, |
| 54 int& x1, | 159 int& x1, |
| 55 int& y1, | 160 int& y1, |
| 56 int& res_x, | 161 int& res_x, |
| 57 int& res_y) { | 162 int& res_y) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 dest_scan += (result_height - 1) * dest_pitch; | 229 dest_scan += (result_height - 1) * dest_pitch; |
| 125 } | 230 } |
| 126 if (nBytes == 4) { | 231 if (nBytes == 4) { |
| 127 FX_DWORD* src_scan = (FX_DWORD*)GetScanline(row) + col_start; | 232 FX_DWORD* src_scan = (FX_DWORD*)GetScanline(row) + col_start; |
| 128 for (int col = col_start; col < col_end; col++) { | 233 for (int col = col_start; col < col_end; col++) { |
| 129 *(FX_DWORD*)dest_scan = *src_scan++; | 234 *(FX_DWORD*)dest_scan = *src_scan++; |
| 130 dest_scan += dest_step; | 235 dest_scan += dest_step; |
| 131 } | 236 } |
| 132 } else { | 237 } else { |
| 133 const uint8_t* src_scan = GetScanline(row) + col_start * nBytes; | 238 const uint8_t* src_scan = GetScanline(row) + col_start * nBytes; |
| 134 if (nBytes == 1) | 239 if (nBytes == 1) { |
| 135 for (int col = col_start; col < col_end; col++) { | 240 for (int col = col_start; col < col_end; col++) { |
| 136 *dest_scan = *src_scan++; | 241 *dest_scan = *src_scan++; |
| 137 dest_scan += dest_step; | 242 dest_scan += dest_step; |
| 138 } | 243 } |
| 139 else | 244 } else { |
| 140 for (int col = col_start; col < col_end; col++) { | 245 for (int col = col_start; col < col_end; col++) { |
| 141 *dest_scan++ = *src_scan++; | 246 *dest_scan++ = *src_scan++; |
| 142 *dest_scan++ = *src_scan++; | 247 *dest_scan++ = *src_scan++; |
| 143 *dest_scan = *src_scan++; | 248 *dest_scan = *src_scan++; |
| 144 dest_scan += dest_step; | 249 dest_scan += dest_step; |
| 145 } | 250 } |
| 251 } |
| 146 } | 252 } |
| 147 } | 253 } |
| 148 } | 254 } |
| 149 if (m_pAlphaMask) { | 255 if (m_pAlphaMask) { |
| 150 dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch(); | 256 dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch(); |
| 151 dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer(); | 257 dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer(); |
| 152 int dest_step = bYFlip ? -dest_pitch : dest_pitch; | 258 int dest_step = bYFlip ? -dest_pitch : dest_pitch; |
| 153 for (int row = row_start; row < row_end; row++) { | 259 for (int row = row_start; row < row_end; row++) { |
| 154 int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - | 260 int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - |
| 155 dest_clip.left; | 261 dest_clip.left; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 m_dest2stretch.SetReverse(stretch2dest); | 393 m_dest2stretch.SetReverse(stretch2dest); |
| 288 CFX_FloatRect clip_rect_f(result_clip); | 394 CFX_FloatRect clip_rect_f(result_clip); |
| 289 clip_rect_f.Transform(&m_dest2stretch); | 395 clip_rect_f.Transform(&m_dest2stretch); |
| 290 m_StretchClip = clip_rect_f.GetOutterRect(); | 396 m_StretchClip = clip_rect_f.GetOutterRect(); |
| 291 m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); | 397 m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); |
| 292 m_Stretcher.Start(&m_Storer, pSrc, stretch_width, stretch_height, | 398 m_Stretcher.Start(&m_Storer, pSrc, stretch_width, stretch_height, |
| 293 m_StretchClip, flags); | 399 m_StretchClip, flags); |
| 294 m_Status = 3; | 400 m_Status = 3; |
| 295 return TRUE; | 401 return TRUE; |
| 296 } | 402 } |
| 297 uint8_t _bilinear_interpol(const uint8_t* buf, | 403 |
| 298 int row_offset_l, | |
| 299 int row_offset_r, | |
| 300 int src_col_l, | |
| 301 int src_col_r, | |
| 302 int res_x, | |
| 303 int res_y, | |
| 304 int bpp, | |
| 305 int c_offset) { | |
| 306 int i_resx = 255 - res_x; | |
| 307 int col_bpp_l = src_col_l * bpp; | |
| 308 int col_bpp_r = src_col_r * bpp; | |
| 309 const uint8_t* buf_u = buf + row_offset_l + c_offset; | |
| 310 const uint8_t* buf_d = buf + row_offset_r + c_offset; | |
| 311 const uint8_t* src_pos0 = buf_u + col_bpp_l; | |
| 312 const uint8_t* src_pos1 = buf_u + col_bpp_r; | |
| 313 const uint8_t* src_pos2 = buf_d + col_bpp_l; | |
| 314 const uint8_t* src_pos3 = buf_d + col_bpp_r; | |
| 315 uint8_t r_pos_0 = (*src_pos0 * i_resx + *src_pos1 * res_x) >> 8; | |
| 316 uint8_t r_pos_1 = (*src_pos2 * i_resx + *src_pos3 * res_x) >> 8; | |
| 317 return (r_pos_0 * (255 - res_y) + r_pos_1 * res_y) >> 8; | |
| 318 } | |
| 319 uint8_t _bicubic_interpol(const uint8_t* buf, | |
| 320 int pitch, | |
| 321 int pos_pixel[], | |
| 322 int u_w[], | |
| 323 int v_w[], | |
| 324 int res_x, | |
| 325 int res_y, | |
| 326 int bpp, | |
| 327 int c_offset) { | |
| 328 int s_result = 0; | |
| 329 for (int i = 0; i < 4; i++) { | |
| 330 int a_result = 0; | |
| 331 for (int j = 0; j < 4; j++) { | |
| 332 a_result += u_w[j] * (*(uint8_t*)(buf + pos_pixel[i + 4] * pitch + | |
| 333 pos_pixel[j] * bpp + c_offset)); | |
| 334 } | |
| 335 s_result += a_result * v_w[i]; | |
| 336 } | |
| 337 s_result >>= 16; | |
| 338 return (uint8_t)(s_result < 0 ? 0 : s_result > 255 ? 255 : s_result); | |
| 339 } | |
| 340 void _bicubic_get_pos_weight(int pos_pixel[], | |
| 341 int u_w[], | |
| 342 int v_w[], | |
| 343 int src_col_l, | |
| 344 int src_row_l, | |
| 345 int res_x, | |
| 346 int res_y, | |
| 347 int stretch_width, | |
| 348 int stretch_height) { | |
| 349 pos_pixel[0] = src_col_l - 1; | |
| 350 pos_pixel[1] = src_col_l; | |
| 351 pos_pixel[2] = src_col_l + 1; | |
| 352 pos_pixel[3] = src_col_l + 2; | |
| 353 pos_pixel[4] = src_row_l - 1; | |
| 354 pos_pixel[5] = src_row_l; | |
| 355 pos_pixel[6] = src_row_l + 1; | |
| 356 pos_pixel[7] = src_row_l + 2; | |
| 357 for (int i = 0; i < 4; i++) { | |
| 358 if (pos_pixel[i] < 0) { | |
| 359 pos_pixel[i] = 0; | |
| 360 } | |
| 361 if (pos_pixel[i] >= stretch_width) { | |
| 362 pos_pixel[i] = stretch_width - 1; | |
| 363 } | |
| 364 if (pos_pixel[i + 4] < 0) { | |
| 365 pos_pixel[i + 4] = 0; | |
| 366 } | |
| 367 if (pos_pixel[i + 4] >= stretch_height) { | |
| 368 pos_pixel[i + 4] = stretch_height - 1; | |
| 369 } | |
| 370 } | |
| 371 u_w[0] = SDP_Table[256 + res_x]; | |
| 372 u_w[1] = SDP_Table[res_x]; | |
| 373 u_w[2] = SDP_Table[256 - res_x]; | |
| 374 u_w[3] = SDP_Table[512 - res_x]; | |
| 375 v_w[0] = SDP_Table[256 + res_y]; | |
| 376 v_w[1] = SDP_Table[res_y]; | |
| 377 v_w[2] = SDP_Table[256 - res_y]; | |
| 378 v_w[3] = SDP_Table[512 - res_y]; | |
| 379 } | |
| 380 FXDIB_Format _GetTransformedFormat(const CFX_DIBSource* pDrc) { | |
| 381 FXDIB_Format format = pDrc->GetFormat(); | |
| 382 if (pDrc->IsAlphaMask()) { | |
| 383 format = FXDIB_8bppMask; | |
| 384 } else if (format >= 1025) { | |
| 385 format = FXDIB_Cmyka; | |
| 386 } else if (format <= 32 || format == FXDIB_Argb) { | |
| 387 format = FXDIB_Argb; | |
| 388 } else { | |
| 389 format = FXDIB_Rgba; | |
| 390 } | |
| 391 return format; | |
| 392 } | |
| 393 FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { | 404 FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { |
| 394 if (m_Status == 1) { | 405 if (m_Status == 1) { |
| 395 if (m_Stretcher.Continue(pPause)) { | 406 if (m_Stretcher.Continue(pPause)) { |
| 396 return TRUE; | 407 return TRUE; |
| 397 } | 408 } |
| 398 if (m_Storer.GetBitmap()) { | 409 if (m_Storer.GetBitmap()) { |
| 399 m_Storer.Replace( | 410 m_Storer.Replace( |
| 400 m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0)); | 411 m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0)); |
| 401 } | 412 } |
| 402 return FALSE; | 413 return FALSE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 415 if (m_Storer.GetBitmap() == NULL) { | 426 if (m_Storer.GetBitmap() == NULL) { |
| 416 return FALSE; | 427 return FALSE; |
| 417 } | 428 } |
| 418 const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); | 429 const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); |
| 419 const uint8_t* stretch_buf_mask = NULL; | 430 const uint8_t* stretch_buf_mask = NULL; |
| 420 if (m_Storer.GetBitmap()->m_pAlphaMask) { | 431 if (m_Storer.GetBitmap()->m_pAlphaMask) { |
| 421 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); | 432 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); |
| 422 } | 433 } |
| 423 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); | 434 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); |
| 424 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; | 435 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; |
| 425 FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); | 436 FXDIB_Format transformF = GetTransformedFormat(m_Stretcher.m_pSource); |
| 426 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { | 437 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { |
| 427 delete pTransformed; | 438 delete pTransformed; |
| 428 return FALSE; | 439 return FALSE; |
| 429 } | 440 } |
| 430 pTransformed->Clear(0); | 441 pTransformed->Clear(0); |
| 431 if (pTransformed->m_pAlphaMask) { | 442 if (pTransformed->m_pAlphaMask) { |
| 432 pTransformed->m_pAlphaMask->Clear(0); | 443 pTransformed->m_pAlphaMask->Clear(0); |
| 433 } | 444 } |
| 434 CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, | 445 CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, |
| 435 (FX_FLOAT)(m_ResultLeft), | 446 (FX_FLOAT)(m_ResultLeft), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 461 int src_row_r = src_row_l + 1; | 472 int src_row_r = src_row_l + 1; |
| 462 if (src_col_r == stretch_width) { | 473 if (src_col_r == stretch_width) { |
| 463 src_col_r--; | 474 src_col_r--; |
| 464 } | 475 } |
| 465 if (src_row_r == stretch_height) { | 476 if (src_row_r == stretch_height) { |
| 466 src_row_r--; | 477 src_row_r--; |
| 467 } | 478 } |
| 468 int row_offset_l = src_row_l * stretch_pitch_mask; | 479 int row_offset_l = src_row_l * stretch_pitch_mask; |
| 469 int row_offset_r = src_row_r * stretch_pitch_mask; | 480 int row_offset_r = src_row_r * stretch_pitch_mask; |
| 470 *dest_pos_mask = | 481 *dest_pos_mask = |
| 471 _bilinear_interpol(stretch_buf_mask, row_offset_l, row_offset_r, | 482 bilinear_interpol(stretch_buf_mask, row_offset_l, row_offset_r, |
| 472 src_col_l, src_col_r, res_x, res_y, 1, 0); | 483 src_col_l, src_col_r, res_x, res_y, 1, 0); |
| 473 } | 484 } |
| 474 dest_pos_mask++; | 485 dest_pos_mask++; |
| 475 } | 486 } |
| 476 } | 487 } |
| 477 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { | 488 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { |
| 478 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 489 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 479 for (int row = 0; row < m_ResultHeight; row++) { | 490 for (int row = 0; row < m_ResultHeight; row++) { |
| 480 uint8_t* dest_pos_mask = | 491 uint8_t* dest_pos_mask = |
| 481 (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); | 492 (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); |
| 482 for (int col = 0; col < m_ResultWidth; col++) { | 493 for (int col = 0; col < m_ResultWidth; col++) { |
| 483 int src_col_l, src_row_l, res_x, res_y; | 494 int src_col_l, src_row_l, res_x, res_y; |
| 484 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, | 495 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, |
| 485 res_y); | 496 res_y); |
| 486 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && | 497 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && |
| 487 src_row_l <= stretch_height) { | 498 src_row_l <= stretch_height) { |
| 488 int pos_pixel[8]; | 499 int pos_pixel[8]; |
| 489 int u_w[4], v_w[4]; | 500 int u_w[4], v_w[4]; |
| 490 if (src_col_l == stretch_width) { | 501 if (src_col_l == stretch_width) { |
| 491 src_col_l--; | 502 src_col_l--; |
| 492 } | 503 } |
| 493 if (src_row_l == stretch_height) { | 504 if (src_row_l == stretch_height) { |
| 494 src_row_l--; | 505 src_row_l--; |
| 495 } | 506 } |
| 496 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, | 507 bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, |
| 497 res_x, res_y, stretch_width, | 508 res_x, res_y, stretch_width, stretch_height); |
| 498 stretch_height); | |
| 499 *dest_pos_mask = | 509 *dest_pos_mask = |
| 500 _bicubic_interpol(stretch_buf_mask, stretch_pitch_mask, | 510 bicubic_interpol(stretch_buf_mask, stretch_pitch_mask, |
| 501 pos_pixel, u_w, v_w, res_x, res_y, 1, 0); | 511 pos_pixel, u_w, v_w, res_x, res_y, 1, 0); |
| 502 } | 512 } |
| 503 dest_pos_mask++; | 513 dest_pos_mask++; |
| 504 } | 514 } |
| 505 } | 515 } |
| 506 } else { | 516 } else { |
| 507 CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); | 517 CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); |
| 508 for (int row = 0; row < m_ResultHeight; row++) { | 518 for (int row = 0; row < m_ResultHeight; row++) { |
| 509 uint8_t* dest_pos_mask = | 519 uint8_t* dest_pos_mask = |
| 510 (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); | 520 (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); |
| 511 for (int col = 0; col < m_ResultWidth; col++) { | 521 for (int col = 0; col < m_ResultWidth; col++) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 int src_row_r = src_row_l + 1; | 558 int src_row_r = src_row_l + 1; |
| 549 if (src_col_r == stretch_width) { | 559 if (src_col_r == stretch_width) { |
| 550 src_col_r--; | 560 src_col_r--; |
| 551 } | 561 } |
| 552 if (src_row_r == stretch_height) { | 562 if (src_row_r == stretch_height) { |
| 553 src_row_r--; | 563 src_row_r--; |
| 554 } | 564 } |
| 555 int row_offset_l = src_row_l * stretch_pitch; | 565 int row_offset_l = src_row_l * stretch_pitch; |
| 556 int row_offset_r = src_row_r * stretch_pitch; | 566 int row_offset_r = src_row_r * stretch_pitch; |
| 557 *dest_scan = | 567 *dest_scan = |
| 558 _bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, | 568 bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, |
| 559 src_col_l, src_col_r, res_x, res_y, 1, 0); | 569 src_col_l, src_col_r, res_x, res_y, 1, 0); |
| 560 } | 570 } |
| 561 dest_scan++; | 571 dest_scan++; |
| 562 } | 572 } |
| 563 } | 573 } |
| 564 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { | 574 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { |
| 565 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 575 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 566 for (int row = 0; row < m_ResultHeight; row++) { | 576 for (int row = 0; row < m_ResultHeight; row++) { |
| 567 uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); | 577 uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); |
| 568 for (int col = 0; col < m_ResultWidth; col++) { | 578 for (int col = 0; col < m_ResultWidth; col++) { |
| 569 int src_col_l, src_row_l, res_x, res_y; | 579 int src_col_l, src_row_l, res_x, res_y; |
| 570 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, | 580 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, |
| 571 res_y); | 581 res_y); |
| 572 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && | 582 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && |
| 573 src_row_l <= stretch_height) { | 583 src_row_l <= stretch_height) { |
| 574 int pos_pixel[8]; | 584 int pos_pixel[8]; |
| 575 int u_w[4], v_w[4]; | 585 int u_w[4], v_w[4]; |
| 576 if (src_col_l == stretch_width) { | 586 if (src_col_l == stretch_width) { |
| 577 src_col_l--; | 587 src_col_l--; |
| 578 } | 588 } |
| 579 if (src_row_l == stretch_height) { | 589 if (src_row_l == stretch_height) { |
| 580 src_row_l--; | 590 src_row_l--; |
| 581 } | 591 } |
| 582 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, | 592 bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, |
| 583 res_x, res_y, stretch_width, | 593 res_x, res_y, stretch_width, stretch_height); |
| 584 stretch_height); | 594 *dest_scan = bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, |
| 585 *dest_scan = | 595 u_w, v_w, res_x, res_y, 1, 0); |
| 586 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, | |
| 587 v_w, res_x, res_y, 1, 0); | |
| 588 } | 596 } |
| 589 dest_scan++; | 597 dest_scan++; |
| 590 } | 598 } |
| 591 } | 599 } |
| 592 } else { | 600 } else { |
| 593 CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); | 601 CPDF_FixedMatrix result2stretch_fix(result2stretch, 8); |
| 594 for (int row = 0; row < m_ResultHeight; row++) { | 602 for (int row = 0; row < m_ResultHeight; row++) { |
| 595 uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); | 603 uint8_t* dest_scan = (uint8_t*)pTransformed->GetScanline(row); |
| 596 for (int col = 0; col < m_ResultWidth; col++) { | 604 for (int col = 0; col < m_ResultWidth; col++) { |
| 597 int src_col, src_row; | 605 int src_col, src_row; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 616 int Bpp = m_Storer.GetBitmap()->GetBPP() / 8; | 624 int Bpp = m_Storer.GetBitmap()->GetBPP() / 8; |
| 617 int destBpp = pTransformed->GetBPP() / 8; | 625 int destBpp = pTransformed->GetBPP() / 8; |
| 618 if (Bpp == 1) { | 626 if (Bpp == 1) { |
| 619 FX_DWORD argb[256]; | 627 FX_DWORD argb[256]; |
| 620 FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette(); | 628 FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette(); |
| 621 if (pPal) { | 629 if (pPal) { |
| 622 for (int i = 0; i < 256; i++) { | 630 for (int i = 0; i < 256; i++) { |
| 623 argb[i] = pPal[i]; | 631 argb[i] = pPal[i]; |
| 624 } | 632 } |
| 625 } else { | 633 } else { |
| 626 if (m_Storer.GetBitmap()->IsCmykImage()) | 634 if (m_Storer.GetBitmap()->IsCmykImage()) { |
| 627 for (int i = 0; i < 256; i++) { | 635 for (int i = 0; i < 256; i++) { |
| 628 argb[i] = 255 - i; | 636 argb[i] = 255 - i; |
| 629 } | 637 } |
| 630 else | 638 } else { |
| 631 for (int i = 0; i < 256; i++) { | 639 for (int i = 0; i < 256; i++) { |
| 632 argb[i] = 0xff000000 | (i * 0x010101); | 640 argb[i] = 0xff000000 | (i * 0x010101); |
| 633 } | 641 } |
| 642 } |
| 634 } | 643 } |
| 635 if (!(m_Flags & FXDIB_DOWNSAMPLE) && | 644 if (!(m_Flags & FXDIB_DOWNSAMPLE) && |
| 636 !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { | 645 !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { |
| 637 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 646 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 638 for (int row = 0; row < m_ResultHeight; row++) { | 647 for (int row = 0; row < m_ResultHeight; row++) { |
| 639 uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); | 648 uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); |
| 640 for (int col = 0; col < m_ResultWidth; col++) { | 649 for (int col = 0; col < m_ResultWidth; col++) { |
| 641 int src_col_l, src_row_l, res_x, res_y; | 650 int src_col_l, src_row_l, res_x, res_y; |
| 642 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, | 651 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, |
| 643 res_y); | 652 res_y); |
| 644 if (src_col_l >= 0 && src_col_l <= stretch_width && | 653 if (src_col_l >= 0 && src_col_l <= stretch_width && |
| 645 src_row_l >= 0 && src_row_l <= stretch_height) { | 654 src_row_l >= 0 && src_row_l <= stretch_height) { |
| 646 if (src_col_l == stretch_width) { | 655 if (src_col_l == stretch_width) { |
| 647 src_col_l--; | 656 src_col_l--; |
| 648 } | 657 } |
| 649 if (src_row_l == stretch_height) { | 658 if (src_row_l == stretch_height) { |
| 650 src_row_l--; | 659 src_row_l--; |
| 651 } | 660 } |
| 652 int src_col_r = src_col_l + 1; | 661 int src_col_r = src_col_l + 1; |
| 653 int src_row_r = src_row_l + 1; | 662 int src_row_r = src_row_l + 1; |
| 654 if (src_col_r == stretch_width) { | 663 if (src_col_r == stretch_width) { |
| 655 src_col_r--; | 664 src_col_r--; |
| 656 } | 665 } |
| 657 if (src_row_r == stretch_height) { | 666 if (src_row_r == stretch_height) { |
| 658 src_row_r--; | 667 src_row_r--; |
| 659 } | 668 } |
| 660 int row_offset_l = src_row_l * stretch_pitch; | 669 int row_offset_l = src_row_l * stretch_pitch; |
| 661 int row_offset_r = src_row_r * stretch_pitch; | 670 int row_offset_r = src_row_r * stretch_pitch; |
| 662 FX_DWORD r_bgra_cmyk = argb[_bilinear_interpol( | 671 FX_DWORD r_bgra_cmyk = argb[bilinear_interpol( |
| 663 stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, | 672 stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, |
| 664 res_x, res_y, 1, 0)]; | 673 res_x, res_y, 1, 0)]; |
| 665 if (transformF == FXDIB_Rgba) { | 674 if (transformF == FXDIB_Rgba) { |
| 666 dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); | 675 dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); |
| 667 dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); | 676 dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); |
| 668 dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); | 677 dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); |
| 669 } else { | 678 } else { |
| 670 *(FX_DWORD*)dest_pos = r_bgra_cmyk; | 679 *(FX_DWORD*)dest_pos = r_bgra_cmyk; |
| 671 } | 680 } |
| 672 } | 681 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 684 if (src_col_l >= 0 && src_col_l <= stretch_width && | 693 if (src_col_l >= 0 && src_col_l <= stretch_width && |
| 685 src_row_l >= 0 && src_row_l <= stretch_height) { | 694 src_row_l >= 0 && src_row_l <= stretch_height) { |
| 686 int pos_pixel[8]; | 695 int pos_pixel[8]; |
| 687 int u_w[4], v_w[4]; | 696 int u_w[4], v_w[4]; |
| 688 if (src_col_l == stretch_width) { | 697 if (src_col_l == stretch_width) { |
| 689 src_col_l--; | 698 src_col_l--; |
| 690 } | 699 } |
| 691 if (src_row_l == stretch_height) { | 700 if (src_row_l == stretch_height) { |
| 692 src_row_l--; | 701 src_row_l--; |
| 693 } | 702 } |
| 694 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, | 703 bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, |
| 695 res_x, res_y, stretch_width, | 704 res_x, res_y, stretch_width, |
| 696 stretch_height); | 705 stretch_height); |
| 697 FX_DWORD r_bgra_cmyk = | 706 FX_DWORD r_bgra_cmyk = |
| 698 argb[_bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, | 707 argb[bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, |
| 699 u_w, v_w, res_x, res_y, 1, 0)]; | 708 u_w, v_w, res_x, res_y, 1, 0)]; |
| 700 if (transformF == FXDIB_Rgba) { | 709 if (transformF == FXDIB_Rgba) { |
| 701 dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); | 710 dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); |
| 702 dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); | 711 dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); |
| 703 dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); | 712 dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); |
| 704 } else { | 713 } else { |
| 705 *(FX_DWORD*)dest_pos = r_bgra_cmyk; | 714 *(FX_DWORD*)dest_pos = r_bgra_cmyk; |
| 706 } | 715 } |
| 707 } | 716 } |
| 708 dest_pos += destBpp; | 717 dest_pos += destBpp; |
| 709 } | 718 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 int src_col_r = src_col_l + 1; | 769 int src_col_r = src_col_l + 1; |
| 761 int src_row_r = src_row_l + 1; | 770 int src_row_r = src_row_l + 1; |
| 762 if (src_col_r == stretch_width) { | 771 if (src_col_r == stretch_width) { |
| 763 src_col_r--; | 772 src_col_r--; |
| 764 } | 773 } |
| 765 if (src_row_r == stretch_height) { | 774 if (src_row_r == stretch_height) { |
| 766 src_row_r--; | 775 src_row_r--; |
| 767 } | 776 } |
| 768 int row_offset_l = src_row_l * stretch_pitch; | 777 int row_offset_l = src_row_l * stretch_pitch; |
| 769 int row_offset_r = src_row_r * stretch_pitch; | 778 int row_offset_r = src_row_r * stretch_pitch; |
| 770 uint8_t r_pos_red_y_r = _bilinear_interpol( | 779 uint8_t r_pos_red_y_r = |
| 771 stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, | 780 bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, |
| 772 res_x, res_y, Bpp, 2); | 781 src_col_l, src_col_r, res_x, res_y, Bpp, 2); |
| 773 uint8_t r_pos_green_m_r = _bilinear_interpol( | 782 uint8_t r_pos_green_m_r = |
| 774 stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, | 783 bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, |
| 775 res_x, res_y, Bpp, 1); | 784 src_col_l, src_col_r, res_x, res_y, Bpp, 1); |
| 776 uint8_t r_pos_blue_c_r = _bilinear_interpol( | 785 uint8_t r_pos_blue_c_r = |
| 777 stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, | 786 bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, |
| 778 res_x, res_y, Bpp, 0); | 787 src_col_l, src_col_r, res_x, res_y, Bpp, 0); |
| 779 if (bHasAlpha) { | 788 if (bHasAlpha) { |
| 780 if (transformF != FXDIB_Argb) { | 789 if (transformF != FXDIB_Argb) { |
| 781 if (transformF == FXDIB_Rgba) { | 790 if (transformF == FXDIB_Rgba) { |
| 782 dest_pos[0] = r_pos_blue_c_r; | 791 dest_pos[0] = r_pos_blue_c_r; |
| 783 dest_pos[1] = r_pos_green_m_r; | 792 dest_pos[1] = r_pos_green_m_r; |
| 784 dest_pos[2] = r_pos_red_y_r; | 793 dest_pos[2] = r_pos_red_y_r; |
| 785 } else { | 794 } else { |
| 786 r_pos_k_r = _bilinear_interpol( | 795 r_pos_k_r = bilinear_interpol( |
| 787 stretch_buf, row_offset_l, row_offset_r, src_col_l, | 796 stretch_buf, row_offset_l, row_offset_r, src_col_l, |
| 788 src_col_r, res_x, res_y, Bpp, 3); | 797 src_col_r, res_x, res_y, Bpp, 3); |
| 789 *(FX_DWORD*)dest_pos = | 798 *(FX_DWORD*)dest_pos = |
| 790 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, | 799 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, |
| 791 r_pos_red_y_r, r_pos_k_r)); | 800 r_pos_red_y_r, r_pos_k_r)); |
| 792 } | 801 } |
| 793 } else { | 802 } else { |
| 794 uint8_t r_pos_a_r = _bilinear_interpol( | 803 uint8_t r_pos_a_r = bilinear_interpol( |
| 795 stretch_buf, row_offset_l, row_offset_r, src_col_l, | 804 stretch_buf, row_offset_l, row_offset_r, src_col_l, |
| 796 src_col_r, res_x, res_y, Bpp, 3); | 805 src_col_r, res_x, res_y, Bpp, 3); |
| 797 *(FX_DWORD*)dest_pos = FXARGB_TODIB( | 806 *(FX_DWORD*)dest_pos = FXARGB_TODIB( |
| 798 FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, | 807 FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, |
| 799 r_pos_blue_c_r)); | 808 r_pos_blue_c_r)); |
| 800 } | 809 } |
| 801 } else { | 810 } else { |
| 802 r_pos_k_r = 0xff; | 811 r_pos_k_r = 0xff; |
| 803 if (transformF == FXDIB_Cmyka) { | 812 if (transformF == FXDIB_Cmyka) { |
| 804 r_pos_k_r = _bilinear_interpol( | 813 r_pos_k_r = bilinear_interpol( |
| 805 stretch_buf, row_offset_l, row_offset_r, src_col_l, | 814 stretch_buf, row_offset_l, row_offset_r, src_col_l, |
| 806 src_col_r, res_x, res_y, Bpp, 3); | 815 src_col_r, res_x, res_y, Bpp, 3); |
| 807 *(FX_DWORD*)dest_pos = | 816 *(FX_DWORD*)dest_pos = |
| 808 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, | 817 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, |
| 809 r_pos_red_y_r, r_pos_k_r)); | 818 r_pos_red_y_r, r_pos_k_r)); |
| 810 } else { | 819 } else { |
| 811 *(FX_DWORD*)dest_pos = FXARGB_TODIB( | 820 *(FX_DWORD*)dest_pos = FXARGB_TODIB( |
| 812 FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, | 821 FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, |
| 813 r_pos_blue_c_r)); | 822 r_pos_blue_c_r)); |
| 814 } | 823 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 828 if (src_col_l >= 0 && src_col_l <= stretch_width && | 837 if (src_col_l >= 0 && src_col_l <= stretch_width && |
| 829 src_row_l >= 0 && src_row_l <= stretch_height) { | 838 src_row_l >= 0 && src_row_l <= stretch_height) { |
| 830 int pos_pixel[8]; | 839 int pos_pixel[8]; |
| 831 int u_w[4], v_w[4]; | 840 int u_w[4], v_w[4]; |
| 832 if (src_col_l == stretch_width) { | 841 if (src_col_l == stretch_width) { |
| 833 src_col_l--; | 842 src_col_l--; |
| 834 } | 843 } |
| 835 if (src_row_l == stretch_height) { | 844 if (src_row_l == stretch_height) { |
| 836 src_row_l--; | 845 src_row_l--; |
| 837 } | 846 } |
| 838 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, | 847 bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, |
| 839 res_x, res_y, stretch_width, | 848 res_x, res_y, stretch_width, |
| 840 stretch_height); | 849 stretch_height); |
| 841 uint8_t r_pos_red_y_r = | 850 uint8_t r_pos_red_y_r = |
| 842 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, | 851 bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, |
| 843 v_w, res_x, res_y, Bpp, 2); | 852 v_w, res_x, res_y, Bpp, 2); |
| 844 uint8_t r_pos_green_m_r = | 853 uint8_t r_pos_green_m_r = |
| 845 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, | 854 bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, |
| 846 v_w, res_x, res_y, Bpp, 1); | 855 v_w, res_x, res_y, Bpp, 1); |
| 847 uint8_t r_pos_blue_c_r = | 856 uint8_t r_pos_blue_c_r = |
| 848 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, | 857 bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, |
| 849 v_w, res_x, res_y, Bpp, 0); | 858 v_w, res_x, res_y, Bpp, 0); |
| 850 if (bHasAlpha) { | 859 if (bHasAlpha) { |
| 851 if (transformF != FXDIB_Argb) { | 860 if (transformF != FXDIB_Argb) { |
| 852 if (transformF == FXDIB_Rgba) { | 861 if (transformF == FXDIB_Rgba) { |
| 853 dest_pos[0] = r_pos_blue_c_r; | 862 dest_pos[0] = r_pos_blue_c_r; |
| 854 dest_pos[1] = r_pos_green_m_r; | 863 dest_pos[1] = r_pos_green_m_r; |
| 855 dest_pos[2] = r_pos_red_y_r; | 864 dest_pos[2] = r_pos_red_y_r; |
| 856 } else { | 865 } else { |
| 857 r_pos_k_r = | 866 r_pos_k_r = |
| 858 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, | 867 bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, |
| 859 u_w, v_w, res_x, res_y, Bpp, 3); | 868 u_w, v_w, res_x, res_y, Bpp, 3); |
| 860 *(FX_DWORD*)dest_pos = | 869 *(FX_DWORD*)dest_pos = |
| 861 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, | 870 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, |
| 862 r_pos_red_y_r, r_pos_k_r)); | 871 r_pos_red_y_r, r_pos_k_r)); |
| 863 } | 872 } |
| 864 } else { | 873 } else { |
| 865 uint8_t r_pos_a_r = | 874 uint8_t r_pos_a_r = |
| 866 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, | 875 bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, |
| 867 u_w, v_w, res_x, res_y, Bpp, 3); | 876 u_w, v_w, res_x, res_y, Bpp, 3); |
| 868 *(FX_DWORD*)dest_pos = FXARGB_TODIB( | 877 *(FX_DWORD*)dest_pos = FXARGB_TODIB( |
| 869 FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, | 878 FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, |
| 870 r_pos_blue_c_r)); | 879 r_pos_blue_c_r)); |
| 871 } | 880 } |
| 872 } else { | 881 } else { |
| 873 r_pos_k_r = 0xff; | 882 r_pos_k_r = 0xff; |
| 874 if (transformF == FXDIB_Cmyka) { | 883 if (transformF == FXDIB_Cmyka) { |
| 875 r_pos_k_r = | 884 r_pos_k_r = |
| 876 _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, | 885 bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, |
| 877 u_w, v_w, res_x, res_y, Bpp, 3); | 886 u_w, v_w, res_x, res_y, Bpp, 3); |
| 878 *(FX_DWORD*)dest_pos = | 887 *(FX_DWORD*)dest_pos = |
| 879 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, | 888 FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, |
| 880 r_pos_red_y_r, r_pos_k_r)); | 889 r_pos_red_y_r, r_pos_k_r)); |
| 881 } else { | 890 } else { |
| 882 *(FX_DWORD*)dest_pos = FXARGB_TODIB( | 891 *(FX_DWORD*)dest_pos = FXARGB_TODIB( |
| 883 FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, | 892 FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, |
| 884 r_pos_blue_c_r)); | 893 r_pos_blue_c_r)); |
| 885 } | 894 } |
| 886 } | 895 } |
| 887 } | 896 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 } | 940 } |
| 932 dest_pos += destBpp; | 941 dest_pos += destBpp; |
| 933 } | 942 } |
| 934 } | 943 } |
| 935 } | 944 } |
| 936 } | 945 } |
| 937 } | 946 } |
| 938 m_Storer.Replace(pTransformed); | 947 m_Storer.Replace(pTransformed); |
| 939 return FALSE; | 948 return FALSE; |
| 940 } | 949 } |
| OLD | NEW |