Commit 9de71ea9 authored by vitalybuka's avatar vitalybuka Committed by Commit bot

Moved StartPageForVectorCanvas from Metafile to PdfMetafileSkia.

Method is used only for PdfMetafileSkia.

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

Cr-Commit-Position: refs/heads/master@{#302770}
parent 718fc603
...@@ -449,17 +449,6 @@ bool Emf::Record::SafePlayback(Emf::EnumerationContext* context) const { ...@@ -449,17 +449,6 @@ bool Emf::Record::SafePlayback(Emf::EnumerationContext* context) const {
return res; return res;
} }
SkBaseDevice* Emf::StartPageForVectorCanvas(
const gfx::Size& page_size, const gfx::Rect& content_area,
const float& scale_factor) {
if (!StartPage(page_size, content_area, scale_factor))
return NULL;
return skia::VectorPlatformDeviceEmf::CreateDevice(page_size.width(),
page_size.height(),
true, hdc_);
}
bool Emf::StartPage(const gfx::Size& /*page_size*/, bool Emf::StartPage(const gfx::Size& /*page_size*/,
const gfx::Rect& /*content_area*/, const gfx::Rect& /*content_area*/,
const float& /*scale_factor*/) { const float& /*scale_factor*/) {
......
...@@ -58,9 +58,6 @@ class PRINTING_EXPORT Emf : public Metafile { ...@@ -58,9 +58,6 @@ class PRINTING_EXPORT Emf : public Metafile {
virtual bool InitFromData(const void* src_buffer, virtual bool InitFromData(const void* src_buffer,
uint32 src_buffer_size) override; uint32 src_buffer_size) override;
virtual SkBaseDevice* StartPageForVectorCanvas(
const gfx::Size& page_size, const gfx::Rect& content_area,
const float& scale_factor) override;
// Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls // Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls
// (since StartPage and EndPage do not work in a metafile DC). Only valid // (since StartPage and EndPage do not work in a metafile DC). Only valid
// when hdc_ is non-NULL. |page_size|, |content_area|, and |scale_factor| are // when hdc_ is non-NULL. |page_size|, |content_area|, and |scale_factor| are
......
...@@ -29,8 +29,6 @@ class Rect; ...@@ -29,8 +29,6 @@ class Rect;
class Size; class Size;
} }
class SkBaseDevice;
namespace printing { namespace printing {
// This class plays metafiles from data stream (usually PDF or EMF). // This class plays metafiles from data stream (usually PDF or EMF).
...@@ -111,13 +109,6 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer { ...@@ -111,13 +109,6 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer {
// Note: It should only be called from within the browser process. // Note: It should only be called from within the browser process.
virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0;
// This method calls StartPage and then returns an appropriate
// VectorPlatformDevice implementation bound to the context created by
// StartPage or NULL on error.
virtual SkBaseDevice* StartPageForVectorCanvas(const gfx::Size& page_size,
const gfx::Rect& content_area,
const float& scale_factor) = 0;
// Prepares a context for rendering a new page with the given |page_size|, // Prepares a context for rendering a new page with the given |page_size|,
// |content_area| and a |scale_factor| to use for the drawing. The units are // |content_area| and a |scale_factor| to use for the drawing. The units are
// in points (=1/72 in). Returns true on success. // in points (=1/72 in). Returns true on success.
......
...@@ -143,13 +143,6 @@ bool PdfMetafileCg::InitFromData(const void* src_buffer, ...@@ -143,13 +143,6 @@ bool PdfMetafileCg::InitFromData(const void* src_buffer,
return true; return true;
} }
SkBaseDevice* PdfMetafileCg::StartPageForVectorCanvas(
const gfx::Size& page_size, const gfx::Rect& content_area,
const float& scale_factor) {
NOTIMPLEMENTED();
return NULL;
}
bool PdfMetafileCg::StartPage(const gfx::Size& page_size, bool PdfMetafileCg::StartPage(const gfx::Size& page_size,
const gfx::Rect& content_area, const gfx::Rect& content_area,
const float& scale_factor) { const float& scale_factor) {
......
...@@ -36,9 +36,6 @@ class PRINTING_EXPORT PdfMetafileCg : public Metafile { ...@@ -36,9 +36,6 @@ class PRINTING_EXPORT PdfMetafileCg : public Metafile {
bool InitFromData(const void* src_buffer, uint32 src_buffer_size) override; bool InitFromData(const void* src_buffer, uint32 src_buffer_size) override;
// Not implemented on mac. // Not implemented on mac.
SkBaseDevice* StartPageForVectorCanvas(const gfx::Size& page_size,
const gfx::Rect& content_area,
const float& scale_factor) override;
bool StartPage(const gfx::Size& page_size, bool StartPage(const gfx::Size& page_size,
const gfx::Rect& content_area, const gfx::Rect& content_area,
const float& scale_factor) override; const float& scale_factor) override;
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <windows.h> #include <windows.h>
#endif #endif
class SkBaseDevice;
#if defined(OS_CHROMEOS) || defined(OS_ANDROID) #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
namespace base { namespace base {
struct FileDescriptor; struct FileDescriptor;
...@@ -35,10 +37,6 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile { ...@@ -35,10 +37,6 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
bool Init() override; bool Init() override;
bool InitFromData(const void* src_buffer, uint32 src_buffer_size) override; bool InitFromData(const void* src_buffer, uint32 src_buffer_size) override;
SkBaseDevice* StartPageForVectorCanvas(const gfx::Size& page_size,
const gfx::Rect& content_area,
const float& scale_factor) override;
bool StartPage(const gfx::Size& page_size, bool StartPage(const gfx::Size& page_size,
const gfx::Rect& content_area, const gfx::Rect& content_area,
const float& scale_factor) override; const float& scale_factor) override;
...@@ -72,6 +70,12 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile { ...@@ -72,6 +70,12 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
// Return a new metafile containing just the current page in draft mode. // Return a new metafile containing just the current page in draft mode.
scoped_ptr<PdfMetafileSkia> GetMetafileForCurrentPage(); scoped_ptr<PdfMetafileSkia> GetMetafileForCurrentPage();
// This method calls StartPage and then returns an appropriate
// VectorPlatformDevice implementation bound to the context created by
// StartPage or NULL on error.
SkBaseDevice* StartPageForVectorCanvas(const gfx::Size& page_size,
const gfx::Rect& content_area,
const float& scale_factor);
private: private:
scoped_ptr<PdfMetafileSkiaData> data_; scoped_ptr<PdfMetafileSkiaData> data_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment