summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-21 14:54:29 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-21 14:54:29 -0800
commit8a5e15d7b16c1c2a99b013fc4f68597cedab4fcf (patch)
treed6cc32fe926152e521248f57c5c51deb8ba5aa73
parentd88090fb780480217af37273e7abb01ae48e322b (diff)
downloadpdfium-8a5e15d7b16c1c2a99b013fc4f68597cedab4fcf.tar.xz
Make CPDF_ImageObject::m_Matrix private.
Review-Url: https://codereview.chromium.org/2514263003
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp8
-rw-r--r--core/fpdfapi/font/cpdf_type3char.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_imageobject.h4
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp2
-rw-r--r--core/fpdfapi/render/fpdf_render_image.cpp5
-rw-r--r--fpdfsdk/fpdfeditimg.cpp10
6 files changed, 15 insertions, 16 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index cabd2c391c..a65d564141 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -19,7 +19,7 @@
namespace {
-CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, CFX_Matrix& matrix) {
+CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, const CFX_Matrix& matrix) {
ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << " "
<< matrix.e << " " << matrix.f;
return ar;
@@ -84,11 +84,11 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf* buf,
CPDF_ImageObject* pImageObj) {
- if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) ||
- (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) {
+ if ((pImageObj->matrix().a == 0 && pImageObj->matrix().b == 0) ||
+ (pImageObj->matrix().c == 0 && pImageObj->matrix().d == 0)) {
return;
}
- *buf << "q " << pImageObj->m_Matrix << " cm ";
+ *buf << "q " << pImageObj->matrix() << " cm ";
CPDF_Image* pImage = pImageObj->GetImage();
if (pImage->IsInline())
diff --git a/core/fpdfapi/font/cpdf_type3char.cpp b/core/fpdfapi/font/cpdf_type3char.cpp
index a4df2cc146..e5b7450a0a 100644
--- a/core/fpdfapi/font/cpdf_type3char.cpp
+++ b/core/fpdfapi/font/cpdf_type3char.cpp
@@ -28,7 +28,7 @@ bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) {
if (!pPageObj->IsImage())
return false;
- m_ImageMatrix = pPageObj->AsImage()->m_Matrix;
+ m_ImageMatrix = pPageObj->AsImage()->matrix();
std::unique_ptr<CFX_DIBSource> pSource(
pPageObj->AsImage()->GetImage()->LoadDIBSource());
if (pSource)
diff --git a/core/fpdfapi/page/cpdf_imageobject.h b/core/fpdfapi/page/cpdf_imageobject.h
index fd99d3d612..2bb1e8233d 100644
--- a/core/fpdfapi/page/cpdf_imageobject.h
+++ b/core/fpdfapi/page/cpdf_imageobject.h
@@ -32,11 +32,13 @@ class CPDF_ImageObject : public CPDF_PageObject {
void SetOwnedImage(std::unique_ptr<CPDF_Image> pImage);
void SetUnownedImage(CPDF_Image* pImage);
- CFX_Matrix m_Matrix;
+ void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
+ const CFX_Matrix& matrix() const { return m_Matrix; }
private:
void Release();
+ CFX_Matrix m_Matrix;
CPDF_Image* m_pImage;
bool m_pImageOwned;
};
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 6ddd278e27..107ab1ccaa 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -848,7 +848,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImageObject(
CFX_Matrix ImageMatrix = m_pCurStates->m_CTM;
ImageMatrix.Concat(m_mtContentToUser);
- pImageObj->m_Matrix = ImageMatrix;
+ pImageObj->set_matrix(ImageMatrix);
pImageObj->CalcBoundingBox();
CPDF_ImageObject* pRet = pImageObj.get();
diff --git a/core/fpdfapi/render/fpdf_render_image.cpp b/core/fpdfapi/render/fpdf_render_image.cpp
index cf5f97bab8..b95828c0cc 100644
--- a/core/fpdfapi/render/fpdf_render_image.cpp
+++ b/core/fpdfapi/render/fpdf_render_image.cpp
@@ -378,11 +378,10 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
!m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
return false;
}
- m_ImageMatrix = m_pImageObject->m_Matrix;
+ m_ImageMatrix = m_pImageObject->matrix();
m_ImageMatrix.Concat(*pObj2Device);
- if (StartLoadDIBSource()) {
+ if (StartLoadDIBSource())
return true;
- }
return StartRenderDIBSource();
}
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index e256f85c0f..acd53d3b07 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -55,12 +55,10 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
return false;
CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
- pImgObj->m_Matrix.a = static_cast<FX_FLOAT>(a);
- pImgObj->m_Matrix.b = static_cast<FX_FLOAT>(b);
- pImgObj->m_Matrix.c = static_cast<FX_FLOAT>(c);
- pImgObj->m_Matrix.d = static_cast<FX_FLOAT>(d);
- pImgObj->m_Matrix.e = static_cast<FX_FLOAT>(e);
- pImgObj->m_Matrix.f = static_cast<FX_FLOAT>(f);
+ pImgObj->set_matrix(
+ CFX_Matrix(static_cast<FX_FLOAT>(a), static_cast<FX_FLOAT>(b),
+ static_cast<FX_FLOAT>(c), static_cast<FX_FLOAT>(d),
+ static_cast<FX_FLOAT>(e), static_cast<FX_FLOAT>(f)));
pImgObj->CalcBoundingBox();
return true;
}