Revert "move SkPDFD*.h from include to src"

This reverts commit 693024300f79ff3fb497ddee1043b609ddf521a4.

was breaking canary build

BUG=skia:

Review URL: https://codereview.chromium.org/731173002
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 196f152..62d4e74 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -73,6 +73,13 @@
 
 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message")
 
+DECLARE_bool(useDocumentInsteadOfDevice);
+
+#ifdef SK_SUPPORT_PDF
+    #include "SkPDFDevice.h"
+    #include "SkPDFDocument.h"
+#endif
+
 // Until we resolve http://code.google.com/p/skia/issues/detail?id=455 ,
 // stop writing out XPS-format image baselines in gm.
 #undef SK_SUPPORT_XPS
@@ -652,21 +659,51 @@
 
     static bool generate_pdf(GM* gm, SkDynamicMemoryWStream& pdf) {
 #ifdef SK_SUPPORT_PDF
-        SkAutoTUnref<SkDocument> pdfDoc(
-                SkDocument::CreatePDF(&pdf, NULL, encode_to_dct_data,
-                                      SkIntToScalar(FLAGS_pdfRasterDpi)));
-        if (!pdfDoc) {
-            return false;
+        SkMatrix initialTransform = gm->getInitialTransform();
+        if (FLAGS_useDocumentInsteadOfDevice) {
+            SkISize pageISize = gm->getISize();
+            SkAutoTUnref<SkDocument> pdfDoc(
+                    SkDocument::CreatePDF(&pdf, NULL,
+                                          encode_to_dct_data,
+                                          SkIntToScalar(FLAGS_pdfRasterDpi)));
+
+            if (!pdfDoc.get()) {
+                return false;
+            }
+
+            SkCanvas* canvas = NULL;
+            canvas = pdfDoc->beginPage(SkIntToScalar(pageISize.width()),
+                                       SkIntToScalar(pageISize.height()));
+            canvas->concat(initialTransform);
+
+            invokeGM(gm, canvas, true, false);
+
+            return pdfDoc->close();
+        } else {
+            SkISize pageSize = gm->getISize();
+            SkPDFDevice* dev = NULL;
+            if (initialTransform.isIdentity()) {
+                dev = new SkPDFDevice(pageSize, pageSize, initialTransform);
+            } else {
+                SkRect content = SkRect::MakeWH(SkIntToScalar(pageSize.width()),
+                                                SkIntToScalar(pageSize.height()));
+                initialTransform.mapRect(&content);
+                content.intersect(0, 0, SkIntToScalar(pageSize.width()),
+                                  SkIntToScalar(pageSize.height()));
+                SkISize contentSize =
+                    SkISize::Make(SkScalarRoundToInt(content.width()),
+                                  SkScalarRoundToInt(content.height()));
+                dev = new SkPDFDevice(pageSize, contentSize, initialTransform);
+            }
+            dev->setDCTEncoder(encode_to_dct_data);
+            dev->setRasterDpi(SkIntToScalar(FLAGS_pdfRasterDpi));
+            SkAutoUnref aur(dev);
+            SkCanvas c(dev);
+            invokeGM(gm, &c, true, false);
+            SkPDFDocument doc;
+            doc.appendPage(dev);
+            doc.emitPDF(&pdf);
         }
-
-        SkISize pageISize = gm->getISize();
-        SkCanvas* canvas = pdfDoc->beginPage(SkIntToScalar(pageISize.width()),
-                                             SkIntToScalar(pageISize.height()));
-        canvas->concat(gm->getInitialTransform());
-
-        invokeGM(gm, canvas, true, false);
-
-        return pdfDoc->close();
 #endif  // SK_SUPPORT_PDF
         return true; // Do not report failure if pdf is not supported.
     }
@@ -1468,6 +1505,7 @@
 // Probably define spacial names like centerx, centery, top, bottom, left, right
 // then we can write something reabable like --rotate centerx centery 90
 DEFINE_bool(forcePerspectiveMatrix, false, "Force a perspective matrix.");
+DEFINE_bool(useDocumentInsteadOfDevice, false, "Use SkDocument::CreateFoo instead of SkFooDevice.");
 DEFINE_int32(pdfRasterDpi, 72, "Scale at which at which the non suported "
              "features in PDF are rasterized. Must be be in range 0-10000. "
              "Default is 72. N = 0 will disable rasterizing features like "
diff --git a/gyp/pdf.gyp b/gyp/pdf.gyp
index b253fd8..76b23bb 100644
--- a/gyp/pdf.gyp
+++ b/gyp/pdf.gyp
@@ -14,6 +14,7 @@
         'pdf.gypi',
       ],
       'include_dirs': [
+        '../include/pdf',
         '../src/core', # needed to get SkGlyphCache.h and SkTextFormatParams.h
         '../src/pdf',
         '../src/utils', # needed to get SkBitSet.h
@@ -42,7 +43,7 @@
           'SK_SUPPORT_PDF',
         ],
         'include_dirs': [
-          '../include/core',  # SkDocument.h
+          '../include/pdf',
         ],
       },
     },
diff --git a/gyp/pdf.gypi b/gyp/pdf.gypi
index 3115110..e4cb958 100644
--- a/gyp/pdf.gypi
+++ b/gyp/pdf.gypi
@@ -7,16 +7,17 @@
 #
 {
     'sources': [
+        '<(skia_include_path)/pdf/SkPDFDevice.h',
+        '<(skia_include_path)/pdf/SkPDFDocument.h',
+
         '<(skia_src_path)/doc/SkDocument_PDF.cpp',
 
         '<(skia_src_path)/pdf/SkPDFCatalog.cpp',
         '<(skia_src_path)/pdf/SkPDFCatalog.h',
         '<(skia_src_path)/pdf/SkPDFDevice.cpp',
-        '<(skia_src_path)/pdf/SkPDFDevice.h',
         '<(skia_src_path)/pdf/SkPDFDeviceFlattener.cpp',
         '<(skia_src_path)/pdf/SkPDFDeviceFlattener.h',
         '<(skia_src_path)/pdf/SkPDFDocument.cpp',
-        '<(skia_src_path)/pdf/SkPDFDocument.h',
         '<(skia_src_path)/pdf/SkPDFFont.cpp',
         '<(skia_src_path)/pdf/SkPDFFont.h',
         '<(skia_src_path)/pdf/SkPDFFontImpl.h',
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index fe0137b..23790a6 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -641,6 +641,7 @@
           '<(skia_include_path)/gpu',
           '<(skia_include_path)/images',
           '<(skia_include_path)/pathops',
+          '<(skia_include_path)/pdf',
           '<(skia_include_path)/pipe',
           '<(skia_include_path)/ports',
           '<(skia_include_path)/svg',
diff --git a/src/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
similarity index 100%
rename from src/pdf/SkPDFDevice.h
rename to include/pdf/SkPDFDevice.h
diff --git a/src/pdf/SkPDFDocument.h b/include/pdf/SkPDFDocument.h
similarity index 100%
rename from src/pdf/SkPDFDocument.h
rename to include/pdf/SkPDFDocument.h