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

Side by Side Diff: printing/pdf_ps_metafile_cairo.h

Issue 2807027: Added support for vector printing for Pepper v1 plugins for Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Merged Created 10 years, 5 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 | « chrome/renderer/webplugin_delegate_pepper.cc ('k') | printing/pdf_ps_metafile_cairo.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_PDF_PS_METAFILE_CAIRO_H_ 5 #ifndef PRINTING_PDF_PS_METAFILE_CAIRO_H_
6 #define PRINTING_PDF_PS_METAFILE_CAIRO_H_ 6 #define PRINTING_PDF_PS_METAFILE_CAIRO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 30 matching lines...) Expand all
41 // Note: Only call in the renderer to allocate rendering resources. 41 // Note: Only call in the renderer to allocate rendering resources.
42 bool Init(); 42 bool Init();
43 43
44 // Initializes a copy of metafile from PDF/PS stream data. 44 // Initializes a copy of metafile from PDF/PS stream data.
45 // Returns true on success. 45 // Returns true on success.
46 // |src_buffer| should point to the shared memory which stores PDF/PS 46 // |src_buffer| should point to the shared memory which stores PDF/PS
47 // contents generated in the renderer. 47 // contents generated in the renderer.
48 // Note: Only call in the browser to initialize |data_|. 48 // Note: Only call in the browser to initialize |data_|.
49 bool Init(const void* src_buffer, uint32 src_buffer_size); 49 bool Init(const void* src_buffer, uint32 src_buffer_size);
50 50
51 // Sets raw PS/PDF data for the document. This is used when a cairo drawing
52 // surface has already been created. This method will cause all subsequent
53 // drawing on the surface to be discarded (in Close()). If Init() has not yet
54 // been called this method simply calls the second version of Init.
55 bool SetRawData(const void* src_buffer, uint32 src_buffer_size);
56
51 FileFormat GetFileFormat() const { return format_; } 57 FileFormat GetFileFormat() const { return format_; }
52 58
53 // Prepares a new cairo surface/context for rendering a new page. 59 // Prepares a new cairo surface/context for rendering a new page.
54 // The unit is in point (=1/72 in). 60 // The unit is in point (=1/72 in).
55 // Returns NULL when failed. 61 // Returns NULL when failed.
56 cairo_t* StartPage(double width_in_points, 62 cairo_t* StartPage(double width_in_points,
57 double height_in_points, 63 double height_in_points,
58 double margin_top_in_points, 64 double margin_top_in_points,
59 double margin_right_in_points, 65 double margin_right_in_points,
60 double margin_bottom_in_points, 66 double margin_bottom_in_points,
(...skipping 21 matching lines...) Expand all
82 // This function should ONLY be called after PDF/PS file is closed. 88 // This function should ONLY be called after PDF/PS file is closed.
83 bool SaveTo(const base::FileDescriptor& fd) const; 89 bool SaveTo(const base::FileDescriptor& fd) const;
84 90
85 // The hardcoded margins, in points. These values are based on 72 dpi, 91 // The hardcoded margins, in points. These values are based on 72 dpi,
86 // with 0.25 margins on top, left, and right, and 0.56 on bottom. 92 // with 0.25 margins on top, left, and right, and 0.56 on bottom.
87 static const double kTopMarginInInch; 93 static const double kTopMarginInInch;
88 static const double kRightMarginInInch; 94 static const double kRightMarginInInch;
89 static const double kBottomMarginInInch; 95 static const double kBottomMarginInInch;
90 static const double kLeftMarginInInch; 96 static const double kLeftMarginInInch;
91 97
98 // Returns the PdfPsMetafile object that owns the given context. Returns NULL
99 // if the context was not created by a PdfPdMetafile object.
100 static PdfPsMetafile* FromCairoContext(cairo_t* context);
101
92 private: 102 private:
93 // Cleans up all resources. 103 // Cleans up all resources.
94 void CleanUpAll(); 104 void CleanUpAll();
95 105
96 FileFormat format_; 106 FileFormat format_;
97 107
98 // Cairo surface and context for entire PDF/PS file. 108 // Cairo surface and context for entire PDF/PS file.
99 cairo_surface_t* surface_; 109 cairo_surface_t* surface_;
100 cairo_t* context_; 110 cairo_t* context_;
101 111
102 // Buffer stores PDF/PS contents for entire PDF/PS file. 112 // Buffer stores PDF/PS contents for entire PDF/PS file.
103 std::string data_; 113 std::string data_;
114 // Buffer stores raw PDF/PS contents set by SetRawPageData.
115 std::string raw_override_data_;
104 116
105 DISALLOW_COPY_AND_ASSIGN(PdfPsMetafile); 117 DISALLOW_COPY_AND_ASSIGN(PdfPsMetafile);
106 }; 118 };
107 119
108 } // namespace printing 120 } // namespace printing
109 121
110 #endif // PRINTING_PDF_PS_METAFILE_CAIRO_H_ 122 #endif // PRINTING_PDF_PS_METAFILE_CAIRO_H_
OLDNEW
« no previous file with comments | « chrome/renderer/webplugin_delegate_pepper.cc ('k') | printing/pdf_ps_metafile_cairo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698