Add SkPDFDeviceFlatenner which extends SkPDFDevice to add support to flatten the path and the text when we have perspective.
prepare to deprecate SkPDFDevice constructor, and route gm and render_pdfs to use SkDocument::Create pdf interface instead. - controlled by a flag
add comments where we are supposed to flatten other features (paint, shaders, ... )

R=reed@google.com, bungeman@google.com, scroggo@google.com, vandebo@chromium.org, bsalomon@google.com

Author: edisonn@google.com

Review URL: https://codereview.chromium.org/24811002

git-svn-id: http://skia.googlecode.com/svn/trunk@11751 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/doc/SkDocument_PDF.cpp b/src/doc/SkDocument_PDF.cpp
index b9b55f8..695929f 100644
--- a/src/doc/SkDocument_PDF.cpp
+++ b/src/doc/SkDocument_PDF.cpp
@@ -6,8 +6,8 @@
  */
 
 #include "SkDocument.h"
-#include "SkPDFDevice.h"
 #include "SkPDFDocument.h"
+#include "SkPDFDeviceFlattener.h"
 
 class SkDocument_PDF : public SkDocument {
 public:
@@ -27,19 +27,14 @@
 
 protected:
     virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height,
-                                  const SkRect& content) SK_OVERRIDE {
+                                  const SkRect& trimBox) SK_OVERRIDE {
         SkASSERT(NULL == fCanvas);
         SkASSERT(NULL == fDevice);
 
-        SkISize pageS, contentS;
-        SkMatrix matrix;
+        SkSize mediaBoxSize;
+        mediaBoxSize.set(width, height);
 
-        pageS.set(SkScalarRoundToInt(width), SkScalarRoundToInt(height));
-        contentS.set(SkScalarRoundToInt(content.width()),
-                     SkScalarRoundToInt(content.height()));
-        matrix.setTranslate(content.fLeft, content.fTop);
-
-        fDevice = SkNEW_ARGS(SkPDFDevice, (pageS, contentS, matrix));
+        fDevice = SkNEW_ARGS(SkPDFDeviceFlattener, (mediaBoxSize, &trimBox));
         if (fEncoder) {
             fDevice->setDCTEncoder(fEncoder);
         }
@@ -78,7 +73,7 @@
 
 private:
     SkPDFDocument*  fDoc;
-    SkPDFDevice* fDevice;
+    SkPDFDeviceFlattener* fDevice;
     SkCanvas*       fCanvas;
     SkPicture::EncodeBitmap fEncoder;
 };