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

Side by Side Diff: printing/pdf_metafile_cg_mac.h

Issue 6826027: Connect the right metafiles for print preview on Linux and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile problems Created 9 years, 8 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/pdf_metafile_cairo_linux.h ('k') | printing/pdf_metafile_skia.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_PDF_METAFILE_CG_MAC_H_ 5 #ifndef PRINTING_PDF_METAFILE_CG_MAC_H_
6 #define PRINTING_PDF_METAFILE_CG_MAC_H_ 6 #define PRINTING_PDF_METAFILE_CG_MAC_H_
7 7
8 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
9 #include <CoreFoundation/CoreFoundation.h> 9 #include <CoreFoundation/CoreFoundation.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/mac/scoped_cftyperef.h" 13 #include "base/mac/scoped_cftyperef.h"
14 #include "printing/native_metafile.h" 14 #include "printing/metafile.h"
15 15
16 class FilePath; 16 class FilePath;
17 17
18 namespace gfx { 18 namespace gfx {
19 class Rect; 19 class Rect;
20 class Size; 20 class Size;
21 class Point; 21 class Point;
22 } 22 }
23 23
24 namespace printing { 24 namespace printing {
25 25
26 // This class creates a graphics context that renders into a PDF data stream. 26 // This class creates a graphics context that renders into a PDF data stream.
27 class PdfMetafileCg : public NativeMetafile { 27 class PdfMetafileCg : public Metafile {
28 public: 28 public:
29 29 PdfMetafileCg();
30 virtual ~PdfMetafileCg(); 30 virtual ~PdfMetafileCg();
31 31
32 // NativeMetafile methods. 32 // Metafile methods.
33 virtual bool Init(); 33 virtual bool Init();
34 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); 34 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size);
35 35
36 // Not implemented on mac. 36 // Not implemented on mac.
37 virtual skia::PlatformDevice* StartPageForVectorCanvas( 37 virtual skia::PlatformDevice* StartPageForVectorCanvas(
38 const gfx::Size& page_size, const gfx::Point& content_origin, 38 const gfx::Size& page_size, const gfx::Point& content_origin,
39 const float& scale_factor); 39 const float& scale_factor);
40 virtual bool StartPage(const gfx::Size& page_size, 40 virtual bool StartPage(const gfx::Size& page_size,
41 const gfx::Point& content_origin, 41 const gfx::Point& content_origin,
42 const float& scale_factor); 42 const float& scale_factor);
(...skipping 14 matching lines...) Expand all
57 virtual CGContextRef context() const; 57 virtual CGContextRef context() const;
58 58
59 virtual bool RenderPage(unsigned int page_number, 59 virtual bool RenderPage(unsigned int page_number,
60 CGContextRef context, 60 CGContextRef context,
61 const CGRect rect, 61 const CGRect rect,
62 bool shrink_to_fit, 62 bool shrink_to_fit,
63 bool stretch_to_fit, 63 bool stretch_to_fit,
64 bool center_horizontally, 64 bool center_horizontally,
65 bool center_vertically) const; 65 bool center_vertically) const;
66 66
67 protected:
68 PdfMetafileCg();
69
70 private: 67 private:
71 friend class NativeMetafileFactory;
72 FRIEND_TEST_ALL_PREFIXES(PdfMetafileCgTest, Pdf);
73
74 // Returns a CGPDFDocumentRef version of pdf_data_. 68 // Returns a CGPDFDocumentRef version of pdf_data_.
75 CGPDFDocumentRef GetPDFDocument() const; 69 CGPDFDocumentRef GetPDFDocument() const;
76 70
77 // Context for rendering to the pdf. 71 // Context for rendering to the pdf.
78 base::mac::ScopedCFTypeRef<CGContextRef> context_; 72 base::mac::ScopedCFTypeRef<CGContextRef> context_;
79 73
80 // PDF backing store. 74 // PDF backing store.
81 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; 75 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_;
82 76
83 // Lazily-created CGPDFDocument representation of pdf_data_. 77 // Lazily-created CGPDFDocument representation of pdf_data_.
84 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; 78 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_;
85 79
86 // Whether or not a page is currently open. 80 // Whether or not a page is currently open.
87 bool page_is_open_; 81 bool page_is_open_;
88 82
89 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); 83 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg);
90 }; 84 };
91 85
92 } // namespace printing 86 } // namespace printing
93 87
94 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ 88 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_
OLDNEW
« no previous file with comments | « printing/pdf_metafile_cairo_linux.h ('k') | printing/pdf_metafile_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698