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

Side by Side Diff: printing/metafile.h

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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
« no previous file with comments | « printing/image_win.cc ('k') | printing/pdf_metafile_cairo_linux.h » ('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) 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"
11 11
12 #if defined(OS_WIN) 12 #if defined(OS_WIN)
13 #include <windows.h> 13 #include <windows.h>
14 #elif defined(OS_MACOSX) 14 #elif defined(OS_MACOSX)
15 #include <ApplicationServices/ApplicationServices.h> 15 #include <ApplicationServices/ApplicationServices.h>
16 #include <CoreFoundation/CoreFoundation.h> 16 #include <CoreFoundation/CoreFoundation.h>
17 #include "base/mac/scoped_cftyperef.h" 17 #include "base/mac/scoped_cftyperef.h"
18 #endif 18 #endif
19 19
20 class FilePath; 20 class FilePath;
21 21
22 namespace gfx { 22 namespace gfx {
23 class Point; 23 class Point;
24 class Rect; 24 class Rect;
25 class Size; 25 class Size;
26 } 26 }
27 27
28 namespace skia { 28 class SkDevice;
29 class PlatformDevice;
30 }
31 29
32 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
33 namespace base { 31 namespace base {
34 struct FileDescriptor; 32 struct FileDescriptor;
35 } 33 }
36 #endif 34 #endif
37 35
38 namespace printing { 36 namespace printing {
39 37
40 // This class creates a graphics context that renders into a data stream 38 // This class creates a graphics context that renders into a data stream
41 // (usually PDF or EMF). 39 // (usually PDF or EMF).
42 class Metafile { 40 class Metafile {
43 public: 41 public:
44 virtual ~Metafile() {} 42 virtual ~Metafile() {}
45 43
46 // Initializes a fresh new metafile for rendering. Returns false on failure. 44 // Initializes a fresh new metafile for rendering. Returns false on failure.
47 // Note: It should only be called from within the renderer process to allocate 45 // Note: It should only be called from within the renderer process to allocate
48 // rendering resources. 46 // rendering resources.
49 virtual bool Init() = 0; 47 virtual bool Init() = 0;
50 48
51 // Initializes the metafile with the data in |src_buffer|. Returns true 49 // Initializes the metafile with the data in |src_buffer|. Returns true
52 // on success. 50 // on success.
53 // Note: It should only be called from within the browser process. 51 // Note: It should only be called from within the browser process.
54 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; 52 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0;
55 53
56 // This method calls StartPage and then returns an appropriate 54 // This method calls StartPage and then returns an appropriate
57 // VectorPlatformDevice implementation bound to the context created by 55 // VectorPlatformDevice implementation bound to the context created by
58 // StartPage or NULL on error. 56 // StartPage or NULL on error.
59 virtual skia::PlatformDevice* StartPageForVectorCanvas( 57 virtual SkDevice* StartPageForVectorCanvas(
60 const gfx::Size& page_size, 58 const gfx::Size& page_size,
61 const gfx::Rect& content_area, 59 const gfx::Rect& content_area,
62 const float& scale_factor) = 0; 60 const float& scale_factor) = 0;
63 61
64 // Prepares a context for rendering a new page with the given |page_size|, 62 // Prepares a context for rendering a new page with the given |page_size|,
65 // |content_area| and a |scale_factor| to use for the drawing. The units are 63 // |content_area| and a |scale_factor| to use for the drawing. The units are
66 // in points (=1/72 in). Returns true on success. 64 // in points (=1/72 in). Returns true on success.
67 virtual bool StartPage(const gfx::Size& page_size, 65 virtual bool StartPage(const gfx::Size& page_size,
68 const gfx::Rect& content_area, 66 const gfx::Rect& content_area,
69 const float& scale_factor) = 0; 67 const float& scale_factor) = 0;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Saves the underlying data to the file associated with fd. This function 141 // Saves the underlying data to the file associated with fd. This function
144 // should ONLY be called after the metafile is closed. 142 // should ONLY be called after the metafile is closed.
145 // Returns true if writing succeeded. 143 // Returns true if writing succeeded.
146 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; 144 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0;
147 #endif // if defined(OS_CHROMEOS) 145 #endif // if defined(OS_CHROMEOS)
148 }; 146 };
149 147
150 } // namespace printing 148 } // namespace printing
151 149
152 #endif // PRINTING_METAFILE_H_ 150 #endif // PRINTING_METAFILE_H_
OLDNEW
« no previous file with comments | « printing/image_win.cc ('k') | printing/pdf_metafile_cairo_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698