diff options
Diffstat (limited to 'core/fpdfapi')
6 files changed, 16 insertions, 11 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp index 86cd67b121..1913c4ba19 100644 --- a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp +++ b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp @@ -7,6 +7,7 @@ #include <vector> #include "core/fxcrt/fx_system.h" +#include "public/cpp/fpdf_scopers.h" #include "public/fpdf_annot.h" #include "public/fpdf_edit.h" #include "public/fpdfview.h" @@ -27,8 +28,7 @@ TEST_F(CPDF_CreatorEmbedderTest, SavedDocsAreEqualAfterParse) { ASSERT_GE(1, FPDF_GetPageCount(document())); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = - RenderLoadedPageWithFlags(page, FPDF_ANNOT); + ScopedFPDFBitmap 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/page/cpdf_stitchfunc_embeddertest.cpp b/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp index ebc71926a0..9b3b18d425 100644 --- a/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp +++ b/core/fpdfapi/page/cpdf_stitchfunc_embeddertest.cpp @@ -4,6 +4,7 @@ #include <memory> +#include "public/cpp/fpdf_scopers.h" #include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -16,7 +17,7 @@ TEST_F(FPDFPageFuncEmbeddertest, Bug_551460) { EXPECT_TRUE(OpenDocument("bug_551460.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3"); UnloadPage(page); } diff --git a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp index 4937b3d8d1..95f1dd4977 100644 --- a/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp +++ b/core/fpdfapi/parser/cpdf_security_handler_embeddertest.cpp @@ -6,6 +6,7 @@ #include <string> #include "core/fxcrt/fx_system.h" +#include "public/cpp/fpdf_scopers.h" #include "public/fpdf_edit.h" #include "public/fpdf_save.h" #include "public/fpdfview.h" @@ -61,7 +62,7 @@ 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); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 612, 792, md5); EXPECT_TRUE(FPDFPage_GenerateContent(page)); SetWholeFileAvailable(); diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp index 0a7dde9b05..7054db99d7 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp @@ -7,6 +7,7 @@ #include <string> #include "core/fpdfapi/parser/fpdf_parser_decode.h" +#include "public/cpp/fpdf_scopers.h" #include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" @@ -94,7 +95,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_552046) { EXPECT_TRUE(OpenDocument("bug_552046.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3"); UnloadPage(page); } @@ -105,7 +106,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_555784) { EXPECT_TRUE(OpenDocument("bug_555784.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3"); UnloadPage(page); } @@ -116,7 +117,7 @@ TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) { EXPECT_TRUE(OpenDocument("bug_455199.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ const char kExpectedMd5sum[] = "b90475ca64d1348c3bf5e2b77ad9187a"; #elif _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ diff --git a/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp b/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp index 588b974e29..48d7ea3399 100644 --- a/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp +++ b/core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp @@ -4,6 +4,7 @@ #include <memory> +#include "public/cpp/fpdf_scopers.h" #include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -15,7 +16,7 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_554151) { EXPECT_TRUE(OpenDocument("bug_554151.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 612, 792, "a14d7ee573c1b2456d7bf6b7762823cf"); UnloadPage(page); } @@ -25,7 +26,7 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_557223) { EXPECT_TRUE(OpenDocument("bug_557223.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 24, 24, "dc0ea1b743c2edb22c597cadc8537f7b"); UnloadPage(page); } @@ -35,7 +36,7 @@ TEST_F(FPDFRenderLoadImageEmbeddertest, Bug_603518) { EXPECT_TRUE(OpenDocument("bug_603518.pdf")); FPDF_PAGE page = LoadPage(0); EXPECT_NE(nullptr, page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 749, 749, "b9e75190cdc5edf0069a408744ca07dc"); UnloadPage(page); } diff --git a/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp b/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp index 00b0933b71..31ce246365 100644 --- a/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp +++ b/core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp @@ -4,6 +4,7 @@ #include <memory> +#include "public/cpp/fpdf_scopers.h" #include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,7 +15,7 @@ TEST_F(FPDFRenderPatternEmbeddertest, LoadError_547706) { EXPECT_TRUE(OpenDocument("bug_547706.pdf")); FPDF_PAGE page = LoadPage(0); ASSERT_TRUE(page); - std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ScopedFPDFBitmap bitmap = RenderLoadedPage(page); CompareBitmap(bitmap.get(), 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3"); UnloadPage(page); } |