summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-21 10:12:19 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-21 10:12:19 -0800
commit7daa6fb286d1b5d65f99521f3314083e86d93e3f (patch)
tree48113e268f5d2877b844de9d27aa9242100a3379 /core/fpdfapi/page
parentdd17234c42e4572b85b6d74a07bc901974d061be (diff)
downloadpdfium-7daa6fb286d1b5d65f99521f3314083e86d93e3f.tar.xz
Fix CPDFImage::IsInline().
Commit 137a344a changed its behavior. BUG=chromium:667012 Review-Url: https://codereview.chromium.org/2513273003
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp12
-rw-r--r--core/fpdfapi/page/cpdf_image.h8
2 files changed, 9 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 8ded34e630..60ac1c9815 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -7,12 +7,10 @@
#include "core/fpdfapi/page/cpdf_image.h"
#include <algorithm>
-#include <memory>
#include <utility>
#include <vector>
#include "core/fpdfapi/cpdf_modulemgr.h"
-#include "core/fpdfapi/page/cpdf_docpagedata.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_boolean.h"
@@ -31,7 +29,8 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
CPDF_Image::CPDF_Image(CPDF_Document* pDoc,
std::unique_ptr<CPDF_Stream> pStream)
- : m_pDocument(pDoc),
+ : m_bIsInline(true),
+ m_pDocument(pDoc),
m_pStream(pStream.get()),
m_pOwnedStream(std::move(pStream)) {
m_pOwnedDict =
@@ -60,16 +59,15 @@ void CPDF_Image::FinishInitialization() {
CPDF_Image* CPDF_Image::Clone() {
CPDF_Image* pImage = new CPDF_Image(m_pDocument);
+ pImage->m_bIsInline = m_bIsInline;
if (m_pOwnedStream) {
- pImage->m_pOwnedStream =
- ToStream(std::unique_ptr<CPDF_Object>(m_pOwnedStream->Clone()));
+ pImage->m_pOwnedStream = ToStream(m_pOwnedStream->Clone());
pImage->m_pStream = pImage->m_pOwnedStream.get();
} else {
pImage->m_pStream = m_pStream;
}
if (m_pOwnedDict) {
- pImage->m_pOwnedDict =
- ToDictionary(std::unique_ptr<CPDF_Object>(m_pOwnedDict->Clone()));
+ pImage->m_pOwnedDict = ToDictionary(m_pOwnedDict->Clone());
pImage->m_pDict = pImage->m_pOwnedDict.get();
} else {
pImage->m_pDict = m_pDict;
diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h
index a9bcef27ad..848b0e4462 100644
--- a/core/fpdfapi/page/cpdf_image.h
+++ b/core/fpdfapi/page/cpdf_image.h
@@ -7,6 +7,8 @@
#ifndef CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_
#define CORE_FPDFAPI_PAGE_CPDF_IMAGE_H_
+#include <memory>
+
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fxcrt/fx_system.h"
@@ -14,16 +16,13 @@
#define PDF_IMAGE_LOSSY_COMPRESS 0x0001
#define PDF_IMAGE_LOSSLESS_COMPRESS 0x0002
#define PDF_IMAGE_MASK_LOSSY_COMPRESS 0x0004
-#define PDF_IMAGE_MASK_LOSSLESS_COMPRESS 0x0008
class CFX_DIBSource;
class CFX_DIBitmap;
-class CPDF_Dictionay;
class CPDF_Document;
class CPDF_Page;
class IFX_Pause;
class IFX_SeekableReadStream;
-class IFX_SeekableWriteStream;
class CPDF_Image {
public:
@@ -46,7 +45,7 @@ class CPDF_Image {
int32_t GetPixelHeight() const { return m_Height; }
int32_t GetPixelWidth() const { return m_Width; }
- bool IsInline() const { return !!m_pOwnedStream; }
+ bool IsInline() const { return m_bIsInline; }
bool IsMask() const { return m_bIsMask; }
bool IsInterpol() const { return m_bInterpolate; }
@@ -80,6 +79,7 @@ class CPDF_Image {
int32_t m_Height = 0;
int32_t m_Width = 0;
+ bool m_bIsInline = false;
bool m_bIsMask = false;
bool m_bInterpolate = false;
CPDF_Document* const m_pDocument;