From 97f4d67fbf0707feea298afa2f6471013185e066 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 4 Jun 2018 14:47:17 +0000 Subject: Add FPDFPath_GetMatrix() and FPDFPath_SetMatrix() APIs This is similar to the existing FPDFImageObj_SetMatrix(), but this exposes the matrix of CPDF_PathObject and provides both a getter and a setter. Change-Id: Ib90a64929dae1b2be3889eca57e4af822d7823be Reviewed-on: https://pdfium-review.googlesource.com/33670 Reviewed-by: dsinclair Commit-Queue: dsinclair --- fpdfsdk/fpdf_edit_embeddertest.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp') diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp index f9b165c28d..7ca2174440 100644 --- a/fpdfsdk/fpdf_edit_embeddertest.cpp +++ b/fpdfsdk/fpdf_edit_embeddertest.cpp @@ -248,6 +248,36 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) { EXPECT_EQ(FPDF_FILLMODE_ALTERNATE, fillmode); EXPECT_FALSE(stroke); + double matrix_a = 1; + double matrix_b = 2; + double matrix_c = 3; + double matrix_d = 4; + double matrix_e = 5; + double matrix_f = 6; + EXPECT_FALSE(FPDFPath_SetMatrix(nullptr, matrix_a, matrix_b, matrix_c, + matrix_d, matrix_e, matrix_f)); + EXPECT_TRUE(FPDFPath_SetMatrix(red_rect, matrix_a, matrix_b, matrix_c, + matrix_d, matrix_e, matrix_f)); + EXPECT_FALSE(FPDFPath_GetMatrix(nullptr, &matrix_a, &matrix_b, &matrix_c, + &matrix_d, &matrix_e, &matrix_f)); + EXPECT_TRUE(FPDFPath_GetMatrix(red_rect, &matrix_a, &matrix_b, &matrix_c, + &matrix_d, &matrix_e, &matrix_f)); + EXPECT_EQ(1, static_cast(matrix_a)); + EXPECT_EQ(2, static_cast(matrix_b)); + EXPECT_EQ(3, static_cast(matrix_c)); + EXPECT_EQ(4, static_cast(matrix_d)); + EXPECT_EQ(5, static_cast(matrix_e)); + EXPECT_EQ(6, static_cast(matrix_f)); + // Set back the default + matrix_a = 1; + matrix_b = 0; + matrix_c = 0; + matrix_d = 1; + matrix_e = 0; + matrix_f = 0; + EXPECT_TRUE(FPDFPath_SetMatrix(red_rect, matrix_a, matrix_b, matrix_c, + matrix_d, matrix_e, matrix_f)); + FPDFPage_InsertObject(page, red_rect); { ScopedFPDFBitmap page_bitmap = RenderPageWithFlags(page, nullptr, 0); -- cgit v1.2.3