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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 FX_LPBYTE scanline = m_pBuffer + row * m_Pitch + 3; | 1001 FX_LPBYTE scanline = m_pBuffer + row * m_Pitch + 3; |
1002 for (int col = 0; col < m_Width; col ++) { | 1002 for (int col = 0; col < m_Width; col ++) { |
1003 *scanline = 0xff; | 1003 *scanline = 0xff; |
1004 scanline += 4; | 1004 scanline += 4; |
1005 } | 1005 } |
1006 } | 1006 } |
1007 return TRUE; | 1007 return TRUE; |
1008 } | 1008 } |
1009 int dest_bpp = dest_format & 0xff; | 1009 int dest_bpp = dest_format & 0xff; |
1010 int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; | 1010 int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; |
1011 FX_LPBYTE dest_buf = FX_AllocNL(FX_BYTE, dest_pitch * m_Height + 4); | 1011 FX_LPBYTE dest_buf = FX_TryAlloc(FX_BYTE, dest_pitch * m_Height + 4); |
1012 if (dest_buf == NULL) { | 1012 if (dest_buf == NULL) { |
1013 return FALSE; | 1013 return FALSE; |
1014 } | 1014 } |
1015 CFX_DIBitmap* pAlphaMask = NULL; | 1015 CFX_DIBitmap* pAlphaMask = NULL; |
1016 if (dest_format == FXDIB_Argb) { | 1016 if (dest_format == FXDIB_Argb) { |
1017 FXSYS_memset8(dest_buf, 0xff, dest_pitch * m_Height + 4); | 1017 FXSYS_memset8(dest_buf, 0xff, dest_pitch * m_Height + 4); |
1018 if (m_pAlphaMask) { | 1018 if (m_pAlphaMask) { |
1019 for (int row = 0; row < m_Height; row ++) { | 1019 for (int row = 0; row < m_Height; row ++) { |
1020 FX_LPBYTE pDstScanline = dest_buf + row * dest_pitch + 3; | 1020 FX_LPBYTE pDstScanline = dest_buf + row * dest_pitch + 3; |
1021 FX_LPCBYTE pSrcScanline = m_pAlphaMask->GetScanline(row); | 1021 FX_LPCBYTE pSrcScanline = m_pAlphaMask->GetScanline(row); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 if (!m_bExtBuf) { | 1071 if (!m_bExtBuf) { |
1072 FX_Free(m_pBuffer); | 1072 FX_Free(m_pBuffer); |
1073 } | 1073 } |
1074 m_bExtBuf = FALSE; | 1074 m_bExtBuf = FALSE; |
1075 m_pBuffer = dest_buf; | 1075 m_pBuffer = dest_buf; |
1076 m_bpp = (FX_BYTE)dest_format; | 1076 m_bpp = (FX_BYTE)dest_format; |
1077 m_AlphaFlag = (FX_BYTE)(dest_format >> 8); | 1077 m_AlphaFlag = (FX_BYTE)(dest_format >> 8); |
1078 m_Pitch = dest_pitch; | 1078 m_Pitch = dest_pitch; |
1079 return TRUE; | 1079 return TRUE; |
1080 } | 1080 } |
OLD | NEW |