diff options
author | Hal Canary <halcanary@google.com> | 2016-12-30 13:09:03 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-03 14:25:12 +0000 |
commit | 43fb7a014b785960e5892cadd0bd30c10328ae8a (patch) | |
tree | 56e8e92beff152ee7c93761ad9540845c5933c6d | |
parent | 34194690328b612557f06ecec99b232d41888d4b (diff) |
BUILD.gn: skia_enable_pdf
BUG=skia:
Change-Id: Icf616bec73e81aad97815b519566ff5b9db611e3
Reviewed-on: https://skia-review.googlesource.com/6495
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | BUILD.gn | 6 | ||||
-rw-r--r-- | bench/PDFBench.cpp | 52 | ||||
-rw-r--r-- | tests/PDFDeflateWStreamTest.cpp | 7 | ||||
-rw-r--r-- | tests/PDFGlyphsToUnicodeTest.cpp | 7 | ||||
-rw-r--r-- | tests/PDFJpegEmbedTest.cpp | 6 | ||||
-rw-r--r-- | tests/PDFPrimitivesTest.cpp | 6 |
6 files changed, 57 insertions, 27 deletions
@@ -28,6 +28,7 @@ declare_args() { skia_enable_android_framework_defines = false skia_enable_discrete_gpu = true skia_enable_gpu = true + skia_enable_pdf = true skia_enable_tools = is_skia_standalone skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug skia_vulkan_sdk = getenv("VULKAN_SDK") @@ -429,7 +430,8 @@ optional("jpeg") { } optional("pdf") { - enabled = skia_use_zlib + enabled = skia_use_zlib && skia_enable_pdf + public_defines = [ "SK_SUPPORT_PDF" ] deps = [ "//third_party/zlib", @@ -439,7 +441,7 @@ optional("pdf") { if (skia_use_sfntly) { deps += [ "//third_party/sfntly" ] - public_defines = [ "SK_PDF_USE_SFNTLY" ] + public_defines += [ "SK_PDF_USE_SFNTLY" ] } } diff --git a/bench/PDFBench.cpp b/bench/PDFBench.cpp index 573353fcab..e0d4934bce 100644 --- a/bench/PDFBench.cpp +++ b/bench/PDFBench.cpp @@ -6,15 +6,12 @@ */ #include "Benchmark.h" + #include "Resources.h" #include "SkAutoPixmapStorage.h" #include "SkData.h" #include "SkGradientShader.h" #include "SkImage.h" -#include "SkPDFBitmap.h" -#include "SkPDFDocument.h" -#include "SkPDFShader.h" -#include "SkPDFUtils.h" #include "SkPixmap.h" #include "SkRandom.h" #include "SkStream.h" @@ -27,6 +24,33 @@ struct NullWStream : public SkWStream { size_t fN; }; +struct WStreamWriteTextBenchmark : public Benchmark { + std::unique_ptr<SkWStream> fWStream; + WStreamWriteTextBenchmark() : fWStream(new NullWStream) {} + const char* onGetName() override { return "WStreamWriteText"; } + bool isSuitableFor(Backend backend) override { + return backend == kNonRendering_Backend; + } + void onDraw(int loops, SkCanvas*) override { + while (loops-- > 0) { + for (int i = 1000; i-- > 0;) { + fWStream->writeText("HELLO SKIA!\n"); + } + } + } +}; +} // namespace + +DEF_BENCH(return new WStreamWriteTextBenchmark;) + +#ifdef SK_SUPPORT_PDF + +#include "SkPDFBitmap.h" +#include "SkPDFDocument.h" +#include "SkPDFShader.h" +#include "SkPDFUtils.h" + +namespace { static void test_pdf_object_serialization(const sk_sp<SkPDFObject> object) { // SkDebugWStream wStream; NullWStream wStream; @@ -207,22 +231,6 @@ struct PDFShaderBench : public Benchmark { } }; -struct WStreamWriteTextBenchmark : public Benchmark { - std::unique_ptr<SkWStream> fWStream; - WStreamWriteTextBenchmark() : fWStream(new NullWStream) {} - const char* onGetName() override { return "WStreamWriteText"; } - bool isSuitableFor(Backend backend) override { - return backend == kNonRendering_Backend; - } - void onDraw(int loops, SkCanvas*) override { - while (loops-- > 0) { - for (int i = 1000; i-- > 0;) { - fWStream->writeText("HELLO SKIA!\n"); - } - } - } -}; - struct WritePDFTextBenchmark : public Benchmark { std::unique_ptr<SkWStream> fWStream; WritePDFTextBenchmark() : fWStream(new NullWStream) {} @@ -249,5 +257,7 @@ DEF_BENCH(return new PDFCompressionBench;) DEF_BENCH(return new PDFScalarBench;) DEF_BENCH(return new PDFColorComponentBench;) DEF_BENCH(return new PDFShaderBench;) -DEF_BENCH(return new WStreamWriteTextBenchmark;) DEF_BENCH(return new WritePDFTextBenchmark;) + +#endif + diff --git a/tests/PDFDeflateWStreamTest.cpp b/tests/PDFDeflateWStreamTest.cpp index 11d237059a..dcb7547495 100644 --- a/tests/PDFDeflateWStreamTest.cpp +++ b/tests/PDFDeflateWStreamTest.cpp @@ -5,9 +5,12 @@ * found in the LICENSE file. */ +#include "Test.h" + +#ifdef SK_SUPPORT_PDF + #include "SkDeflate.h" #include "SkRandom.h" -#include "Test.h" namespace { @@ -162,3 +165,5 @@ DEF_TEST(SkPDF_DeflateWStream, r) { SkDeflateWStream emptyDeflateWStream(nullptr); REPORTER_ASSERT(r, !emptyDeflateWStream.writeText("FOO")); } + +#endif diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp index 0d87cd7df2..332520bfb0 100644 --- a/tests/PDFGlyphsToUnicodeTest.cpp +++ b/tests/PDFGlyphsToUnicodeTest.cpp @@ -5,11 +5,14 @@ * found in the LICENSE file. */ +#include "Test.h" + +#ifdef SK_SUPPORT_PDF + #include "SkBitSet.h" #include "SkData.h" #include "SkPDFMakeToUnicodeCmap.h" #include "SkStream.h" -#include "Test.h" static const int kMaximumGlyphCount = SK_MaxU16 + 1; @@ -178,3 +181,5 @@ endbfrange\n"; REPORTER_ASSERT(reporter, stream_equals(buffer2, 0, expectedResult2, buffer2.bytesWritten())); } + +#endif diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp index 17dbac8cfa..100c9b3f11 100644 --- a/tests/PDFJpegEmbedTest.cpp +++ b/tests/PDFJpegEmbedTest.cpp @@ -9,7 +9,6 @@ #include "SkData.h" #include "SkDocument.h" #include "SkImageGenerator.h" -#include "SkJpegInfo.h" #include "SkStream.h" #include "Resources.h" @@ -80,6 +79,10 @@ DEF_TEST(SkPDF_JpegEmbedTest, r) { REPORTER_ASSERT(r, !is_subset_of(cmykData.get(), pdfData.get())); } +#ifdef SK_SUPPORT_PDF + +#include "SkJpegInfo.h" + DEF_TEST(SkPDF_JpegIdentification, r) { static struct { const char* path; @@ -208,3 +211,4 @@ DEF_TEST(SkPDF_JpegIdentification, r) { REPORTER_ASSERT(r, !SkIsJFIF(data.get(), &info)); } } +#endif diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp index 81b33ba3b7..de9af07d2f 100644 --- a/tests/PDFPrimitivesTest.cpp +++ b/tests/PDFPrimitivesTest.cpp @@ -5,6 +5,10 @@ * found in the LICENSE file. */ +#include "Test.h" + +#ifdef SK_SUPPORT_PDF + #include "Resources.h" #include "SkBitmap.h" #include "SkCanvas.h" @@ -24,7 +28,6 @@ #include "SkSpecialImage.h" #include "SkStream.h" #include "SkTypes.h" -#include "Test.h" #include "sk_tool_utils.h" #include <cstdlib> @@ -486,3 +489,4 @@ DEF_TEST(SkPDF_Primitives_Color, reporter) { REPORTER_ASSERT(reporter, roundTrip == i); } } +#endif |