OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 28 matching lines...) Expand all Loading... |
39 bool GetData(void* dst_buffer, uint32_t dst_buffer_size) const override; | 39 bool GetData(void* dst_buffer, uint32_t dst_buffer_size) const override; |
40 | 40 |
41 gfx::Rect GetPageBounds(unsigned int page_number) const override; | 41 gfx::Rect GetPageBounds(unsigned int page_number) const override; |
42 unsigned int GetPageCount() const override; | 42 unsigned int GetPageCount() const override; |
43 | 43 |
44 // Note: The returned context *must not be retained* past Close(). If it is, | 44 // Note: The returned context *must not be retained* past Close(). If it is, |
45 // the data returned from GetData will not be valid PDF data. | 45 // the data returned from GetData will not be valid PDF data. |
46 CGContextRef context() const override; | 46 CGContextRef context() const override; |
47 | 47 |
48 bool RenderPage(unsigned int page_number, | 48 bool RenderPage(unsigned int page_number, |
49 gfx::NativeDrawingContext context, | 49 skia::NativeDrawingContext context, |
50 const CGRect rect, | 50 const CGRect rect, |
51 const MacRenderPageParams& params) const override; | 51 const MacRenderPageParams& params) const override; |
52 | 52 |
53 private: | 53 private: |
54 // Returns a CGPDFDocumentRef version of |pdf_data_|. | 54 // Returns a CGPDFDocumentRef version of |pdf_data_|. |
55 CGPDFDocumentRef GetPDFDocument() const; | 55 CGPDFDocumentRef GetPDFDocument() const; |
56 | 56 |
57 // Context for rendering to the pdf. | 57 // Context for rendering to the pdf. |
58 base::ScopedCFTypeRef<CGContextRef> context_; | 58 base::ScopedCFTypeRef<CGContextRef> context_; |
59 | 59 |
60 // PDF backing store. | 60 // PDF backing store. |
61 base::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; | 61 base::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; |
62 | 62 |
63 // Lazily-created CGPDFDocument representation of |pdf_data_|. | 63 // Lazily-created CGPDFDocument representation of |pdf_data_|. |
64 mutable base::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; | 64 mutable base::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; |
65 | 65 |
66 // Whether or not a page is currently open. | 66 // Whether or not a page is currently open. |
67 bool page_is_open_; | 67 bool page_is_open_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); | 69 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace printing | 72 } // namespace printing |
73 | 73 |
74 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ | 74 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ |
OLD | NEW |