| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (!pMaskBitmap && pMask) { | 211 if (!pMaskBitmap && pMask) { |
| 212 FXDIB_Format maskFormat = pMask->GetFormat(); | 212 FXDIB_Format maskFormat = pMask->GetFormat(); |
| 213 if (maskFormat == FXDIB_1bppMask || maskFormat == FXDIB_8bppMask) { | 213 if (maskFormat == FXDIB_1bppMask || maskFormat == FXDIB_8bppMask) { |
| 214 pMaskBitmap = pMask; | 214 pMaskBitmap = pMask; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 if (pMaskBitmap) { | 217 if (pMaskBitmap) { |
| 218 int32_t maskWidth = pMaskBitmap->GetWidth(); | 218 int32_t maskWidth = pMaskBitmap->GetWidth(); |
| 219 int32_t maskHeight = pMaskBitmap->GetHeight(); | 219 int32_t maskHeight = pMaskBitmap->GetHeight(); |
| 220 uint8_t* mask_buf = NULL; | 220 uint8_t* mask_buf = NULL; |
| 221 FX_STRSIZE mask_size; | 221 FX_STRSIZE mask_size = 0; |
| 222 CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; | 222 CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; |
| 223 pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); | 223 pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); |
| 224 pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); | 224 pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); |
| 225 pMaskDict->SetAtInteger(FX_BSTRC("Width"), maskWidth); | 225 pMaskDict->SetAtInteger(FX_BSTRC("Width"), maskWidth); |
| 226 pMaskDict->SetAtInteger(FX_BSTRC("Height"), maskHeight); | 226 pMaskDict->SetAtInteger(FX_BSTRC("Height"), maskHeight); |
| 227 pMaskDict->SetAtName(FX_BSTRC("ColorSpace"), FX_BSTRC("DeviceGray")); | 227 pMaskDict->SetAtName(FX_BSTRC("ColorSpace"), FX_BSTRC("DeviceGray")); |
| 228 pMaskDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 8); | 228 pMaskDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 8); |
| 229 if (pMaskBitmap->GetBPP() == 8 && | 229 if (pMaskBitmap->GetBPP() == 8 && |
| 230 (iCompress & PDF_IMAGE_MASK_LOSSY_COMPRESS) != 0) { | 230 (iCompress & PDF_IMAGE_MASK_LOSSY_COMPRESS) != 0) { |
| 231 _DCTEncodeBitmap(pMaskDict, pMaskBitmap, pParam ? pParam->nQuality : 75, | 231 _DCTEncodeBitmap(pMaskDict, pMaskBitmap, pParam ? pParam->nQuality : 75, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 m_pStream->InitStream(pFileRead, pDict); | 376 m_pStream->InitStream(pFileRead, pDict); |
| 377 } | 377 } |
| 378 m_bIsMask = pBitmap->IsAlphaMask(); | 378 m_bIsMask = pBitmap->IsAlphaMask(); |
| 379 m_Width = BitmapWidth; | 379 m_Width = BitmapWidth; |
| 380 m_Height = BitmapHeight; | 380 m_Height = BitmapHeight; |
| 381 FX_Free(dest_buf); | 381 FX_Free(dest_buf); |
| 382 } | 382 } |
| 383 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { | 383 void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { |
| 384 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); | 384 pPage->GetRenderCache()->ResetBitmap(m_pStream, pBitmap); |
| 385 } | 385 } |
| OLD | NEW |