Make CPDF_ImageObject::m_Matrix private.

Review-Url: https://codereview.chromium.org/2514263003
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index cabd2c3..a65d564 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 @@
 
 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 a4df2cc..e5b7450 100644
--- a/core/fpdfapi/font/cpdf_type3char.cpp
+++ b/core/fpdfapi/font/cpdf_type3char.cpp
@@ -28,7 +28,7 @@
   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 fd99d3d..2bb1e82 100644
--- a/core/fpdfapi/page/cpdf_imageobject.h
+++ b/core/fpdfapi/page/cpdf_imageobject.h
@@ -32,11 +32,13 @@
   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 6ddd278..107ab1c 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -848,7 +848,7 @@
 
   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 cf5f97b..b95828c 100644
--- a/core/fpdfapi/render/fpdf_render_image.cpp
+++ b/core/fpdfapi/render/fpdf_render_image.cpp
@@ -378,11 +378,10 @@
       !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 e256f85..acd53d3 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -55,12 +55,10 @@
     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;
 }