diff options
author | Lei Zhang <thestig@chromium.org> | 2018-02-07 23:00:07 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-07 23:00:07 +0000 |
commit | 6183a6e7693b7aeb9763eaa130b43269b13a02d7 (patch) | |
tree | 713cb705473751210b1ec89d6a6f365f888f0d5e /core/fpdfapi | |
parent | 9ad9a5fc81a36ab406ff49408dd0814d350bbc7e (diff) | |
download | pdfium-6183a6e7693b7aeb9763eaa130b43269b13a02d7.tar.xz |
Remove some deprecated RenderPage method usage.
Do some additional checks in test cases where pages were rendered but
the resulting bitmap was immediately destroyed.
Change-Id: I2f4678140cdc672ab4ced70f748135464447ff59
Reviewed-on: https://pdfium-review.googlesource.com/25510
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/edit/cpdf_creator_embeddertest.cpp | 9 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp index 7d1fb30595..86cd67b121 100644 --- a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp +++ b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp @@ -25,11 +25,12 @@ TEST_F(CPDF_CreatorEmbedderTest, SavedDocsAreEqualAfterParse) { { // Do some read only operations. ASSERT_GE(1, FPDF_GetPageCount(document())); - FPDF_PAGE page = FPDF_LoadPage(document(), 0); + FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - FPDF_BITMAP new_bitmap = - RenderPageWithFlagsDeprecated(page, form_handle(), FPDF_ANNOT); - FPDFBitmap_Destroy(new_bitmap); + std::unique_ptr<void, FPDFBitmapDeleter> bitmap = + RenderLoadedPageWithFlags(page, FPDF_ANNOT); + EXPECT_EQ(595, FPDFBitmap_GetWidth(bitmap.get())); + EXPECT_EQ(842, FPDFBitmap_GetHeight(bitmap.get())); UnloadPage(page); } diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp index 6c1a0e9ae5..df7b5b6873 100644 --- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp +++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> #include <string> #include "core/fxcrt/fx_system.h" @@ -58,9 +59,8 @@ TEST_F(CPDFSecurityHandlerEmbeddertest, PasswordAfterGenerateSave) { 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); - FPDF_BITMAP page_bitmap = RenderPageDeprecated(page); - CompareBitmap(page_bitmap, 612, 792, md5); - FPDFBitmap_Destroy(page_bitmap); + std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + CompareBitmap(bitmap.get(), 612, 792, md5); EXPECT_TRUE(FPDFPage_GenerateContent(page)); SetWholeFileAvailable(); EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0)); |