| 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 "core/fxge/dib/dib_int.h" | 7 #include "core/fxge/dib/dib_int.h" |
| 8 | 8 |
| 9 #include "core/fxge/include/fx_dib.h" | 9 #include "core/fxge/include/fx_dib.h" |
| 10 | 10 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 const uint8_t* src_pixel = | 617 const uint8_t* src_pixel = |
| 618 stretch_buf + stretch_pitch * src_row + src_col; | 618 stretch_buf + stretch_pitch * src_row + src_col; |
| 619 *dest_scan = *src_pixel; | 619 *dest_scan = *src_pixel; |
| 620 } | 620 } |
| 621 dest_scan++; | 621 dest_scan++; |
| 622 } | 622 } |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 } else { | 625 } else { |
| 626 int Bpp = m_Storer.GetBitmap()->GetBPP() / 8; | 626 int Bpp = m_Storer.GetBitmap()->GetBPP() / 8; |
| 627 int destBpp = pTransformed->GetBPP() / 8; | |
| 628 if (Bpp == 1) { | 627 if (Bpp == 1) { |
| 629 uint32_t argb[256]; | 628 uint32_t argb[256]; |
| 630 FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette(); | 629 FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette(); |
| 631 if (pPal) { | 630 if (pPal) { |
| 632 for (int i = 0; i < 256; i++) { | 631 for (int i = 0; i < 256; i++) { |
| 633 argb[i] = pPal[i]; | 632 argb[i] = pPal[i]; |
| 634 } | 633 } |
| 635 } else { | 634 } else { |
| 636 if (m_Storer.GetBitmap()->IsCmykImage()) { | 635 if (m_Storer.GetBitmap()->IsCmykImage()) { |
| 637 for (int i = 0; i < 256; i++) { | 636 for (int i = 0; i < 256; i++) { |
| 638 argb[i] = 255 - i; | 637 argb[i] = 255 - i; |
| 639 } | 638 } |
| 640 } else { | 639 } else { |
| 641 for (int i = 0; i < 256; i++) { | 640 for (int i = 0; i < 256; i++) { |
| 642 argb[i] = 0xff000000 | (i * 0x010101); | 641 argb[i] = 0xff000000 | (i * 0x010101); |
| 643 } | 642 } |
| 644 } | 643 } |
| 645 } | 644 } |
| 645 int destBpp = pTransformed->GetBPP() / 8; |
| 646 if (!(m_Flags & FXDIB_DOWNSAMPLE) && | 646 if (!(m_Flags & FXDIB_DOWNSAMPLE) && |
| 647 !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { | 647 !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { |
| 648 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 648 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
| 649 for (int row = 0; row < m_result.Height(); row++) { | 649 for (int row = 0; row < m_result.Height(); row++) { |
| 650 uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); | 650 uint8_t* dest_pos = (uint8_t*)pTransformed->GetScanline(row); |
| 651 for (int col = 0; col < m_result.Width(); col++) { | 651 for (int col = 0; col < m_result.Width(); col++) { |
| 652 int src_col_l, src_row_l, res_x, res_y; | 652 int src_col_l, src_row_l, res_x, res_y; |
| 653 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, | 653 result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, |
| 654 res_y); | 654 res_y); |
| 655 if (src_col_l >= 0 && src_col_l <= stretch_width && | 655 if (src_col_l >= 0 && src_col_l <= stretch_width && |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 } | 946 } |
| 947 } | 947 } |
| 948 } | 948 } |
| 949 m_Storer.Replace(std::move(pTransformed)); | 949 m_Storer.Replace(std::move(pTransformed)); |
| 950 return FALSE; | 950 return FALSE; |
| 951 } | 951 } |
| 952 | 952 |
| 953 std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() { | 953 std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() { |
| 954 return m_Storer.Detach(); | 954 return m_Storer.Detach(); |
| 955 } | 955 } |
| OLD | NEW |