Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: printing/metafile.h

Issue 1343593002: Cleanup code in printing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « printing/image_win.cc ('k') | printing/metafile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 ~Metafile() override; 100 ~Metafile() override;
101 101
102 // Initializes a fresh new metafile for rendering. Returns false on failure. 102 // Initializes a fresh new metafile for rendering. Returns false on failure.
103 // 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
104 // rendering resources. 104 // rendering resources.
105 virtual bool Init() = 0; 105 virtual bool Init() = 0;
106 106
107 // Initializes the metafile with the data in |src_buffer|. Returns true 107 // Initializes the metafile with the data in |src_buffer|. Returns true
108 // on success. 108 // on success.
109 // Note: It should only be called from within the browser process. 109 // Note: It should only be called from within the browser process.
110 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; 110 virtual bool InitFromData(const void* src_buffer,
111 uint32_t src_buffer_size) = 0;
111 112
112 // Prepares a context for rendering a new page with the given |page_size|, 113 // Prepares a context for rendering a new page with the given |page_size|,
113 // |content_area| and a |scale_factor| to use for the drawing. The units are 114 // |content_area| and a |scale_factor| to use for the drawing. The units are
114 // in points (=1/72 in). Returns true on success. 115 // in points (=1/72 in). Returns true on success.
115 virtual bool StartPage(const gfx::Size& page_size, 116 virtual bool StartPage(const gfx::Size& page_size,
116 const gfx::Rect& content_area, 117 const gfx::Rect& content_area,
117 const float& scale_factor) = 0; 118 const float& scale_factor) = 0;
118 119
119 // Closes the current page and destroys the context used in rendering that 120 // Closes the current page and destroys the context used in rendering that
120 // page. The results of current page will be appended into the underlying 121 // page. The results of current page will be appended into the underlying
121 // data stream. Returns true on success. 122 // data stream. Returns true on success.
122 virtual bool FinishPage() = 0; 123 virtual bool FinishPage() = 0;
123 124
124 // Closes the metafile. No further rendering is allowed (the current page 125 // Closes the metafile. No further rendering is allowed (the current page
125 // is implicitly closed). 126 // is implicitly closed).
126 virtual bool FinishDocument() = 0; 127 virtual bool FinishDocument() = 0;
127 128
128 // Returns the size of the underlying data stream. Only valid after Close() 129 // Returns the size of the underlying data stream. Only valid after Close()
129 // has been called. 130 // has been called.
130 virtual uint32 GetDataSize() const = 0; 131 virtual uint32_t GetDataSize() const = 0;
131 132
132 // Copies the first |dst_buffer_size| bytes of the underlying data stream into 133 // Copies the first |dst_buffer_size| bytes of the underlying data stream into
133 // |dst_buffer|. This function should ONLY be called after Close() is invoked. 134 // |dst_buffer|. This function should ONLY be called after Close() is invoked.
134 // Returns true if the copy succeeds. 135 // Returns true if the copy succeeds.
135 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const = 0; 136 virtual bool GetData(void* dst_buffer, uint32_t dst_buffer_size) const = 0;
136 137
137 virtual gfx::Rect GetPageBounds(unsigned int page_number) const = 0; 138 virtual gfx::Rect GetPageBounds(unsigned int page_number) const = 0;
138 virtual unsigned int GetPageCount() const = 0; 139 virtual unsigned int GetPageCount() const = 0;
139 140
140 virtual gfx::NativeDrawingContext context() const = 0; 141 virtual gfx::NativeDrawingContext context() const = 0;
141 142
142 #if defined(OS_WIN) 143 #if defined(OS_WIN)
143 // "Plays" the EMF buffer in a HDC. It is the same effect as calling the 144 // "Plays" the EMF buffer in a HDC. It is the same effect as calling the
144 // original GDI function that were called when recording the EMF. |rect| is in 145 // original GDI function that were called when recording the EMF. |rect| is in
145 // "logical units" and is optional. If |rect| is NULL, the natural EMF bounds 146 // "logical units" and is optional. If |rect| is NULL, the natural EMF bounds
(...skipping 10 matching lines...) Expand all
156 157
157 bool SaveTo(base::File* file) const override; 158 bool SaveTo(base::File* file) const override;
158 159
159 private: 160 private:
160 DISALLOW_COPY_AND_ASSIGN(Metafile); 161 DISALLOW_COPY_AND_ASSIGN(Metafile);
161 }; 162 };
162 163
163 } // namespace printing 164 } // namespace printing
164 165
165 #endif // PRINTING_METAFILE_H_ 166 #endif // PRINTING_METAFILE_H_
OLDNEW
« no previous file with comments | « printing/image_win.cc ('k') | printing/metafile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698