OLD | NEW |
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_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" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "printing/native_metafile.h" | 12 #include "printing/native_metafile.h" |
13 | 13 |
14 typedef struct _cairo_surface cairo_surface_t; | 14 typedef struct _cairo_surface cairo_surface_t; |
15 | 15 |
16 namespace printing { | 16 namespace printing { |
17 | 17 |
18 // This class uses Cairo graphics library to generate PDF stream and stores | 18 // This class uses Cairo graphics library to generate PDF stream and stores |
19 // rendering results in a string buffer. | 19 // rendering results in a string buffer. |
20 class PdfPsMetafile : public NativeMetafile { | 20 class PdfPsMetafile : public NativeMetafile { |
21 public: | 21 public: |
22 virtual ~PdfPsMetafile(); | 22 virtual ~PdfPsMetafile(); |
23 | 23 |
24 // NativeMetafile methods. | 24 // NativeMetafile methods. |
25 virtual bool Init(); | 25 virtual bool Init(); |
26 virtual bool Init(const void* src_buffer, uint32 src_buffer_size); | 26 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); |
27 | 27 |
28 virtual cairo_t* StartPage(const gfx::Size& page_size, | 28 virtual cairo_t* StartPage(const gfx::Size& page_size, |
29 double margin_top_in_points, | 29 double margin_top_in_points, |
30 double margin_left_in_points); | 30 double margin_left_in_points); |
31 virtual bool FinishPage(); | 31 virtual bool FinishPage(); |
32 virtual bool Close(); | 32 virtual bool Close(); |
33 | 33 |
34 virtual uint32 GetDataSize() const; | 34 virtual uint32 GetDataSize() const; |
35 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const; | 35 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const; |
36 | 36 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 std::string data_; | 69 std::string data_; |
70 // Buffer stores raw PDF contents set by SetRawPageData. | 70 // Buffer stores raw PDF contents set by SetRawPageData. |
71 std::string raw_override_data_; | 71 std::string raw_override_data_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(PdfPsMetafile); | 73 DISALLOW_COPY_AND_ASSIGN(PdfPsMetafile); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace printing | 76 } // namespace printing |
77 | 77 |
78 #endif // PRINTING_PDF_PS_METAFILE_CAIRO_H_ | 78 #endif // PRINTING_PDF_PS_METAFILE_CAIRO_H_ |
OLD | NEW |