summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-06-04 14:47:17 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-04 14:47:17 +0000
commit97f4d67fbf0707feea298afa2f6471013185e066 (patch)
tree8591d399806c5d441e646a3f879227574e9217b4 /fpdfsdk/fpdf_edit_embeddertest.cpp
parent714bf7821d2de6249d2779424c47027a981d5032 (diff)
downloadpdfium-97f4d67fbf0707feea298afa2f6471013185e066.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp30
1 files changed, 30 insertions, 0 deletions
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<int>(matrix_a));
+ EXPECT_EQ(2, static_cast<int>(matrix_b));
+ EXPECT_EQ(3, static_cast<int>(matrix_c));
+ EXPECT_EQ(4, static_cast<int>(matrix_d));
+ EXPECT_EQ(5, static_cast<int>(matrix_e));
+ EXPECT_EQ(6, static_cast<int>(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);