[go: nahoru, domu]

Move metafile printing code from platform canvas to PaintCanvas

These functions operate on PaintCanvas and so move them to cc so that
they can continue to work when PaintCanvas is not an SkCanvas.

Additionally, remove skia::GetMetaData which only served to const cast a
pointer that was never const in the first place.  As the underlying
SkCanvas::getMetaData isn't const, this unconstifies the call chains.

BUG=671433
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2686033005
Cr-Commit-Position: refs/heads/master@{#451073}
diff --git a/cc/paint/paint_canvas.h b/cc/paint/paint_canvas.h
index 6df3443..649096cf 100644
--- a/cc/paint/paint_canvas.h
+++ b/cc/paint/paint_canvas.h
@@ -5,6 +5,7 @@
 #ifndef CC_PAINT_PAINT_CANVAS_H_
 #define CC_PAINT_PAINT_CANVAS_H_
 
+#include "build/build_config.h"
 #include "cc/paint/paint_export.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/utils/SkNWayCanvas.h"
@@ -23,9 +24,18 @@
   ~PaintCanvasPassThrough() override;
 };
 
+// TODO(enne): Move all these functions into PaintCanvas.
+
 // PaintCanvas equivalent of skia::GetWritablePixels.
 CC_PAINT_EXPORT bool ToPixmap(PaintCanvas* canvas, SkPixmap* output);
 
+// Following routines are used in print preview workflow to mark the
+// preview metafile.
+#if defined(OS_MACOSX)
+CC_PAINT_EXPORT void SetIsPreviewMetafile(PaintCanvas* canvas, bool is_preview);
+CC_PAINT_EXPORT bool IsPreviewMetafile(PaintCanvas* canvas);
+#endif
+
 }  // namespace cc
 
 #endif  // CC_PAINT_PAINT_CANVAS_H_