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

Side by Side Diff: printing/pdf_metafile_cairo_linux.h

Issue 7847002: Removed unneeded cairo code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unneeded include Created 9 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 | Annotate | Revision Log
« no previous file with comments | « printing/metafile_impl.h ('k') | printing/pdf_metafile_cairo_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PRINTING_PDF_METAFILE_CAIRO_LINUX_H_
6 #define PRINTING_PDF_METAFILE_CAIRO_LINUX_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h"
12 #include "printing/metafile.h"
13
14 namespace gfx {
15 class Point;
16 class Rect;
17 class Size;
18 }
19
20 typedef struct _cairo_surface cairo_surface_t;
21
22 namespace printing {
23
24 // This class uses Cairo graphics library to generate PDF stream and stores
25 // rendering results in a string buffer.
26 class PRINTING_EXPORT PdfMetafileCairo : public Metafile {
27 public:
28 PdfMetafileCairo();
29 virtual ~PdfMetafileCairo();
30
31 // Metafile methods.
32 virtual bool Init();
33
34 // Calling InitFromData() sets the data for this metafile and masks data
35 // induced by previous calls to Init() or InitFromData(), even if drawing
36 // continues on the surface returned by a previous call to Init().
37 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size);
38
39 virtual SkDevice* StartPageForVectorCanvas(
40 const gfx::Size& page_size, const gfx::Rect& content_area,
41 const float& scale_factor);
42
43 virtual bool StartPage(const gfx::Size& page_size,
44 const gfx::Rect& content_area,
45 const float& scale_factor);
46 virtual bool FinishPage();
47 virtual bool FinishDocument();
48
49 virtual uint32 GetDataSize() const;
50 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const;
51
52 virtual bool SaveTo(const FilePath& file_path) const;
53
54 virtual gfx::Rect GetPageBounds(unsigned int page_number) const;
55 virtual unsigned int GetPageCount() const;
56
57 virtual cairo_t* context() const;
58
59 #if defined(OS_CHROMEOS)
60 virtual bool SaveToFD(const base::FileDescriptor& fd) const;
61 #endif // if defined(OS_CHROMEOS)
62
63 private:
64 // Cleans up all resources.
65 void CleanUpAll();
66
67 // Cairo surface and context for entire PDF file.
68 cairo_surface_t* surface_;
69 cairo_t* context_;
70
71 // Buffer stores PDF contents for entire PDF file.
72 std::string cairo_data_;
73 // Buffer stores PDF contents. It can only be populated from InitFromData().
74 // Any calls to StartPage(), FinishPage(), FinishDocument() do not affect
75 // this buffer.
76 // Note: Such calls will result in DCHECK errors if Init() has not been called
77 // first.
78 std::string raw_data_;
79 // Points to the appropriate buffer depending on the way the object was
80 // initialized (Init() vs InitFromData()).
81 std::string* current_data_;
82
83 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCairo);
84 };
85
86 } // namespace printing
87
88 #endif // PRINTING_PDF_METAFILE_CAIRO_LINUX_H_
OLDNEW
« no previous file with comments | « printing/metafile_impl.h ('k') | printing/pdf_metafile_cairo_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698