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 "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 const FX_DWORD g_dwWinPalette[256] = { | 10 const FX_DWORD g_dwWinPalette[256] = { |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; | 445 FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; |
446 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + s
rc_left * 4; | 446 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + s
rc_left * 4; |
447 for (int col = 0; col < width; col ++) { | 447 for (int col = 0; col < width; col ++) { |
448 FX_BYTE r, g, b; | 448 FX_BYTE r, g, b; |
449 AdobeCMYK_to_sRGB1(FXSYS_GetCValue((FX_DWORD)src_scan[0]), F
XSYS_GetMValue((FX_DWORD)src_scan[1]), FXSYS_GetYValue((FX_DWORD)src_scan[2]), F
XSYS_GetKValue((FX_DWORD)src_scan[3]), | 449 AdobeCMYK_to_sRGB1(FXSYS_GetCValue((FX_DWORD)src_scan[0]), F
XSYS_GetMValue((FX_DWORD)src_scan[1]), FXSYS_GetYValue((FX_DWORD)src_scan[2]), F
XSYS_GetKValue((FX_DWORD)src_scan[3]), |
450 r, g, b); | 450 r, g, b); |
451 *dest_scan++ = FXRGB2GRAY(r, g, b); | 451 *dest_scan++ = FXRGB2GRAY(r, g, b); |
452 src_scan += 4; | 452 src_scan += 4; |
453 } | 453 } |
454 } | 454 } |
455 } else | 455 } else { |
456 for (int row = 0; row < height; row ++) { | 456 for (int row = 0; row < height; row ++) { |
457 FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; | 457 FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; |
458 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + s
rc_left * Bpp; | 458 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + s
rc_left * Bpp; |
459 for (int col = 0; col < width; col ++) { | 459 for (int col = 0; col < width; col ++) { |
460 *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan
[0]); | 460 *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan
[0]); |
461 src_scan += Bpp; | 461 src_scan += Bpp; |
462 } | 462 } |
463 } | 463 } |
| 464 } |
464 } | 465 } |
465 return TRUE; | 466 return TRUE; |
466 } | 467 } |
467 inline void _ConvertBuffer_IndexCopy(FX_LPBYTE dest_buf, int dest_pitch, int wid
th, int height, | 468 inline void _ConvertBuffer_IndexCopy(FX_LPBYTE dest_buf, int dest_pitch, int wid
th, int height, |
468 const CFX_DIBSource* pSrcBitmap, int src_le
ft, int src_top) | 469 const CFX_DIBSource* pSrcBitmap, int src_le
ft, int src_top) |
469 { | 470 { |
470 if (pSrcBitmap->GetBPP() == 1) { | 471 if (pSrcBitmap->GetBPP() == 1) { |
471 for (int row = 0; row < height; row ++) { | 472 for (int row = 0; row < height; row ++) { |
472 FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; | 473 FX_LPBYTE dest_scan = dest_buf + row * dest_pitch; |
473 FXSYS_memset32(dest_scan, 0, width); | 474 FXSYS_memset32(dest_scan, 0, width); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 if (!m_bExtBuf) { | 1082 if (!m_bExtBuf) { |
1082 FX_Free(m_pBuffer); | 1083 FX_Free(m_pBuffer); |
1083 } | 1084 } |
1084 m_bExtBuf = FALSE; | 1085 m_bExtBuf = FALSE; |
1085 m_pBuffer = dest_buf; | 1086 m_pBuffer = dest_buf; |
1086 m_bpp = (FX_BYTE)dest_format; | 1087 m_bpp = (FX_BYTE)dest_format; |
1087 m_AlphaFlag = (FX_BYTE)(dest_format >> 8); | 1088 m_AlphaFlag = (FX_BYTE)(dest_format >> 8); |
1088 m_Pitch = dest_pitch; | 1089 m_Pitch = dest_pitch; |
1089 return TRUE; | 1090 return TRUE; |
1090 } | 1091 } |
OLD | NEW |