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 <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 if (dest_clip.IsEmpty()) { | 188 if (dest_clip.IsEmpty()) { |
189 return nullptr; | 189 return nullptr; |
190 } | 190 } |
191 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; | 191 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; |
192 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); | 192 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); |
193 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { | 193 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { |
194 delete pTransBitmap; | 194 delete pTransBitmap; |
195 return nullptr; | 195 return nullptr; |
196 } | 196 } |
197 pTransBitmap->CopyPalette(m_pPalette.get()); | 197 pTransBitmap->SetPalette(m_pPalette.get()); |
198 int dest_pitch = pTransBitmap->GetPitch(); | 198 int dest_pitch = pTransBitmap->GetPitch(); |
199 uint8_t* dest_buf = pTransBitmap->GetBuffer(); | 199 uint8_t* dest_buf = pTransBitmap->GetBuffer(); |
200 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; | 200 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; |
201 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; | 201 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; |
202 int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; | 202 int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; |
203 int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; | 203 int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; |
204 if (GetBPP() == 1) { | 204 if (GetBPP() == 1) { |
205 FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height); | 205 FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height); |
206 for (int row = row_start; row < row_end; row++) { | 206 for (int row = row_start; row < row_end; row++) { |
207 const uint8_t* src_scan = GetScanline(row); | 207 const uint8_t* src_scan = GetScanline(row); |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } | 952 } |
953 } | 953 } |
954 } | 954 } |
955 m_Storer.Replace(std::move(pTransformed)); | 955 m_Storer.Replace(std::move(pTransformed)); |
956 return false; | 956 return false; |
957 } | 957 } |
958 | 958 |
959 std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() { | 959 std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() { |
960 return m_Storer.Detach(); | 960 return m_Storer.Detach(); |
961 } | 961 } |
OLD | NEW |