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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 CFX_DIBitmap* pTransBitmap = FX_NEW CFX_DIBitmap; | 66 CFX_DIBitmap* pTransBitmap = FX_NEW CFX_DIBitmap; |
67 if (!pTransBitmap) { | 67 if (!pTransBitmap) { |
68 return NULL; | 68 return NULL; |
69 } | 69 } |
70 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); | 70 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); |
71 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { | 71 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { |
72 delete pTransBitmap; | 72 delete pTransBitmap; |
73 return NULL; | 73 return NULL; |
74 } | 74 } |
75 pTransBitmap->CopyPalette(m_pPalette); | 75 pTransBitmap->CopyPalette(m_pPalette); |
76 int src_pitch = m_Pitch; | |
77 int dest_pitch = pTransBitmap->GetPitch(); | 76 int dest_pitch = pTransBitmap->GetPitch(); |
78 FX_LPBYTE dest_buf = pTransBitmap->GetBuffer(); | 77 FX_LPBYTE dest_buf = pTransBitmap->GetBuffer(); |
79 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; | 78 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; |
80 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; | 79 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; |
81 int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; | 80 int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; |
82 int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; | 81 int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; |
83 if (GetBPP() == 1) { | 82 if (GetBPP() == 1) { |
84 FXSYS_memset8(dest_buf, 0xff, dest_pitch * result_height); | 83 FXSYS_memset8(dest_buf, 0xff, dest_pitch * result_height); |
85 for (int row = row_start; row < row_end; row ++) { | 84 for (int row = row_start; row < row_end; row ++) { |
86 FX_LPCBYTE src_scan = GetScanline(row); | 85 FX_LPCBYTE src_scan = GetScanline(row); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 for (int col = col_start; col < col_end; col ++) { | 125 for (int col = col_start; col < col_end; col ++) { |
127 *dest_scan++ = *src_scan++; | 126 *dest_scan++ = *src_scan++; |
128 *dest_scan++ = *src_scan++; | 127 *dest_scan++ = *src_scan++; |
129 *dest_scan = *src_scan++; | 128 *dest_scan = *src_scan++; |
130 dest_scan += dest_step; | 129 dest_scan += dest_step; |
131 } | 130 } |
132 } | 131 } |
133 } | 132 } |
134 } | 133 } |
135 if (m_pAlphaMask) { | 134 if (m_pAlphaMask) { |
136 src_pitch = m_pAlphaMask->m_Pitch; | |
137 dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch(); | 135 dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch(); |
138 dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer(); | 136 dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer(); |
139 int dest_step = bYFlip ? -dest_pitch : dest_pitch; | 137 int dest_step = bYFlip ? -dest_pitch : dest_pitch; |
140 for (int row = row_start; row < row_end; row ++) { | 138 for (int row = row_start; row < row_end; row ++) { |
141 int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : r
ow) - dest_clip.left; | 139 int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : r
ow) - dest_clip.left; |
142 FX_LPBYTE dest_scan = dest_buf + dest_col; | 140 FX_LPBYTE dest_scan = dest_buf + dest_col; |
143 if (bYFlip) { | 141 if (bYFlip) { |
144 dest_scan += (result_height - 1) * dest_pitch; | 142 dest_scan += (result_height - 1) * dest_pitch; |
145 } | 143 } |
146 FX_LPCBYTE src_scan = m_pAlphaMask->GetScanline(row) + col_start; | 144 FX_LPCBYTE src_scan = m_pAlphaMask->GetScanline(row) + col_start; |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 } | 785 } |
788 dest_pos += destBpp; | 786 dest_pos += destBpp; |
789 } | 787 } |
790 } | 788 } |
791 } | 789 } |
792 } | 790 } |
793 } | 791 } |
794 m_Storer.Replace(pTransformed); | 792 m_Storer.Replace(pTransformed); |
795 return FALSE; | 793 return FALSE; |
796 } | 794 } |
OLD | NEW |