Better encapsulate CPDF_Image
Bug: pdfium:1680
Change-Id: Ibc74dc2eb3ea99418a573baab34274f5769c4a71
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79892
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h
index 36e9954..2503a81 100644
--- a/core/fpdfapi/page/cpdf_image.h
+++ b/core/fpdfapi/page/cpdf_image.h
@@ -37,7 +37,7 @@
int32_t GetPixelHeight() const { return m_Height; }
int32_t GetPixelWidth() const { return m_Width; }
-
+ uint32_t GetMatteColor() const { return m_MatteColor; }
bool IsInline() const { return m_bIsInline; }
bool IsMask() const { return m_bIsMask; }
bool IsInterpol() const { return m_bInterpolate; }
@@ -63,10 +63,6 @@
RetainPtr<CFX_DIBBase> DetachBitmap();
RetainPtr<CFX_DIBBase> DetachMask();
- RetainPtr<CFX_DIBBase> m_pDIBBase;
- RetainPtr<CFX_DIBBase> m_pMask;
- uint32_t m_MatteColor = 0;
-
private:
explicit CPDF_Image(CPDF_Document* pDoc);
CPDF_Image(CPDF_Document* pDoc, RetainPtr<CPDF_Stream> pStream);
@@ -75,15 +71,17 @@
void FinishInitialization(CPDF_Dictionary* pStreamDict);
RetainPtr<CPDF_Dictionary> InitJPEG(pdfium::span<uint8_t> src_span);
-
RetainPtr<CPDF_Dictionary> CreateXObjectImageDict(int width, int height);
int32_t m_Height = 0;
int32_t m_Width = 0;
+ uint32_t m_MatteColor = 0;
bool m_bIsInline = false;
bool m_bIsMask = false;
bool m_bInterpolate = false;
UnownedPtr<CPDF_Document> const m_pDocument;
+ RetainPtr<CFX_DIBBase> m_pDIBBase;
+ RetainPtr<CFX_DIBBase> m_pMask;
RetainPtr<CPDF_Stream> m_pStream;
RetainPtr<const CPDF_Dictionary> m_pOC;
};
diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp
index 710bfa3..f409c93 100644
--- a/core/fpdfapi/render/cpdf_imageloader.cpp
+++ b/core/fpdfapi/render/cpdf_imageloader.cpp
@@ -74,5 +74,5 @@
m_bCached = false;
m_pBitmap = pImage->DetachBitmap();
m_pMask = pImage->DetachMask();
- m_MatteColor = pImage->m_MatteColor;
+ m_MatteColor = pImage->GetMatteColor();
}