| 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 int SDP_Table[513] = { |
| 10 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, 2
54, 254, 254, 254, | 10 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, 2
54, 254, 254, 254, |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 413 } |
| 414 int row_offset_l = src_row_l * stretch_pitch_mask; | 414 int row_offset_l = src_row_l * stretch_pitch_mask; |
| 415 int row_offset_r = src_row_r * stretch_pitch_mask; | 415 int row_offset_r = src_row_r * stretch_pitch_mask; |
| 416 *dest_pos_mask = _bilinear_interpol(stretch_buf_mask, ro
w_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0); | 416 *dest_pos_mask = _bilinear_interpol(stretch_buf_mask, ro
w_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0); |
| 417 } | 417 } |
| 418 dest_pos_mask++; | 418 dest_pos_mask++; |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { | 421 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { |
| 422 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 422 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 423 int pos_pixel[8]; | |
| 424 for (int row = 0; row < m_ResultHeight; row ++) { | 423 for (int row = 0; row < m_ResultHeight; row ++) { |
| 425 FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->G
etScanline(row); | 424 FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->G
etScanline(row); |
| 426 for (int col = 0; col < m_ResultWidth; col ++) { | 425 for (int col = 0; col < m_ResultWidth; col ++) { |
| 427 int src_col_l, src_row_l, res_x, res_y; | 426 int src_col_l, src_row_l, res_x, res_y; |
| 428 result2stretch_fix.Transform(col, row, src_col_l, src_row_l,
res_x, res_y); | 427 result2stretch_fix.Transform(col, row, src_col_l, src_row_l,
res_x, res_y); |
| 429 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_
l >= 0 && src_row_l <= stretch_height) { | 428 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_
l >= 0 && src_row_l <= stretch_height) { |
| 429 int pos_pixel[8]; |
| 430 int u_w[4], v_w[4]; | 430 int u_w[4], v_w[4]; |
| 431 if (src_col_l == stretch_width) { | 431 if (src_col_l == stretch_width) { |
| 432 src_col_l--; | 432 src_col_l--; |
| 433 } | 433 } |
| 434 if (src_row_l == stretch_height) { | 434 if (src_row_l == stretch_height) { |
| 435 src_row_l--; | 435 src_row_l--; |
| 436 } | 436 } |
| 437 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l,
src_row_l, res_x, res_y, stretch_width, stretch_height); | 437 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l,
src_row_l, res_x, res_y, stretch_width, stretch_height); |
| 438 *dest_pos_mask = _bicubic_interpol(stretch_buf_mask, str
etch_pitch_mask, pos_pixel, u_w, v_w, res_x, res_y, 1, 0); | 438 *dest_pos_mask = _bicubic_interpol(stretch_buf_mask, str
etch_pitch_mask, pos_pixel, u_w, v_w, res_x, res_y, 1, 0); |
| 439 } | 439 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 486 } |
| 487 int row_offset_l = src_row_l * stretch_pitch; | 487 int row_offset_l = src_row_l * stretch_pitch; |
| 488 int row_offset_r = src_row_r * stretch_pitch; | 488 int row_offset_r = src_row_r * stretch_pitch; |
| 489 *dest_scan = _bilinear_interpol(stretch_buf, row_offset_
l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0); | 489 *dest_scan = _bilinear_interpol(stretch_buf, row_offset_
l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0); |
| 490 } | 490 } |
| 491 dest_scan ++; | 491 dest_scan ++; |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { | 494 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { |
| 495 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 495 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 496 int pos_pixel[8]; | |
| 497 for (int row = 0; row < m_ResultHeight; row ++) { | 496 for (int row = 0; row < m_ResultHeight; row ++) { |
| 498 FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); | 497 FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row); |
| 499 for (int col = 0; col < m_ResultWidth; col ++) { | 498 for (int col = 0; col < m_ResultWidth; col ++) { |
| 500 int src_col_l, src_row_l, res_x, res_y; | 499 int src_col_l, src_row_l, res_x, res_y; |
| 501 result2stretch_fix.Transform(col, row, src_col_l, src_row_l,
res_x, res_y); | 500 result2stretch_fix.Transform(col, row, src_col_l, src_row_l,
res_x, res_y); |
| 502 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_
l >= 0 && src_row_l <= stretch_height) { | 501 if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_
l >= 0 && src_row_l <= stretch_height) { |
| 502 int pos_pixel[8]; |
| 503 int u_w[4], v_w[4]; | 503 int u_w[4], v_w[4]; |
| 504 if (src_col_l == stretch_width) { | 504 if (src_col_l == stretch_width) { |
| 505 src_col_l--; | 505 src_col_l--; |
| 506 } | 506 } |
| 507 if (src_row_l == stretch_height) { | 507 if (src_row_l == stretch_height) { |
| 508 src_row_l--; | 508 src_row_l--; |
| 509 } | 509 } |
| 510 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l,
src_row_l, res_x, res_y, stretch_width, stretch_height); | 510 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l,
src_row_l, res_x, res_y, stretch_width, stretch_height); |
| 511 *dest_scan = _bicubic_interpol(stretch_buf, stretch_pitc
h, pos_pixel, u_w, v_w, res_x, res_y, 1, 0); | 511 *dest_scan = _bicubic_interpol(stretch_buf, stretch_pitc
h, pos_pixel, u_w, v_w, res_x, res_y, 1, 0); |
| 512 } | 512 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); | 586 dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8); |
| 587 } else { | 587 } else { |
| 588 *(FX_DWORD*)dest_pos = r_bgra_cmyk; | 588 *(FX_DWORD*)dest_pos = r_bgra_cmyk; |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 dest_pos += destBpp; | 591 dest_pos += destBpp; |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { | 594 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { |
| 595 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 595 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 596 int pos_pixel[8]; | |
| 597 for (int row = 0; row < m_ResultHeight; row ++) { | 596 for (int row = 0; row < m_ResultHeight; row ++) { |
| 598 FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row)
; | 597 FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row)
; |
| 599 for (int col = 0; col < m_ResultWidth; col ++) { | 598 for (int col = 0; col < m_ResultWidth; col ++) { |
| 600 int src_col_l, src_row_l, res_x, res_y; | 599 int src_col_l, src_row_l, res_x, res_y; |
| 601 result2stretch_fix.Transform(col, row, src_col_l, src_ro
w_l, res_x, res_y); | 600 result2stretch_fix.Transform(col, row, src_col_l, src_ro
w_l, res_x, res_y); |
| 602 if (src_col_l >= 0 && src_col_l <= stretch_width && src_
row_l >= 0 && src_row_l <= stretch_height) { | 601 if (src_col_l >= 0 && src_col_l <= stretch_width && src_
row_l >= 0 && src_row_l <= stretch_height) { |
| 602 int pos_pixel[8]; |
| 603 int u_w[4], v_w[4]; | 603 int u_w[4], v_w[4]; |
| 604 if (src_col_l == stretch_width) { | 604 if (src_col_l == stretch_width) { |
| 605 src_col_l--; | 605 src_col_l--; |
| 606 } | 606 } |
| 607 if (src_row_l == stretch_height) { | 607 if (src_row_l == stretch_height) { |
| 608 src_row_l--; | 608 src_row_l--; |
| 609 } | 609 } |
| 610 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col
_l, src_row_l, res_x, res_y, stretch_width, stretch_height); | 610 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col
_l, src_row_l, res_x, res_y, stretch_width, stretch_height); |
| 611 FX_DWORD r_bgra_cmyk = argb[_bicubic_interpol(stretc
h_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, 1, 0)]; | 611 FX_DWORD r_bgra_cmyk = argb[_bicubic_interpol(stretc
h_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, 1, 0)]; |
| 612 if (transformF == FXDIB_Rgba) { | 612 if (transformF == FXDIB_Rgba) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } else { | 699 } else { |
| 700 *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_M
AKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); | 700 *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_M
AKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 } | 703 } |
| 704 dest_pos += destBpp; | 704 dest_pos += destBpp; |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { | 707 } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) { |
| 708 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 708 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 709 int pos_pixel[8]; | |
| 710 for (int row = 0; row < m_ResultHeight; row ++) { | 709 for (int row = 0; row < m_ResultHeight; row ++) { |
| 711 FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row)
; | 710 FX_BYTE* dest_pos = (FX_BYTE*)pTransformed->GetScanline(row)
; |
| 712 for (int col = 0; col < m_ResultWidth; col ++) { | 711 for (int col = 0; col < m_ResultWidth; col ++) { |
| 713 int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; | 712 int src_col_l, src_row_l, res_x, res_y, r_pos_k_r = 0; |
| 714 result2stretch_fix.Transform(col, row, src_col_l, src_ro
w_l, res_x, res_y); | 713 result2stretch_fix.Transform(col, row, src_col_l, src_ro
w_l, res_x, res_y); |
| 715 if (src_col_l >= 0 && src_col_l <= stretch_width && src_
row_l >= 0 && src_row_l <= stretch_height) { | 714 if (src_col_l >= 0 && src_col_l <= stretch_width && src_
row_l >= 0 && src_row_l <= stretch_height) { |
| 715 int pos_pixel[8]; |
| 716 int u_w[4], v_w[4]; | 716 int u_w[4], v_w[4]; |
| 717 if (src_col_l == stretch_width) { | 717 if (src_col_l == stretch_width) { |
| 718 src_col_l--; | 718 src_col_l--; |
| 719 } | 719 } |
| 720 if (src_row_l == stretch_height) { | 720 if (src_row_l == stretch_height) { |
| 721 src_row_l--; | 721 src_row_l--; |
| 722 } | 722 } |
| 723 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col
_l, src_row_l, res_x, res_y, stretch_width, stretch_height); | 723 _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col
_l, src_row_l, res_x, res_y, stretch_width, stretch_height); |
| 724 FX_BYTE r_pos_red_y_r = _bicubic_interpol(stretch_
buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 2); | 724 FX_BYTE r_pos_red_y_r = _bicubic_interpol(stretch_
buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 2); |
| 725 FX_BYTE r_pos_green_m_r = _bicubic_interpol(stretch_
buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 1); | 725 FX_BYTE r_pos_green_m_r = _bicubic_interpol(stretch_
buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 1); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 788 } |
| 789 dest_pos += destBpp; | 789 dest_pos += destBpp; |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 } | 793 } |
| 794 } | 794 } |
| 795 m_Storer.Replace(pTransformed); | 795 m_Storer.Replace(pTransformed); |
| 796 return FALSE; | 796 return FALSE; |
| 797 } | 797 } |
| OLD | NEW |