| Index: core/fpdfapi/fpdf_page/cpdf_image.cpp
|
| diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp
|
| index 63e006fc06054935d2762479897fe97d1faa918e..04883dc37156bb8ec8bb60766f27de7d9f476bc7 100644
|
| --- a/core/fpdfapi/fpdf_page/cpdf_image.cpp
|
| +++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp
|
| @@ -6,6 +6,8 @@
|
|
|
| #include "core/fpdfapi/fpdf_page/include/cpdf_image.h"
|
|
|
| +#include <memory>
|
| +
|
| #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
|
| #include "core/fpdfapi/fpdf_page/pageint.h"
|
| #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h"
|
| @@ -23,8 +25,12 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc)
|
| m_pMask(nullptr),
|
| m_MatteColor(0),
|
| m_pStream(nullptr),
|
| - m_bInline(FALSE),
|
| + m_bInline(false),
|
| m_pInlineDict(nullptr),
|
| + m_Height(0),
|
| + m_Width(0),
|
| + m_bIsMask(false),
|
| + m_bInterpolate(false),
|
| m_pDocument(pDoc),
|
| m_pOC(nullptr) {}
|
|
|
| @@ -37,8 +43,12 @@ CPDF_Image::~CPDF_Image() {
|
| }
|
| }
|
|
|
| +bool CPDF_Image::CanRelease() const {
|
| + return m_bInline || (m_pStream && m_pStream->GetObjNum() == 0);
|
| +}
|
| +
|
| void CPDF_Image::Release() {
|
| - if (m_bInline || (m_pStream && m_pStream->GetObjNum() == 0))
|
| + if (CanRelease())
|
| delete this;
|
| }
|
|
|
| @@ -54,7 +64,7 @@ CPDF_Image* CPDF_Image::Clone() {
|
| return pImage;
|
| }
|
|
|
| -FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) {
|
| +void CPDF_Image::LoadImageF(CPDF_Stream* pStream, bool bInline) {
|
| m_pStream = pStream;
|
| if (m_bInline && m_pInlineDict) {
|
| m_pInlineDict->Release();
|
| @@ -62,16 +72,15 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) {
|
| }
|
| m_bInline = bInline;
|
| CPDF_Dictionary* pDict = pStream->GetDict();
|
| - if (m_bInline) {
|
| + if (m_bInline)
|
| m_pInlineDict = ToDictionary(pDict->Clone());
|
| - }
|
| +
|
| m_pOC = pDict->GetDictBy("OC");
|
| m_bIsMask =
|
| !pDict->KeyExist("ColorSpace") || pDict->GetIntegerBy("ImageMask");
|
| m_bInterpolate = pDict->GetIntegerBy("Interpolate");
|
| m_Height = pDict->GetIntegerBy("Height");
|
| m_Width = pDict->GetIntegerBy("Width");
|
| - return TRUE;
|
| }
|
|
|
| CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
|
|
|