Replace CPDF_ImageObject::set_matrix() with SetImageMatrix().

SetImageMatrix() will consistently call CalcBoundingBox() internally.
Then convert set_matrix() callers.

Change-Id: I80366b27797634ab3f61bc360b947378dfa25ff2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82611
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_imageobject.cpp b/core/fpdfapi/page/cpdf_imageobject.cpp
index f256711..79dc912 100644
--- a/core/fpdfapi/page/cpdf_imageobject.cpp
+++ b/core/fpdfapi/page/cpdf_imageobject.cpp
@@ -68,6 +68,11 @@
   return pSource ? pSource->Clone(nullptr) : nullptr;
 }
 
+void CPDF_ImageObject::SetImageMatrix(const CFX_Matrix& matrix) {
+  m_Matrix = matrix;
+  CalcBoundingBox();
+}
+
 void CPDF_ImageObject::MaybePurgeCache() {
   if (!m_pImage)
     return;
diff --git a/core/fpdfapi/page/cpdf_imageobject.h b/core/fpdfapi/page/cpdf_imageobject.h
index f221a98..5e0ee4b 100644
--- a/core/fpdfapi/page/cpdf_imageobject.h
+++ b/core/fpdfapi/page/cpdf_imageobject.h
@@ -32,7 +32,7 @@
   RetainPtr<CPDF_Image> GetImage() const;
   RetainPtr<CFX_DIBitmap> GetIndependentBitmap() const;
 
-  void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
+  void SetImageMatrix(const CFX_Matrix& matrix);
   const CFX_Matrix& matrix() const { return m_Matrix; }
 
  private:
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 42ad56b..0e84cee 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -826,8 +826,7 @@
                    false);
 
   CFX_Matrix ImageMatrix = m_pCurStates->m_CTM * m_mtContentToUser;
-  pImageObj->set_matrix(ImageMatrix);
-  pImageObj->CalcBoundingBox();
+  pImageObj->SetImageMatrix(ImageMatrix);
 
   CPDF_ImageObject* pRet = pImageObj.get();
   m_pObjectHolder->AppendPageObject(std::move(pImageObj));
diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp
index 8419352..98ed127 100644
--- a/fpdfsdk/fpdf_editimg.cpp
+++ b/fpdfsdk/fpdf_editimg.cpp
@@ -168,10 +168,9 @@
   if (!pImgObj)
     return false;
 
-  pImgObj->set_matrix(CFX_Matrix(static_cast<float>(a), static_cast<float>(b),
-                                 static_cast<float>(c), static_cast<float>(d),
-                                 static_cast<float>(e), static_cast<float>(f)));
-  pImgObj->CalcBoundingBox();
+  pImgObj->SetImageMatrix(CFX_Matrix(
+      static_cast<float>(a), static_cast<float>(b), static_cast<float>(c),
+      static_cast<float>(d), static_cast<float>(e), static_cast<float>(f)));
   pImgObj->SetDirty(true);
   return true;
 }