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