OLD | NEW |
---|---|
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfapi/fpdf_page/cpdf_image.h" | 7 #include "core/fpdfapi/fpdf_page/cpdf_image.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 m_pOC = pDict->GetDictFor("OC"); | 48 m_pOC = pDict->GetDictFor("OC"); |
49 m_bIsMask = | 49 m_bIsMask = |
50 !pDict->KeyExist("ColorSpace") || pDict->GetIntegerFor("ImageMask"); | 50 !pDict->KeyExist("ColorSpace") || pDict->GetIntegerFor("ImageMask"); |
51 m_bInterpolate = !!pDict->GetIntegerFor("Interpolate"); | 51 m_bInterpolate = !!pDict->GetIntegerFor("Interpolate"); |
52 m_Height = pDict->GetIntegerFor("Height"); | 52 m_Height = pDict->GetIntegerFor("Height"); |
53 m_Width = pDict->GetIntegerFor("Width"); | 53 m_Width = pDict->GetIntegerFor("Width"); |
54 } | 54 } |
55 | 55 |
56 CPDF_Image::~CPDF_Image() { | 56 CPDF_Image::~CPDF_Image() { |
57 if (m_bInline) { | 57 if (m_bInline) { |
58 if (m_pStream) | 58 delete m_pStream; |
59 m_pStream->Release(); | 59 delete m_pInlineDict; |
60 if (m_pInlineDict) | |
61 m_pInlineDict->Release(); | |
62 } | 60 } |
63 } | 61 } |
64 | 62 |
65 CPDF_Image* CPDF_Image::Clone() { | 63 CPDF_Image* CPDF_Image::Clone() { |
66 if (m_pStream->GetObjNum()) | 64 if (m_pStream->GetObjNum()) |
67 return m_pDocument->GetPageData()->GetImage(m_pStream); | 65 return m_pDocument->GetPageData()->GetImage(m_pStream); |
68 | 66 |
69 CPDF_Image* pImage = | 67 CPDF_Image* pImage = |
70 new CPDF_Image(m_pDocument, ToStream(m_pStream->Clone()), m_bInline); | 68 new CPDF_Image(m_pDocument, ToStream(m_pStream->Clone()), m_bInline); |
71 if (m_bInline) | 69 if (m_bInline) |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 } | 279 } |
282 if (opType == 0) { | 280 if (opType == 0) { |
283 if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) { | 281 if (iCompress & PDF_IMAGE_LOSSLESS_COMPRESS) { |
284 } else { | 282 } else { |
285 if (pBitmap->GetBPP() == 1) { | 283 if (pBitmap->GetBPP() == 1) { |
286 } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette()) { | 284 } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette()) { |
287 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); | 285 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap(); |
288 pNewBitmap->Copy(pBitmap); | 286 pNewBitmap->Copy(pBitmap); |
289 pNewBitmap->ConvertFormat(FXDIB_Rgb); | 287 pNewBitmap->ConvertFormat(FXDIB_Rgb); |
290 SetImage(pNewBitmap, iCompress); | 288 SetImage(pNewBitmap, iCompress); |
291 if (pDict) { | 289 if (pDict) { |
Lei Zhang
2016/10/03 21:50:47
no if?
Tom Sepez
2016/10/05 21:03:02
Done.
| |
292 pDict->Release(); | 290 delete pDict; |
293 pDict = nullptr; | 291 pDict = nullptr; |
294 } | 292 } |
295 FX_Free(dest_buf); | 293 FX_Free(dest_buf); |
296 dest_buf = nullptr; | 294 dest_buf = nullptr; |
297 dest_size = 0; | 295 dest_size = 0; |
298 delete pNewBitmap; | 296 delete pNewBitmap; |
299 return; | 297 return; |
300 } | 298 } |
301 } | 299 } |
302 } else if (opType == 1) { | 300 } else if (opType == 1) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 } | 400 } |
403 if (!ret) { | 401 if (!ret) { |
404 delete m_pDIBSource; | 402 delete m_pDIBSource; |
405 m_pDIBSource = nullptr; | 403 m_pDIBSource = nullptr; |
406 return FALSE; | 404 return FALSE; |
407 } | 405 } |
408 m_pMask = pSource->DetachMask(); | 406 m_pMask = pSource->DetachMask(); |
409 m_MatteColor = pSource->GetMatteColor(); | 407 m_MatteColor = pSource->GetMatteColor(); |
410 return FALSE; | 408 return FALSE; |
411 } | 409 } |
OLD | NEW |