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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // | 62 // |
63 // |autorotate| specifies whether the source PDF should be autorotated to fit | 63 // |autorotate| specifies whether the source PDF should be autorotated to fit |
64 // on the destination page. | 64 // on the destination page. |
65 struct RenderPageParams { | 65 struct RenderPageParams { |
66 bool shrink_to_fit = false; | 66 bool shrink_to_fit = false; |
67 bool stretch_to_fit = false; | 67 bool stretch_to_fit = false; |
68 bool center_horizontally = false; | 68 bool center_horizontally = false; |
69 bool center_vertically = false; | 69 bool center_vertically = false; |
70 bool autorotate = false; | 70 bool autorotate = false; |
71 }; | 71 }; |
| 72 // Renders the given page from this metafile into |rect| in the given context. |
| 73 // Pages use a 1-based index. The rendering uses the arguments in |
| 74 // |params| to determine scaling, translation, and rotation. |
| 75 bool OnRenderPage(unsigned int page_number, |
| 76 CGContextRef context, |
| 77 const CGRect rect, |
| 78 const RenderPageParams& params); |
| 79 |
72 // Renders the given page from |src_buffer| into |rect| in the given context. | 80 // Renders the given page from |src_buffer| into |rect| in the given context. |
73 // Pages use a 1-based index. The rendering uses the arguments in | 81 // Pages use a 1-based index. The rendering uses the arguments in |
74 // |params| to determine scaling, translation, and rotation. | 82 // |params| to determine scaling, translation, and rotation. |
75 static bool RenderPage(const std::vector<char>& src_buffer, | 83 static bool RenderPage(const std::vector<char>& src_buffer, |
76 unsigned int page_number, | 84 unsigned int page_number, |
77 CGContextRef context, | 85 CGContextRef context, |
78 const CGRect rect, | 86 const CGRect rect, |
79 const RenderPageParams& params); | 87 const RenderPageParams& params); |
80 | 88 |
81 private: | 89 private: |
(...skipping 11 matching lines...) Expand all Loading... |
93 | 101 |
94 // Whether or not a page is currently open. | 102 // Whether or not a page is currently open. |
95 bool page_is_open_; | 103 bool page_is_open_; |
96 | 104 |
97 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); | 105 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); |
98 }; | 106 }; |
99 | 107 |
100 } // namespace printing | 108 } // namespace printing |
101 | 109 |
102 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ | 110 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ |
OLD | NEW |