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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "printing/printing_export.h" | 10 #include "printing/printing_export.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace base { | 21 namespace base { |
22 class FilePath; | 22 class FilePath; |
23 } | 23 } |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
26 class Rect; | 26 class Rect; |
27 class Size; | 27 class Size; |
28 } | 28 } |
29 | 29 |
30 class SkDevice; | 30 class SkDevice; |
| 31 typedef SkDevice SkBaseDevice; |
31 | 32 |
32 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 33 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
33 namespace base { | 34 namespace base { |
34 struct FileDescriptor; | 35 struct FileDescriptor; |
35 } | 36 } |
36 #endif | 37 #endif |
37 | 38 |
38 namespace printing { | 39 namespace printing { |
39 | 40 |
40 // This class creates a graphics context that renders into a data stream | 41 // This class creates a graphics context that renders into a data stream |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual bool Init() = 0; | 81 virtual bool Init() = 0; |
81 | 82 |
82 // Initializes the metafile with the data in |src_buffer|. Returns true | 83 // Initializes the metafile with the data in |src_buffer|. Returns true |
83 // on success. | 84 // on success. |
84 // Note: It should only be called from within the browser process. | 85 // Note: It should only be called from within the browser process. |
85 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; | 86 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; |
86 | 87 |
87 // This method calls StartPage and then returns an appropriate | 88 // This method calls StartPage and then returns an appropriate |
88 // VectorPlatformDevice implementation bound to the context created by | 89 // VectorPlatformDevice implementation bound to the context created by |
89 // StartPage or NULL on error. | 90 // StartPage or NULL on error. |
90 virtual SkDevice* StartPageForVectorCanvas( | 91 virtual SkBaseDevice* StartPageForVectorCanvas( |
91 const gfx::Size& page_size, | 92 const gfx::Size& page_size, |
92 const gfx::Rect& content_area, | 93 const gfx::Rect& content_area, |
93 const float& scale_factor) = 0; | 94 const float& scale_factor) = 0; |
94 | 95 |
95 // Prepares a context for rendering a new page with the given |page_size|, | 96 // Prepares a context for rendering a new page with the given |page_size|, |
96 // |content_area| and a |scale_factor| to use for the drawing. The units are | 97 // |content_area| and a |scale_factor| to use for the drawing. The units are |
97 // in points (=1/72 in). Returns true on success. | 98 // in points (=1/72 in). Returns true on success. |
98 virtual bool StartPage(const gfx::Size& page_size, | 99 virtual bool StartPage(const gfx::Size& page_size, |
99 const gfx::Rect& content_area, | 100 const gfx::Rect& content_area, |
100 const float& scale_factor) = 0; | 101 const float& scale_factor) = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Saves the underlying data to the file associated with fd. This function | 160 // Saves the underlying data to the file associated with fd. This function |
160 // should ONLY be called after the metafile is closed. | 161 // should ONLY be called after the metafile is closed. |
161 // Returns true if writing succeeded. | 162 // Returns true if writing succeeded. |
162 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; | 163 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; |
163 #endif // if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 164 #endif // if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
164 }; | 165 }; |
165 | 166 |
166 } // namespace printing | 167 } // namespace printing |
167 | 168 |
168 #endif // PRINTING_METAFILE_H_ | 169 #endif // PRINTING_METAFILE_H_ |
OLD | NEW |