| 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/fpdfapi/fpdf_module.h" | 7 #include "../../../include/fpdfapi/fpdf_module.h" |
| 8 #include "../../../include/fpdfapi/fpdf_page.h" | 8 #include "../../../include/fpdfapi/fpdf_page.h" |
| 9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "../../../include/fpdfapi/fpdf_render.h" | 10 #include "../../../include/fpdfapi/fpdf_render.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 opType = 0; | 155 opType = 0; |
| 156 } | 156 } |
| 157 } else if (bpp == 8) { | 157 } else if (bpp == 8) { |
| 158 FX_INT32 iPalette = pBitmap->GetPaletteSize(); | 158 FX_INT32 iPalette = pBitmap->GetPaletteSize(); |
| 159 if (iPalette > 0) { | 159 if (iPalette > 0) { |
| 160 CPDF_Array* pCS = new CPDF_Array; | 160 CPDF_Array* pCS = new CPDF_Array; |
| 161 m_pDocument->AddIndirectObject(pCS); | 161 m_pDocument->AddIndirectObject(pCS); |
| 162 pCS->AddName(FX_BSTRC("Indexed")); | 162 pCS->AddName(FX_BSTRC("Indexed")); |
| 163 pCS->AddName(FX_BSTRC("DeviceRGB")); | 163 pCS->AddName(FX_BSTRC("DeviceRGB")); |
| 164 pCS->AddInteger(iPalette - 1); | 164 pCS->AddInteger(iPalette - 1); |
| 165 FX_LPBYTE pColorTable = FX_Alloc(FX_BYTE, iPalette * 3); | 165 FX_LPBYTE pColorTable = FX_Alloc2D(FX_BYTE, iPalette, 3); |
| 166 FX_LPBYTE ptr = pColorTable; | 166 FX_LPBYTE ptr = pColorTable; |
| 167 for (FX_INT32 i = 0; i < iPalette; i ++) { | 167 for (FX_INT32 i = 0; i < iPalette; i ++) { |
| 168 FX_DWORD argb = pBitmap->GetPaletteArgb(i); | 168 FX_DWORD argb = pBitmap->GetPaletteArgb(i); |
| 169 ptr[0] = (FX_BYTE)(argb >> 16); | 169 ptr[0] = (FX_BYTE)(argb >> 16); |
| 170 ptr[1] = (FX_BYTE)(argb >> 8); | 170 ptr[1] = (FX_BYTE)(argb >> 8); |
| 171 ptr[2] = (FX_BYTE)argb; | 171 ptr[2] = (FX_BYTE)argb; |
| 172 ptr += 3; | 172 ptr += 3; |
| 173 } | 173 } |
| 174 CPDF_Stream *pCTS = CPDF_Stream::Create(pColorTable, iPalette * 3, C
PDF_Dictionary::Create()); | 174 CPDF_Stream *pCTS = CPDF_Stream::Create(pColorTable, iPalette * 3, C
PDF_Dictionary::Create()); |
| 175 m_pDocument->AddIndirectObject(pCTS); | 175 m_pDocument->AddIndirectObject(pCTS); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 m_Width = BitmapWidth; | 365 m_Width = BitmapWidth; |
| 366 m_Height = BitmapHeight; | 366 m_Height = BitmapHeight; |
| 367 if (dest_buf) { | 367 if (dest_buf) { |
| 368 FX_Free(dest_buf); | 368 FX_Free(dest_buf); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) | 371 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) |
| 372 { | 372 { |
| 373 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); | 373 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); |
| 374 } | 374 } |
| OLD | NEW |