| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PRINTING_METAFILE_H_ | 5 #ifndef PRINTING_METAFILE_H_ |
| 6 #define PRINTING_METAFILE_H_ | 6 #define PRINTING_METAFILE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class File; | 24 class File; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace gfx { | 27 namespace gfx { |
| 28 class Rect; | 28 class Rect; |
| 29 class Size; | 29 class Size; |
| 30 } | 30 } |
| 31 | 31 |
| 32 class SkBaseDevice; | |
| 33 | |
| 34 namespace printing { | 32 namespace printing { |
| 35 | 33 |
| 36 // This class plays metafiles from data stream (usually PDF or EMF). | 34 // This class plays metafiles from data stream (usually PDF or EMF). |
| 37 class PRINTING_EXPORT MetafilePlayer { | 35 class PRINTING_EXPORT MetafilePlayer { |
| 38 public: | 36 public: |
| 39 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
| 40 // |shrink_to_fit| specifies whether the output should be shrunk to fit a | 38 // |shrink_to_fit| specifies whether the output should be shrunk to fit a |
| 41 // destination page if the source PDF is bigger than the destination page in | 39 // destination page if the source PDF is bigger than the destination page in |
| 42 // any dimension. If this is false, parts of the source PDF page that lie | 40 // any dimension. If this is false, parts of the source PDF page that lie |
| 43 // outside the bounds will be clipped. | 41 // outside the bounds will be clipped. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Initializes a fresh new metafile for rendering. Returns false on failure. | 102 // Initializes a fresh new metafile for rendering. Returns false on failure. |
| 105 // Note: It should only be called from within the renderer process to allocate | 103 // Note: It should only be called from within the renderer process to allocate |
| 106 // rendering resources. | 104 // rendering resources. |
| 107 virtual bool Init() = 0; | 105 virtual bool Init() = 0; |
| 108 | 106 |
| 109 // Initializes the metafile with the data in |src_buffer|. Returns true | 107 // Initializes the metafile with the data in |src_buffer|. Returns true |
| 110 // on success. | 108 // on success. |
| 111 // Note: It should only be called from within the browser process. | 109 // Note: It should only be called from within the browser process. |
| 112 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; | 110 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; |
| 113 | 111 |
| 114 // This method calls StartPage and then returns an appropriate | |
| 115 // VectorPlatformDevice implementation bound to the context created by | |
| 116 // StartPage or NULL on error. | |
| 117 virtual SkBaseDevice* StartPageForVectorCanvas(const gfx::Size& page_size, | |
| 118 const gfx::Rect& content_area, | |
| 119 const float& scale_factor) = 0; | |
| 120 | |
| 121 // Prepares a context for rendering a new page with the given |page_size|, | 112 // Prepares a context for rendering a new page with the given |page_size|, |
| 122 // |content_area| and a |scale_factor| to use for the drawing. The units are | 113 // |content_area| and a |scale_factor| to use for the drawing. The units are |
| 123 // in points (=1/72 in). Returns true on success. | 114 // in points (=1/72 in). Returns true on success. |
| 124 virtual bool StartPage(const gfx::Size& page_size, | 115 virtual bool StartPage(const gfx::Size& page_size, |
| 125 const gfx::Rect& content_area, | 116 const gfx::Rect& content_area, |
| 126 const float& scale_factor) = 0; | 117 const float& scale_factor) = 0; |
| 127 | 118 |
| 128 // Closes the current page and destroys the context used in rendering that | 119 // Closes the current page and destroys the context used in rendering that |
| 129 // page. The results of current page will be appended into the underlying | 120 // page. The results of current page will be appended into the underlying |
| 130 // data stream. Returns true on success. | 121 // data stream. Returns true on success. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 156 |
| 166 bool SaveTo(base::File* file) const override; | 157 bool SaveTo(base::File* file) const override; |
| 167 | 158 |
| 168 private: | 159 private: |
| 169 DISALLOW_COPY_AND_ASSIGN(Metafile); | 160 DISALLOW_COPY_AND_ASSIGN(Metafile); |
| 170 }; | 161 }; |
| 171 | 162 |
| 172 } // namespace printing | 163 } // namespace printing |
| 173 | 164 |
| 174 #endif // PRINTING_METAFILE_H_ | 165 #endif // PRINTING_METAFILE_H_ |
| OLD | NEW |