| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 FALSE); | 271 FALSE); |
| 272 } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) { | 272 } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) { |
| 273 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); | 273 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); |
| 274 pNewBitmap->Copy(pBitmap); | 274 pNewBitmap->Copy(pBitmap); |
| 275 pNewBitmap->ConvertFormat(FXDIB_Rgb); | 275 pNewBitmap->ConvertFormat(FXDIB_Rgb); |
| 276 SetImage(pNewBitmap, iCompress, pFileWrite, pFileRead); | 276 SetImage(pNewBitmap, iCompress, pFileWrite, pFileRead); |
| 277 if (pDict) { | 277 if (pDict) { |
| 278 pDict->Release(); | 278 pDict->Release(); |
| 279 pDict = NULL; | 279 pDict = NULL; |
| 280 } | 280 } |
| 281 if (dest_buf) { | 281 FX_Free(dest_buf); |
| 282 FX_Free(dest_buf); | 282 dest_buf = NULL; |
| 283 dest_buf = NULL; | |
| 284 } | |
| 285 dest_size = 0; | 283 dest_size = 0; |
| 286 delete pNewBitmap; | 284 delete pNewBitmap; |
| 287 return; | 285 return; |
| 288 } else { | 286 } else { |
| 289 if (bUseMatte) { | 287 if (bUseMatte) { |
| 290 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); | 288 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); |
| 291 pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); | 289 pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); |
| 292 uint8_t* dst_buf = pNewBitmap->GetBuffer(); | 290 uint8_t* dst_buf = pNewBitmap->GetBuffer(); |
| 293 int32_t src_offset = 0; | 291 int32_t src_offset = 0; |
| 294 for (int32_t row = 0; row < BitmapHeight; row++) { | 292 for (int32_t row = 0; row < BitmapHeight; row++) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 371 } |
| 374 if (!bStream) { | 372 if (!bStream) { |
| 375 m_pStream->InitStream(dest_buf, dest_size, pDict); | 373 m_pStream->InitStream(dest_buf, dest_size, pDict); |
| 376 } else { | 374 } else { |
| 377 pFileWrite->Flush(); | 375 pFileWrite->Flush(); |
| 378 m_pStream->InitStream(pFileRead, pDict); | 376 m_pStream->InitStream(pFileRead, pDict); |
| 379 } | 377 } |
| 380 m_bIsMask = pBitmap->IsAlphaMask(); | 378 m_bIsMask = pBitmap->IsAlphaMask(); |
| 381 m_Width = BitmapWidth; | 379 m_Width = BitmapWidth; |
| 382 m_Height = BitmapHeight; | 380 m_Height = BitmapHeight; |
| 383 if (dest_buf) { | 381 FX_Free(dest_buf); |
| 384 FX_Free(dest_buf); | |
| 385 } | |
| 386 } | 382 } |
| 387 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { | 383 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { |
| 388 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); | 384 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); |
| 389 } | 385 } |
| OLD | NEW |