OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Initializes the metafile with the data in |src_buffer|. Returns true | 51 // Initializes the metafile with the data in |src_buffer|. Returns true |
52 // on success. | 52 // on success. |
53 // Note: It should only be called from within the browser process. | 53 // Note: It should only be called from within the browser process. |
54 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; | 54 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; |
55 | 55 |
56 // This method calls StartPage and then returns an appropriate | 56 // This method calls StartPage and then returns an appropriate |
57 // VectorPlatformDevice implementation bound to the context created by | 57 // VectorPlatformDevice implementation bound to the context created by |
58 // StartPage or NULL on error. | 58 // StartPage or NULL on error. |
59 virtual skia::PlatformDevice* StartPageForVectorCanvas( | 59 virtual skia::PlatformDevice* StartPageForVectorCanvas( |
60 const gfx::Size& page_size, const gfx::Point& content_origin, | 60 const gfx::Size& page_size, |
| 61 const gfx::Rect& content_area, |
61 const float& scale_factor) = 0; | 62 const float& scale_factor) = 0; |
62 | 63 |
63 // Prepares a context for rendering a new page at the specified | 64 // Prepares a context for rendering a new page with the given |page_size|, |
64 // |content_origin| with the given |page_size| and a |scale_factor| to use for | 65 // |content_area| and a |scale_factor| to use for the drawing. The units are |
65 // the drawing. The units are in points (=1/72 in). Returns true on success. | 66 // in points (=1/72 in). Returns true on success. |
66 virtual bool StartPage(const gfx::Size& page_size, | 67 virtual bool StartPage(const gfx::Size& page_size, |
67 const gfx::Point& content_origin, | 68 const gfx::Rect& content_area, |
68 const float& scale_factor) = 0; | 69 const float& scale_factor) = 0; |
69 | 70 |
70 // Closes the current page and destroys the context used in rendering that | 71 // Closes the current page and destroys the context used in rendering that |
71 // page. The results of current page will be appended into the underlying | 72 // page. The results of current page will be appended into the underlying |
72 // data stream. Returns true on success. | 73 // data stream. Returns true on success. |
73 virtual bool FinishPage() = 0; | 74 virtual bool FinishPage() = 0; |
74 | 75 |
75 // Closes the metafile. No further rendering is allowed (the current page | 76 // Closes the metafile. No further rendering is allowed (the current page |
76 // is implicitly closed). | 77 // is implicitly closed). |
77 virtual bool FinishDocument() = 0; | 78 virtual bool FinishDocument() = 0; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Saves the underlying data to the file associated with fd. This function | 143 // Saves the underlying data to the file associated with fd. This function |
143 // should ONLY be called after the metafile is closed. | 144 // should ONLY be called after the metafile is closed. |
144 // Returns true if writing succeeded. | 145 // Returns true if writing succeeded. |
145 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; | 146 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; |
146 #endif // if defined(OS_CHROMEOS) | 147 #endif // if defined(OS_CHROMEOS) |
147 }; | 148 }; |
148 | 149 |
149 } // namespace printing | 150 } // namespace printing |
150 | 151 |
151 #endif // PRINTING_METAFILE_H_ | 152 #endif // PRINTING_METAFILE_H_ |
OLD | NEW |