Initial draft code to run pdfviewer withg gms
draft cl to run pdfviewer with gms modified: gm/gmmain.cpp modified: gyp/gm.gyp modified: src/utils/SkPDFRasterizer.cpp modified: src/utils/SkPDFRasterizer.h
R=scroggo@google.com, borenet@google.com
Author: edisonn@google.com
Review URL: https://codereview.chromium.org/26269002
git-svn-id: http://skia.googlecode.com/svn/trunk@12214 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 2a7db03..d1ab966 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1321,6 +1321,9 @@
#ifdef SK_BUILD_POPPLER
{ &SkPopplerRasterizePDF, "poppler", true },
#endif
+#ifdef SK_BUILD_NATIVE_PDF_RENDERER
+ { &SkNativeRasterizePDF, "native", true },
+#endif // SK_BUILD_NATIVE_PDF_RENDERER
};
static const char kDefaultsConfigStr[] = "defaults";
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index e3bd0d8..23aaff9 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -156,6 +156,7 @@
'skia_static_initializers%': '<(skia_static_initializers)',
'ios_sdk_version%': '6.0',
'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
+ 'skia_run_pdfviewer_in_gm%': 0,
# These are referenced by our .gypi files that list files (e.g. core.gypi)
#
diff --git a/gyp/gm.gyp b/gyp/gm.gyp
index e412efe..b430da1 100644
--- a/gyp/gm.gyp
+++ b/gyp/gm.gyp
@@ -33,6 +33,7 @@
'../src/pipe/utils/',
'../src/utils/',
'../src/utils/debugger',
+ '../experimental/PdfViewer',
],
'includes': [
'gmslides.gypi',
@@ -58,8 +59,14 @@
'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',
+ ],
+ }],
['skia_os in ["linux", "mac", "win"]', {
'dependencies': [
'poppler.gyp:libpoppler-cpp-gpl',
diff --git a/src/utils/SkPDFRasterizer.cpp b/src/utils/SkPDFRasterizer.cpp
index a3b4cb4..267c803 100644
--- a/src/utils/SkPDFRasterizer.cpp
+++ b/src/utils/SkPDFRasterizer.cpp
@@ -18,6 +18,7 @@
#include "SkPDFRasterizer.h"
#include "SkColorPriv.h"
+#include "SkPdfRenderer.h"
bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) {
size_t size = pdf->getLength();
@@ -71,3 +72,7 @@
return true;
}
+
+bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) {
+ return SkPDFNativeRenderToBitmap(pdf, output);
+}
diff --git a/src/utils/SkPDFRasterizer.h b/src/utils/SkPDFRasterizer.h
index 4a4083c..2f2bd02 100644
--- a/src/utils/SkPDFRasterizer.h
+++ b/src/utils/SkPDFRasterizer.h
@@ -11,5 +11,6 @@
#include "SkStream.h"
bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output);
+bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output);
#endif