pdfviewer: compile pdfviewer in gm, only if the flag is set (currently we compile pdfviewer, even if it is not used)
R=scroggo@google.com, jvanverth@google.com
Author: edisonn@google.com
Review URL: https://codereview.chromium.org/68533003
git-svn-id: http://skia.googlecode.com/svn/trunk@12249 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index b430da1..504b11e 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -33,7 +33,6 @@
'../src/pipe/utils/',
'../src/utils/',
'../src/utils/debugger',
- '../experimental/PdfViewer',
],
'includes': [
'gmslides.gypi',
@@ -59,13 +58,18 @@
'gm.gyp:gm_expectations',
'jsoncpp.gyp:jsoncpp',
'pdf.gyp:pdf',
- 'pdfviewer_lib.gyp:pdfviewer_lib',
],
'conditions': [
['skia_run_pdfviewer_in_gm', {
'defines': [
'SK_BUILD_NATIVE_PDF_RENDERER',
],
+ 'include_dirs' : [
+ '../experimental/PdfViewer',
+ ],
+ 'dependencies': [
+ 'pdfviewer_lib.gyp:pdfviewer_lib',
+ ],
}],
['skia_os in ["linux", "mac", "win"]', {
'dependencies': [
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index 1725910..2133d2b 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -214,6 +214,11 @@
'../src/utils/android/ashmem.cpp',
],
}],
+ ['skia_run_pdfviewer_in_gm', {
+ 'defines': [
+ 'SK_BUILD_NATIVE_PDF_RENDERER',
+ ],
+ }],
],
'direct_dependent_settings': {
'include_dirs': [
diff --git a/src/utils/SkPDFRasterizer.cpp b/src/utils/SkPDFRasterizer.cpp
index 267c803..89ac401 100644
--- a/src/utils/SkPDFRasterizer.cpp
+++ b/src/utils/SkPDFRasterizer.cpp
@@ -18,7 +18,9 @@
#include "SkPDFRasterizer.h"
#include "SkColorPriv.h"
+#ifdef SK_BUILD_NATIVE_PDF_RENDERER
#include "SkPdfRenderer.h"
+#endif // SK_BUILD_NATIVE_PDF_RENDERER
bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) {
size_t size = pdf->getLength();
@@ -73,6 +75,8 @@
return true;
}
+#ifdef SK_BUILD_NATIVE_PDF_RENDERER
bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) {
return SkPDFNativeRenderToBitmap(pdf, output);
}
+#endif // SK_BUILD_NATIVE_PDF_RENDERER
diff --git a/src/utils/SkPDFRasterizer.h b/src/utils/SkPDFRasterizer.h
index 2f2bd02..ebc9fa6 100644
--- a/src/utils/SkPDFRasterizer.h
+++ b/src/utils/SkPDFRasterizer.h
@@ -11,6 +11,9 @@
#include "SkStream.h"
bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output);
+
+#ifdef SK_BUILD_NATIVE_PDF_RENDERER
bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output);
+#endif // SK_BUILD_NATIVE_PDF_RENDERER
#endif