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