[email protected] | 9fc4416 | 2012-01-23 22:56:41 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 5 | #include "printing/pdf_metafile_cg_mac.h" |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 6 | |
avi | 126e93c | 2015-12-21 21:48:16 | [diff] [blame] | 7 | #include <stdint.h> |
| 8 | |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 9 | #include <algorithm> |
| 10 | |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 11 | #include "base/logging.h" |
[email protected] | ba64e2b | 2011-06-14 18:18:38 | [diff] [blame] | 12 | #include "base/mac/mac_util.h" |
[email protected] | df0ca6c8 | 2010-10-17 04:09:06 | [diff] [blame] | 13 | #include "base/mac/scoped_cftyperef.h" |
Peter Kasting | 76ed066 | 2017-09-14 08:28:07 | [diff] [blame^] | 14 | #include "base/numerics/math_constants.h" |
thestig | 6b4461f | 2016-10-28 19:34:30 | [diff] [blame] | 15 | #include "base/numerics/safe_conversions.h" |
[email protected] | 13ac5353 | 2013-03-30 00:27:00 | [diff] [blame] | 16 | #include "base/strings/sys_string_conversions.h" |
tfarina | 3b0452d | 2014-12-31 15:20:09 | [diff] [blame] | 17 | #include "ui/gfx/geometry/rect.h" |
tfarina | ebe974f0 | 2015-01-03 04:25:32 | [diff] [blame] | 18 | #include "ui/gfx/geometry/size.h" |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 19 | |
[email protected] | 3df79f4 | 2013-06-24 18:49:05 | [diff] [blame] | 20 | using base::ScopedCFTypeRef; |
[email protected] | df0ca6c8 | 2010-10-17 04:09:06 | [diff] [blame] | 21 | |
[email protected] | df6df68 | 2011-05-02 19:50:50 | [diff] [blame] | 22 | namespace { |
| 23 | |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 24 | // Rotate a page by |num_rotations| * 90 degrees, counter-clockwise. |
| 25 | void RotatePage(CGContextRef context, const CGRect rect, int num_rotations) { |
| 26 | switch (num_rotations) { |
| 27 | case 0: |
| 28 | break; |
| 29 | case 1: |
| 30 | // After rotating by 90 degrees with the axis at the origin, the page |
| 31 | // content is now "off screen". Shift it right to move it back on screen. |
| 32 | CGContextTranslateCTM(context, rect.size.width, 0); |
| 33 | // Rotates counter-clockwise by 90 degrees. |
Peter Kasting | 76ed066 | 2017-09-14 08:28:07 | [diff] [blame^] | 34 | CGContextRotateCTM(context, base::kPiDouble / 2); |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 35 | break; |
| 36 | case 2: |
| 37 | // After rotating by 180 degrees with the axis at the origin, the page |
| 38 | // content is now "off screen". Shift it right and up to move it back on |
| 39 | // screen. |
| 40 | CGContextTranslateCTM(context, rect.size.width, rect.size.height); |
| 41 | // Rotates counter-clockwise by 90 degrees. |
Peter Kasting | 76ed066 | 2017-09-14 08:28:07 | [diff] [blame^] | 42 | CGContextRotateCTM(context, base::kPiDouble); |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 43 | break; |
| 44 | case 3: |
| 45 | // After rotating by 270 degrees with the axis at the origin, the page |
| 46 | // content is now "off screen". Shift it right to move it back on screen. |
| 47 | CGContextTranslateCTM(context, 0, rect.size.height); |
| 48 | // Rotates counter-clockwise by 90 degrees. |
Peter Kasting | 76ed066 | 2017-09-14 08:28:07 | [diff] [blame^] | 49 | CGContextRotateCTM(context, -base::kPiDouble / 2); |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 50 | break; |
| 51 | default: |
| 52 | NOTREACHED(); |
| 53 | break; |
thestig | 707a24b2 | 2015-09-14 18:16:33 | [diff] [blame] | 54 | } |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 55 | } |
| 56 | |
[email protected] | df6df68 | 2011-05-02 19:50:50 | [diff] [blame] | 57 | } // namespace |
| 58 | |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 59 | namespace printing { |
| 60 | |
thestig | 3520b80 | 2016-04-04 22:12:52 | [diff] [blame] | 61 | PdfMetafileCg::PdfMetafileCg() : page_is_open_(false) {} |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 62 | |
thestig | 3520b80 | 2016-04-04 22:12:52 | [diff] [blame] | 63 | PdfMetafileCg::~PdfMetafileCg() {} |
[email protected] | 1d20cdf | 2011-02-16 18:09:28 | [diff] [blame] | 64 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 65 | bool PdfMetafileCg::Init() { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 66 | // Ensure that Init hasn't already been called. |
| 67 | DCHECK(!context_.get()); |
| 68 | DCHECK(!pdf_data_.get()); |
| 69 | |
| 70 | pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, 0)); |
| 71 | if (!pdf_data_.get()) { |
| 72 | LOG(ERROR) << "Failed to create pdf data for metafile"; |
[email protected] | 8f17cd3e | 2011-03-16 01:39:42 | [diff] [blame] | 73 | return false; |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 74 | } |
[email protected] | df0ca6c8 | 2010-10-17 04:09:06 | [diff] [blame] | 75 | ScopedCFTypeRef<CGDataConsumerRef> pdf_consumer( |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 76 | CGDataConsumerCreateWithCFData(pdf_data_)); |
| 77 | if (!pdf_consumer.get()) { |
| 78 | LOG(ERROR) << "Failed to create data consumer for metafile"; |
thestig | 3520b80 | 2016-04-04 22:12:52 | [diff] [blame] | 79 | pdf_data_.reset(); |
[email protected] | 8f17cd3e | 2011-03-16 01:39:42 | [diff] [blame] | 80 | return false; |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 81 | } |
thestig | 3520b80 | 2016-04-04 22:12:52 | [diff] [blame] | 82 | context_.reset(CGPDFContextCreate(pdf_consumer, nullptr, nullptr)); |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 83 | if (!context_.get()) { |
| 84 | LOG(ERROR) << "Failed to create pdf context for metafile"; |
thestig | 3520b80 | 2016-04-04 22:12:52 | [diff] [blame] | 85 | pdf_data_.reset(); |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 86 | } |
| 87 | |
[email protected] | 8f17cd3e | 2011-03-16 01:39:42 | [diff] [blame] | 88 | return true; |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 89 | } |
| 90 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 91 | bool PdfMetafileCg::InitFromData(const void* src_buffer, |
thestig | 6b4461f | 2016-10-28 19:34:30 | [diff] [blame] | 92 | size_t src_buffer_size) { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 93 | DCHECK(!context_.get()); |
| 94 | DCHECK(!pdf_data_.get()); |
| 95 | |
thestig | 6b4461f | 2016-10-28 19:34:30 | [diff] [blame] | 96 | if (!src_buffer || !src_buffer_size) |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 97 | return false; |
thestig | 6b4461f | 2016-10-28 19:34:30 | [diff] [blame] | 98 | |
| 99 | if (!base::IsValueInRangeForNumericType<CFIndex>(src_buffer_size)) |
| 100 | return false; |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 101 | |
| 102 | pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, src_buffer_size)); |
| 103 | CFDataAppendBytes(pdf_data_, static_cast<const UInt8*>(src_buffer), |
| 104 | src_buffer_size); |
| 105 | |
| 106 | return true; |
| 107 | } |
| 108 | |
thestig | 192677ec | 2016-06-09 07:43:17 | [diff] [blame] | 109 | void PdfMetafileCg::StartPage(const gfx::Size& page_size, |
[email protected] | 39892b9 | 2011-04-30 02:24:44 | [diff] [blame] | 110 | const gfx::Rect& content_area, |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 111 | const float& scale_factor) { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 112 | DCHECK(context_.get()); |
| 113 | DCHECK(!page_is_open_); |
| 114 | |
[email protected] | 15c2bb32 | 2010-12-21 22:30:10 | [diff] [blame] | 115 | double height = page_size.height(); |
| 116 | double width = page_size.width(); |
| 117 | |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 118 | CGRect bounds = CGRectMake(0, 0, width, height); |
| 119 | CGContextBeginPage(context_, &bounds); |
| 120 | page_is_open_ = true; |
| 121 | CGContextSaveGState(context_); |
| 122 | |
[email protected] | 9d42d072 | 2011-07-26 19:22:29 | [diff] [blame] | 123 | // Move to the context origin. |
| 124 | CGContextTranslateCTM(context_, content_area.x(), -content_area.y()); |
| 125 | |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 126 | // Flip the context. |
| 127 | CGContextTranslateCTM(context_, 0, height); |
| 128 | CGContextScaleCTM(context_, scale_factor, -scale_factor); |
| 129 | } |
| 130 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 131 | bool PdfMetafileCg::FinishPage() { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 132 | DCHECK(context_.get()); |
| 133 | DCHECK(page_is_open_); |
| 134 | |
| 135 | CGContextRestoreGState(context_); |
| 136 | CGContextEndPage(context_); |
| 137 | page_is_open_ = false; |
[email protected] | 8f17cd3e | 2011-03-16 01:39:42 | [diff] [blame] | 138 | return true; |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 139 | } |
| 140 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 141 | bool PdfMetafileCg::FinishDocument() { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 142 | DCHECK(context_.get()); |
| 143 | DCHECK(!page_is_open_); |
| 144 | |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 145 | #ifndef NDEBUG |
| 146 | // Check that the context will be torn down properly; if it's not, pdf_data_ |
| 147 | // will be incomplete and generate invalid PDF files/documents. |
| 148 | if (context_.get()) { |
| 149 | CFIndex extra_retain_count = CFGetRetainCount(context_.get()) - 1; |
| 150 | if (extra_retain_count > 0) { |
| 151 | LOG(ERROR) << "Metafile context has " << extra_retain_count |
| 152 | << " extra retain(s) on Close"; |
| 153 | } |
| 154 | } |
| 155 | #endif |
[email protected] | 1461948 | 2010-04-01 16:46:23 | [diff] [blame] | 156 | CGPDFContextClose(context_.get()); |
thestig | 3520b80 | 2016-04-04 22:12:52 | [diff] [blame] | 157 | context_.reset(); |
[email protected] | 8f17cd3e | 2011-03-16 01:39:42 | [diff] [blame] | 158 | return true; |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 159 | } |
| 160 | |
thestig | 99fc213 | 2017-04-27 03:37:54 | [diff] [blame] | 161 | bool PdfMetafileCg::RenderPage(unsigned int page_number, |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 162 | CGContextRef context, |
| 163 | const CGRect rect, |
thestig | 99fc213 | 2017-04-27 03:37:54 | [diff] [blame] | 164 | const MacRenderPageParams& params) const { |
| 165 | CGPDFDocumentRef pdf_doc = GetPDFDocument(); |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 166 | if (!pdf_doc) { |
| 167 | LOG(ERROR) << "Unable to create PDF document from data"; |
| 168 | return false; |
| 169 | } |
| 170 | CGPDFPageRef pdf_page = CGPDFDocumentGetPage(pdf_doc, page_number); |
[email protected] | a09ef7e | 2011-09-28 21:59:33 | [diff] [blame] | 171 | CGRect source_rect = CGPDFPageGetBoxRect(pdf_page, kCGPDFCropBox); |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 172 | int pdf_src_rotation = CGPDFPageGetRotationAngle(pdf_page); |
[email protected] | f3cab62 | 2010-06-28 18:56:30 | [diff] [blame] | 173 | float scaling_factor = 1.0; |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 174 | const bool source_is_landscape = |
| 175 | (source_rect.size.width > source_rect.size.height); |
| 176 | const bool dest_is_landscape = (rect.size.width > rect.size.height); |
| 177 | const bool rotate = |
| 178 | params.autorotate ? (source_is_landscape != dest_is_landscape) : false; |
| 179 | const float source_width = |
| 180 | rotate ? source_rect.size.height : source_rect.size.width; |
| 181 | const float source_height = |
| 182 | rotate ? source_rect.size.width : source_rect.size.height; |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 183 | |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 184 | // See if we need to scale the output. |
| 185 | const bool scaling_needed = |
| 186 | (params.shrink_to_fit && ((source_width > rect.size.width) || |
| 187 | (source_height > rect.size.height))) || |
| 188 | (params.stretch_to_fit && ((source_width < rect.size.width) && |
| 189 | (source_height < rect.size.height))); |
| 190 | if (scaling_needed) { |
| 191 | float x_scaling_factor = rect.size.width / source_width; |
| 192 | float y_scaling_factor = rect.size.height / source_height; |
| 193 | scaling_factor = std::min(x_scaling_factor, y_scaling_factor); |
[email protected] | f3cab62 | 2010-06-28 18:56:30 | [diff] [blame] | 194 | } |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 195 | // Some PDFs have a non-zero origin. Need to take that into account and align |
| 196 | // the PDF to the origin. |
| 197 | const float x_origin_offset = -1 * source_rect.origin.x; |
| 198 | const float y_origin_offset = -1 * source_rect.origin.y; |
| 199 | |
| 200 | // If the PDF needs to be centered, calculate the offsets here. |
| 201 | float x_offset = params.center_horizontally ? |
| 202 | ((rect.size.width - (source_width * scaling_factor)) / 2) : 0; |
| 203 | if (rotate) |
| 204 | x_offset = -x_offset; |
| 205 | |
| 206 | float y_offset = params.center_vertically ? |
| 207 | ((rect.size.height - (source_height * scaling_factor)) / 2) : 0; |
| 208 | |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 209 | CGContextSaveGState(context); |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 210 | |
| 211 | // The transform operations specified here gets applied in reverse order. |
| 212 | // i.e. the origin offset translation happens first. |
| 213 | // Origin is at bottom-left. |
[email protected] | f3cab62 | 2010-06-28 18:56:30 | [diff] [blame] | 214 | CGContextTranslateCTM(context, x_offset, y_offset); |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 215 | |
| 216 | int num_rotations = 0; |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 217 | if (rotate) { |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 218 | if (pdf_src_rotation == 0 || pdf_src_rotation == 270) { |
| 219 | num_rotations = 1; |
| 220 | } else { |
| 221 | num_rotations = 3; |
| 222 | } |
| 223 | } else { |
| 224 | if (pdf_src_rotation == 180 || pdf_src_rotation == 270) { |
| 225 | num_rotations = 2; |
| 226 | } |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 227 | } |
thestig | 23fe5177 | 2014-09-27 17:40:51 | [diff] [blame] | 228 | RotatePage(context, rect, num_rotations); |
| 229 | |
[email protected] | f3cab62 | 2010-06-28 18:56:30 | [diff] [blame] | 230 | CGContextScaleCTM(context, scaling_factor, scaling_factor); |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 231 | CGContextTranslateCTM(context, x_origin_offset, y_origin_offset); |
| 232 | |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 233 | CGContextDrawPDFPage(context, pdf_page); |
| 234 | CGContextRestoreGState(context); |
[email protected] | b5cf844c | 2012-06-18 21:49:20 | [diff] [blame] | 235 | |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 236 | return true; |
| 237 | } |
| 238 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 239 | unsigned int PdfMetafileCg::GetPageCount() const { |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 240 | CGPDFDocumentRef pdf_doc = GetPDFDocument(); |
| 241 | return pdf_doc ? CGPDFDocumentGetNumberOfPages(pdf_doc) : 0; |
| 242 | } |
| 243 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 244 | gfx::Rect PdfMetafileCg::GetPageBounds(unsigned int page_number) const { |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 245 | CGPDFDocumentRef pdf_doc = GetPDFDocument(); |
| 246 | if (!pdf_doc) { |
| 247 | LOG(ERROR) << "Unable to create PDF document from data"; |
| 248 | return gfx::Rect(); |
| 249 | } |
| 250 | if (page_number > GetPageCount()) { |
| 251 | LOG(ERROR) << "Invalid page number: " << page_number; |
| 252 | return gfx::Rect(); |
| 253 | } |
| 254 | CGPDFPageRef pdf_page = CGPDFDocumentGetPage(pdf_doc, page_number); |
| 255 | CGRect page_rect = CGPDFPageGetBoxRect(pdf_page, kCGPDFMediaBox); |
| 256 | return gfx::Rect(page_rect); |
| 257 | } |
| 258 | |
thestig | 707a24b2 | 2015-09-14 18:16:33 | [diff] [blame] | 259 | uint32_t PdfMetafileCg::GetDataSize() const { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 260 | // PDF data is only valid/complete once the context is released. |
| 261 | DCHECK(!context_); |
| 262 | |
| 263 | if (!pdf_data_) |
| 264 | return 0; |
thestig | 707a24b2 | 2015-09-14 18:16:33 | [diff] [blame] | 265 | return static_cast<uint32_t>(CFDataGetLength(pdf_data_)); |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 266 | } |
| 267 | |
thestig | 707a24b2 | 2015-09-14 18:16:33 | [diff] [blame] | 268 | bool PdfMetafileCg::GetData(void* dst_buffer, uint32_t dst_buffer_size) const { |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 269 | // PDF data is only valid/complete once the context is released. |
| 270 | DCHECK(!context_); |
| 271 | DCHECK(pdf_data_); |
| 272 | DCHECK(dst_buffer); |
| 273 | DCHECK_GT(dst_buffer_size, 0U); |
| 274 | |
thestig | 707a24b2 | 2015-09-14 18:16:33 | [diff] [blame] | 275 | uint32_t data_size = GetDataSize(); |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 276 | if (dst_buffer_size > data_size) { |
| 277 | return false; |
| 278 | } |
| 279 | |
| 280 | CFDataGetBytes(pdf_data_, CFRangeMake(0, dst_buffer_size), |
| 281 | static_cast<UInt8*>(dst_buffer)); |
| 282 | return true; |
| 283 | } |
| 284 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 285 | CGContextRef PdfMetafileCg::context() const { |
[email protected] | 8f17cd3e | 2011-03-16 01:39:42 | [diff] [blame] | 286 | return context_.get(); |
| 287 | } |
| 288 | |
[email protected] | 9b61753 | 2011-04-04 23:15:06 | [diff] [blame] | 289 | CGPDFDocumentRef PdfMetafileCg::GetPDFDocument() const { |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 290 | // Make sure that we have data, and that it's not being modified any more. |
| 291 | DCHECK(pdf_data_.get()); |
| 292 | DCHECK(!context_.get()); |
| 293 | |
| 294 | if (!pdf_doc_.get()) { |
[email protected] | df0ca6c8 | 2010-10-17 04:09:06 | [diff] [blame] | 295 | ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider( |
[email protected] | 72f966b | 2009-10-14 20:02:27 | [diff] [blame] | 296 | CGDataProviderCreateWithCFData(pdf_data_)); |
| 297 | pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider)); |
| 298 | } |
| 299 | return pdf_doc_.get(); |
| 300 | } |
| 301 | |
[email protected] | 14b21079 | 2009-10-12 18:45:31 | [diff] [blame] | 302 | } // namespace printing |