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 #include "core/fxge/include/fx_ge.h" | 5 #include "core/fxge/include/fx_ge.h" |
6 | 6 |
7 #if defined(_SKIA_SUPPORT_) | 7 #if defined(_SKIA_SUPPORT_) |
8 #include "core/fxcodec/include/fx_codec.h" | 8 #include "core/fxcodec/include/fx_codec.h" |
9 | 9 |
10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 int dest_top, | 252 int dest_top, |
253 int width, | 253 int width, |
254 int height, | 254 int height, |
255 const CFX_DIBSource* pSrcBitmap, | 255 const CFX_DIBSource* pSrcBitmap, |
256 int src_left, | 256 int src_left, |
257 int src_top) { | 257 int src_top) { |
258 if (!pBitmap) | 258 if (!pBitmap) |
259 return; | 259 return; |
260 pBitmap->GetOverlapRect(dest_left, dest_top, width, height, | 260 pBitmap->GetOverlapRect(dest_left, dest_top, width, height, |
261 pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), | 261 pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), |
262 src_left, src_top, NULL); | 262 src_left, src_top, nullptr); |
263 if (width == 0 || height == 0) | 263 if (width == 0 || height == 0) |
264 return; | 264 return; |
265 int Bpp = pBitmap->GetBPP() / 8; | 265 int Bpp = pBitmap->GetBPP() / 8; |
266 FXDIB_Format dest_format = pBitmap->GetFormat(); | 266 FXDIB_Format dest_format = pBitmap->GetFormat(); |
267 FXDIB_Format src_format = pSrcBitmap->GetFormat(); | 267 FXDIB_Format src_format = pSrcBitmap->GetFormat(); |
268 int pitch = pBitmap->GetPitch(); | 268 int pitch = pBitmap->GetPitch(); |
269 uint8_t* buffer = pBitmap->GetBuffer(); | 269 uint8_t* buffer = pBitmap->GetBuffer(); |
270 if (dest_format == src_format) { | 270 if (dest_format == src_format) { |
271 for (int row = 0; row < height; row++) { | 271 for (int row = 0; row < height; row++) { |
272 uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; | 272 uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 } else { | 307 } else { |
308 ASSERT(FALSE); | 308 ASSERT(FALSE); |
309 } | 309 } |
310 } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { | 310 } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { |
311 if (src_format == FXDIB_Rgb) { | 311 if (src_format == FXDIB_Rgb) { |
312 for (int row = 0; row < height; row++) { | 312 for (int row = 0; row < height; row++) { |
313 uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); | 313 uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); |
314 uint8_t* src_scan = | 314 uint8_t* src_scan = |
315 (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; | 315 (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; |
316 if (src_format == FXDIB_Argb) { | 316 for (int col = 0; col < width; col++) { |
317 for (int col = 0; col < width; col++) { | 317 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], |
318 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, FX_GAMMA(src_scan[0]), | 318 src_scan[2])); |
319 FX_GAMMA(src_scan[1]), | 319 dest_scan += 4; |
320 FX_GAMMA(src_scan[2]))); | 320 src_scan += 3; |
321 dest_scan += 4; | |
322 src_scan += 3; | |
323 } | |
324 } else { | |
325 for (int col = 0; col < width; col++) { | |
326 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], | |
327 src_scan[2])); | |
328 dest_scan += 4; | |
329 src_scan += 3; | |
330 } | |
331 } | 321 } |
332 } | 322 } |
333 } else if (src_format == FXDIB_Rgb32) { | 323 } else if (src_format == FXDIB_Rgb32) { |
334 ASSERT(dest_format == FXDIB_Argb); | 324 ASSERT(dest_format == FXDIB_Argb); |
335 for (int row = 0; row < height; row++) { | 325 for (int row = 0; row < height; row++) { |
336 uint8_t* dest_scan = dest_buf + row * pitch; | 326 uint8_t* dest_scan = dest_buf + row * pitch; |
337 uint8_t* src_scan = | 327 uint8_t* src_scan = |
338 (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); | 328 (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); |
339 for (int col = 0; col < width; col++) { | 329 for (int col = 0; col < width; col++) { |
340 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], | 330 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 SetDeviceDriver(pDriver); | 1127 SetDeviceDriver(pDriver); |
1138 return true; | 1128 return true; |
1139 } | 1129 } |
1140 | 1130 |
1141 CFX_FxgeDevice::~CFX_FxgeDevice() { | 1131 CFX_FxgeDevice::~CFX_FxgeDevice() { |
1142 if (m_bOwnedBitmap && GetBitmap()) | 1132 if (m_bOwnedBitmap && GetBitmap()) |
1143 delete GetBitmap(); | 1133 delete GetBitmap(); |
1144 } | 1134 } |
1145 | 1135 |
1146 #endif | 1136 #endif |
OLD | NEW |