diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-04-25 18:49:32 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-25 18:49:32 +0000 |
commit | e08d2b1fee0db40bac9538ca8b7be0a951675bd6 (patch) | |
tree | 81ded468a54adb247f46d7824632f6c4a537619c /core/fpdfapi/render | |
parent | eb3ec8f29846a5df67269a53ca94d1d740c84513 (diff) | |
download | pdfium-e08d2b1fee0db40bac9538ca8b7be0a951675bd6.tar.xz |
Introduce ScopedFPDF types in public/cpp/fpdf_scopers.h
Applies std::remove_ptr to the public API types so that we can
deduce a correct unique ptr type no matter how that API might
change away from void* usage.
Creates shorter names for std::unique_ptr<std::remove_pointer<>, ...>
Change-Id: I04a0ff43cb7d5a4d3867939a53a54c9cef00db86
Reviewed-on: https://pdfium-review.googlesource.com/31292
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/fpdf_render_loadimage_embeddertest.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_pattern_embeddertest.cpp | 3 |
2 files changed, 6 insertions, 4 deletions
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); } |