Teach FPDFPageObj_SetMatrix() to set the matrix for form objects.
Convert some embedder tests to use the new API capability, instead of
accessing the internal CPDF_FormObject directly.
Change-Id: If5384dca03f9a11304b923afd7a36c4311490fc8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/82613
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/fpdf_ppo_embeddertest.cpp b/fpdfsdk/fpdf_ppo_embeddertest.cpp
index dc5130c..f635996 100644
--- a/fpdfsdk/fpdf_ppo_embeddertest.cpp
+++ b/fpdfsdk/fpdf_ppo_embeddertest.cpp
@@ -249,13 +249,8 @@
ASSERT_TRUE(page_object);
ASSERT_EQ(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(page_object));
- // Access the CPDF_FormObject underneath, as there is no public API to set
- // the matrix for form objects. (yet)
static constexpr FS_MATRIX kMatrix = {0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f};
- CPDF_FormObject* pFormObj =
- CPDFPageObjectFromFPDFPageObject(page_object)->AsForm();
- pFormObj->Transform(CFXMatrixFromFSMatrix(kMatrix));
- pFormObj->SetDirty(true);
+ EXPECT_TRUE(FPDFPageObj_SetMatrix(page_object, &kMatrix));
FPDFPage_InsertObject(page, page_object);
EXPECT_TRUE(FPDFPage_GenerateContent(page));