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

Side by Side Diff: printing/native_metafile.h

Issue 6695013: Cleanup NativeMetafile (win) interface and EMF class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Typo Created 9 years, 9 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 | Annotate | Revision Log
« printing/emf_win.h ('K') | « printing/emf_win_unittest.cc ('k') | no next file » | 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) 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_NATIVE_METAFILE_H_ 5 #ifndef PRINTING_NATIVE_METAFILE_H_
6 #define PRINTING_NATIVE_METAFILE_H_ 6 #define PRINTING_NATIVE_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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 virtual bool SaveTo(const FilePath& file_path) const = 0; 94 virtual bool SaveTo(const FilePath& file_path) const = 0;
95 95
96 // Returns the bounds of the given page. Pages use a 1-based index. 96 // Returns the bounds of the given page. Pages use a 1-based index.
97 virtual gfx::Rect GetPageBounds(unsigned int page_number) const = 0; 97 virtual gfx::Rect GetPageBounds(unsigned int page_number) const = 0;
98 virtual unsigned int GetPageCount() const = 0; 98 virtual unsigned int GetPageCount() const = 0;
99 99
100 // Get the context for rendering to the PDF. 100 // Get the context for rendering to the PDF.
101 virtual gfx::NativeDrawingContext context() const = 0; 101 virtual gfx::NativeDrawingContext context() const = 0;
102 102
103 #if defined(OS_WIN) 103 #if defined(OS_WIN)
104 // Generates a virtual HDC that will record every GDI commands and compile it
105 // in a EMF data stream.
106 // hdc is used to setup the default DPI and color settings. hdc is optional.
107 // rect specifies the dimensions (in .01-millimeter units) of the EMF. rect is
108 // optional.
109 virtual bool CreateDc(gfx::NativeDrawingContext sibling,
110 const RECT* rect) = 0;
111
112 // Similar to the above method but the metafile is backed by a file.
113 virtual bool CreateFileBackedDc(gfx::NativeDrawingContext sibling,
114 const RECT* rect,
115 const FilePath& path) = 0;
116
117 // TODO(maruel): CreateFromFile(). If ever used. Maybe users would like to
118 // have the ability to save web pages to an EMF file? Afterward, it is easy to
119 // convert to PDF or PS.
120 // Load a metafile fromdisk.
121 virtual bool CreateFromFile(const FilePath& metafile_path) = 0;
122
123 // Closes the HDC created by CreateDc() and generates the compiled EMF
124 // data.
125 virtual void CloseEmf() = 0;
126
127 // "Plays" the EMF buffer in a HDC. It is the same effect as calling the 104 // "Plays" the EMF buffer in a HDC. It is the same effect as calling the
128 // original GDI function that were called when recording the EMF. |rect| is in 105 // original GDI function that were called when recording the EMF. |rect| is in
129 // "logical units" and is optional. If |rect| is NULL, the natural EMF bounds 106 // "logical units" and is optional. If |rect| is NULL, the natural EMF bounds
130 // are used. 107 // are used.
131 // Note: Windows has been known to have stack buffer overflow in its GDI 108 // Note: Windows has been known to have stack buffer overflow in its GDI
132 // functions, whether used directly or indirectly through precompiled EMF 109 // functions, whether used directly or indirectly through precompiled EMF
133 // data. We have to accept the risk here. Since it is used only for printing, 110 // data. We have to accept the risk here. Since it is used only for printing,
134 // it requires user intervention. 111 // it requires user intervention.
135 virtual bool Playback(gfx::NativeDrawingContext hdc, 112 virtual bool Playback(gfx::NativeDrawingContext hdc,
136 const RECT* rect) const = 0; 113 const RECT* rect) const = 0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Returns true if writing succeeded. 157 // Returns true if writing succeeded.
181 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; 158 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0;
182 #endif // if defined(OS_CHROMEOS) 159 #endif // if defined(OS_CHROMEOS)
183 160
184 #endif 161 #endif
185 }; 162 };
186 163
187 } // namespace printing 164 } // namespace printing
188 165
189 #endif // PRINTING_NATIVE_METAFILE_H_ 166 #endif // PRINTING_NATIVE_METAFILE_H_
OLDNEW
« printing/emf_win.h ('K') | « printing/emf_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698