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 "core/include/fpdfapi/fpdf_module.h" | 7 #include "core/include/fpdfapi/fpdf_module.h" |
8 #include "core/include/fpdfapi/fpdf_page.h" | 8 #include "core/include/fpdfapi/fpdf_page.h" |
9 #include "core/include/fpdfapi/fpdf_render.h" | 9 #include "core/include/fpdfapi/fpdf_render.h" |
10 #include "core/include/fxcodec/fx_codec.h" | 10 #include "core/include/fxcodec/fx_codec.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 pMatte->AddInteger(b); | 252 pMatte->AddInteger(b); |
253 pMaskDict->SetAt("Matte", pMatte); | 253 pMaskDict->SetAt("Matte", pMatte); |
254 } | 254 } |
255 CPDF_Stream* pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict); | 255 CPDF_Stream* pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict); |
256 m_pDocument->AddIndirectObject(pMaskStream); | 256 m_pDocument->AddIndirectObject(pMaskStream); |
257 pDict->SetAtReference("SMask", m_pDocument, pMaskStream); | 257 pDict->SetAtReference("SMask", m_pDocument, pMaskStream); |
258 if (bDeleteMask) { | 258 if (bDeleteMask) { |
259 delete pMaskBitmap; | 259 delete pMaskBitmap; |
260 } | 260 } |
261 } | 261 } |
262 FX_BOOL bStream = pFileWrite != NULL && pFileRead != NULL; | 262 FX_BOOL bStream = pFileWrite && pFileRead; |
263 if (opType == 0) { | 263 if (opType == 0) { |
264 if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) { | 264 if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) { |
265 if (pBitmap->GetBPP() == 1) { | 265 if (pBitmap->GetBPP() == 1) { |
266 _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, | 266 _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, |
267 TRUE); | 267 TRUE); |
268 } | 268 } |
269 } else { | 269 } else { |
270 if (pBitmap->GetBPP() == 1) { | 270 if (pBitmap->GetBPP() == 1) { |
271 _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, | 271 _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, |
272 FALSE); | 272 FALSE); |
273 } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) { | 273 } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette()) { |
274 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); | 274 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); |
275 pNewBitmap->Copy(pBitmap); | 275 pNewBitmap->Copy(pBitmap); |
276 pNewBitmap->ConvertFormat(FXDIB_Rgb); | 276 pNewBitmap->ConvertFormat(FXDIB_Rgb); |
277 SetImage(pNewBitmap, iCompress, pFileWrite, pFileRead); | 277 SetImage(pNewBitmap, iCompress, pFileWrite, pFileRead); |
278 if (pDict) { | 278 if (pDict) { |
279 pDict->Release(); | 279 pDict->Release(); |
280 pDict = NULL; | 280 pDict = NULL; |
281 } | 281 } |
282 FX_Free(dest_buf); | 282 FX_Free(dest_buf); |
283 dest_buf = NULL; | 283 dest_buf = NULL; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 m_pStream->InitStreamFromFile(pFileRead, pDict); | 377 m_pStream->InitStreamFromFile(pFileRead, pDict); |
378 } | 378 } |
379 m_bIsMask = pBitmap->IsAlphaMask(); | 379 m_bIsMask = pBitmap->IsAlphaMask(); |
380 m_Width = BitmapWidth; | 380 m_Width = BitmapWidth; |
381 m_Height = BitmapHeight; | 381 m_Height = BitmapHeight; |
382 FX_Free(dest_buf); | 382 FX_Free(dest_buf); |
383 } | 383 } |
384 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { | 384 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { |
385 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); | 385 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); |
386 } | 386 } |
OLD | NEW |