summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-05-26 17:37:06 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-26 21:52:04 +0000
commit207b7277775a2194494352b154109bfa13dd5032 (patch)
treefe7cb616383efe1e0826bea3ac039876d73040b2 /fpdfsdk
parent56e5e67fd2ac582dcfa83821c815a0014a43bd10 (diff)
downloadpdfium-207b7277775a2194494352b154109bfa13dd5032.tar.xz
Eliminate unneeded calls to FPDFPage_GenerateContentchromium/3115chromium/3114
The generating method is not needed for just inserting and rendering. Its purpose seems to be for usage when an already inserted image has been modified or when a copy of the PDF will be saved. Change-Id: I72250b3ba8c53b75249b4ef9ca1bef2d1231288d Reviewed-on: https://pdfium-review.googlesource.com/6091 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfedit_embeddertest.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index b10dacfc98..6045618411 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -256,7 +256,6 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_SetFillColor(red_rect, 255, 0, 0, 255));
EXPECT_TRUE(FPDFPath_SetDrawMode(red_rect, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, red_rect);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDF_BITMAP page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "66d02eaa6181e2c069ce2ea99beda497");
FPDFBitmap_Destroy(page_bitmap);
@@ -281,7 +280,6 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_SetDrawMode(green_rect, FPDF_FILLMODE_WINDING, 0));
FPDFPage_InsertObject(page, green_rect);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "7b0b87604594e773add528fae567a558");
FPDFBitmap_Destroy(page_bitmap);
@@ -294,7 +292,6 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_LineTo(black_path, 300, 100));
EXPECT_TRUE(FPDFPath_Close(black_path));
FPDFPage_InsertObject(page, black_path);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "eadc8020a14dfcf091da2688733d8806");
FPDFBitmap_Destroy(page_bitmap);
@@ -310,12 +307,12 @@ TEST_F(FPDFEditEmbeddertest, AddPaths) {
EXPECT_TRUE(FPDFPath_BezierTo(blue_path, 375, 330, 390, 360, 400, 400));
EXPECT_TRUE(FPDFPath_Close(blue_path));
FPDFPage_InsertObject(page, blue_path);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "9823e1a21bd9b72b6a442ba4f12af946");
FPDFBitmap_Destroy(page_bitmap);
// Now save the result, closing the page and document
+ EXPECT_TRUE(FPDFPage_GenerateContent(page));
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
FPDF_ClosePage(page);
std::string new_file = GetString();
@@ -349,7 +346,6 @@ TEST_F(FPDFEditEmbeddertest, PathOnTopOfText) {
EXPECT_TRUE(FPDFPath_SetFillColor(red_rect, 255, 0, 0, 255));
EXPECT_TRUE(FPDFPath_SetDrawMode(red_rect, FPDF_FILLMODE_ALTERNATE, 0));
FPDFPage_InsertObject(page, red_rect);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
// Add a transparent triangle on top of other part of the text.
FPDF_PAGEOBJECT black_path = FPDFPageObj_CreateNewPath(20, 50);
@@ -359,7 +355,6 @@ TEST_F(FPDFEditEmbeddertest, PathOnTopOfText) {
EXPECT_TRUE(FPDFPath_LineTo(black_path, 40, 10));
EXPECT_TRUE(FPDFPath_Close(black_path));
FPDFPage_InsertObject(page, black_path);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
// Render and check the result. Text is slightly different on Mac.
FPDF_BITMAP bitmap = RenderPage(page);
@@ -384,7 +379,6 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetStrokeWidth(rect, 15.0f));
EXPECT_TRUE(FPDFPath_SetDrawMode(rect, 0, 1));
FPDFPage_InsertObject(page, rect);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDF_BITMAP page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "64bd31f862a89e0a9e505a5af6efd506");
FPDFBitmap_Destroy(page_bitmap);
@@ -399,7 +393,6 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetStrokeWidth(check, 8.35f));
EXPECT_TRUE(FPDFPath_SetDrawMode(check, 0, 1));
FPDFPage_InsertObject(page, check);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "4b6f3b9d25c4e194821217d5016c3724");
FPDFBitmap_Destroy(page_bitmap);
@@ -415,7 +408,6 @@ TEST_F(FPDFEditEmbeddertest, AddStrokedPaths) {
EXPECT_TRUE(FPDFPath_SetStrokeWidth(path, 10.5f));
EXPECT_TRUE(FPDFPath_SetDrawMode(path, FPDF_FILLMODE_ALTERNATE, 1));
FPDFPage_InsertObject(page, path);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
CompareBitmap(page_bitmap, 612, 792, "ff3e6a22326754944cc6e56609acd73b");
FPDFBitmap_Destroy(page_bitmap);
@@ -435,7 +427,6 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object1, text1.get()));
FPDFPageObj_Transform(text_object1, 1, 0, 0, 1, 20, 20);
FPDFPage_InsertObject(page, text_object1);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDF_BITMAP page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5[] = "a4dddc1a3930fa694bbff9789dab4161";
@@ -454,7 +445,6 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object2, text2.get()));
FPDFPageObj_Transform(text_object2, 1, 0, 0, 1, 100, 600);
FPDFPage_InsertObject(page, text_object2);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5_2[] = "a5c4ace4c6f27644094813fe1441a21c";
@@ -475,7 +465,6 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object3, text3.get()));
FPDFPageObj_Transform(text_object3, 1, 1.5, 2, 0.5, 200, 200);
FPDFPage_InsertObject(page, text_object3);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5_3[] = "40b3ef04f915ff4c4208948001763544";
@@ -725,7 +714,6 @@ TEST_F(FPDFEditEmbeddertest, AddTrueTypeFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object, text.get()));
FPDFPageObj_Transform(text_object, 1, 0, 0, 1, 400, 400);
FPDFPage_InsertObject(page, text_object);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
FPDF_BITMAP page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";
@@ -743,7 +731,6 @@ TEST_F(FPDFEditEmbeddertest, AddTrueTypeFontText) {
EXPECT_TRUE(FPDFText_SetText(text_object2, text2.get()));
FPDFPageObj_Transform(text_object2, 1, 0, 0, 1, 200, 200);
FPDFPage_InsertObject(page, text_object2);
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
}
FPDF_BITMAP page_bitmap2 = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -754,6 +741,7 @@ TEST_F(FPDFEditEmbeddertest, AddTrueTypeFontText) {
CompareBitmap(page_bitmap2, 612, 792, md5_2);
FPDFBitmap_Destroy(page_bitmap2);
+ EXPECT_TRUE(FPDFPage_GenerateContent(page));
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
FPDF_ClosePage(page);
std::string new_file = GetString();
@@ -819,14 +807,14 @@ TEST_F(FPDFEditEmbeddertest, AddCIDFontText) {
FPDFPage_InsertObject(page, text_object2);
}
- // Generate contents and check that the text renders properly.
- EXPECT_TRUE(FPDFPage_GenerateContent(page));
+ // Check that the text renders properly.
FPDF_BITMAP page_bitmap = RenderPage(page);
const char md5[] = "2bc6c1aaa2252e73246a75775ccf38c2";
CompareBitmap(page_bitmap, 612, 792, md5);
FPDFBitmap_Destroy(page_bitmap);
// Save the document, close the page.
+ EXPECT_TRUE(FPDFPage_GenerateContent(page));
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
FPDF_ClosePage(page);
std::string new_file = GetString();