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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 }; | 176 }; |
177 CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, | 177 CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, |
178 FX_BOOL bYFlip, | 178 FX_BOOL bYFlip, |
179 const FX_RECT* pDestClip) const { | 179 const FX_RECT* pDestClip) const { |
180 FX_RECT dest_clip(0, 0, m_Height, m_Width); | 180 FX_RECT dest_clip(0, 0, m_Height, m_Width); |
181 if (pDestClip) { | 181 if (pDestClip) { |
182 dest_clip.Intersect(*pDestClip); | 182 dest_clip.Intersect(*pDestClip); |
183 } | 183 } |
184 if (dest_clip.IsEmpty()) { | 184 if (dest_clip.IsEmpty()) { |
185 return NULL; | 185 return nullptr; |
186 } | 186 } |
187 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; | 187 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; |
188 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); | 188 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); |
189 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { | 189 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { |
190 delete pTransBitmap; | 190 delete pTransBitmap; |
191 return NULL; | 191 return nullptr; |
192 } | 192 } |
193 pTransBitmap->CopyPalette(m_pPalette); | 193 pTransBitmap->CopyPalette(m_pPalette); |
194 int dest_pitch = pTransBitmap->GetPitch(); | 194 int dest_pitch = pTransBitmap->GetPitch(); |
195 uint8_t* dest_buf = pTransBitmap->GetBuffer(); | 195 uint8_t* dest_buf = pTransBitmap->GetBuffer(); |
196 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; | 196 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; |
197 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; | 197 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; |
198 int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; | 198 int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; |
199 int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; | 199 int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; |
200 if (GetBPP() == 1) { | 200 if (GetBPP() == 1) { |
201 FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height); | 201 FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height); |
(...skipping 744 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 |