OLD | NEW |
1 // Copyright (c) 2009 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 #include "printing/pdf_metafile_mac.h" | 5 #include "printing/pdf_metafile_mac.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, src_buffer_size)); | 58 pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, src_buffer_size)); |
59 CFDataAppendBytes(pdf_data_, static_cast<const UInt8*>(src_buffer), | 59 CFDataAppendBytes(pdf_data_, static_cast<const UInt8*>(src_buffer), |
60 src_buffer_size); | 60 src_buffer_size); |
61 | 61 |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
| 65 skia::PlatformDevice* PdfMetafile::StartPageForVectorCanvas( |
| 66 const gfx::Size& page_size, const gfx::Point& content_origin, |
| 67 const float& scale_factor) { |
| 68 NOTIMPLEMENTED(); |
| 69 return NULL; |
| 70 } |
| 71 |
65 CGContextRef PdfMetafile::StartPage(const gfx::Size& page_size, | 72 CGContextRef PdfMetafile::StartPage(const gfx::Size& page_size, |
66 const gfx::Point& content_origin, const float& scale_factor) { | 73 const gfx::Point& content_origin, const float& scale_factor) { |
67 DCHECK(context_.get()); | 74 DCHECK(context_.get()); |
68 DCHECK(!page_is_open_); | 75 DCHECK(!page_is_open_); |
69 | 76 |
70 double height = page_size.height(); | 77 double height = page_size.height(); |
71 double width = page_size.width(); | 78 double width = page_size.width(); |
72 | 79 |
73 CGRect bounds = CGRectMake(0, 0, width, height); | 80 CGRect bounds = CGRectMake(0, 0, width, height); |
74 CGContextBeginPage(context_, &bounds); | 81 CGContextBeginPage(context_, &bounds); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 244 |
238 if (!pdf_doc_.get()) { | 245 if (!pdf_doc_.get()) { |
239 ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider( | 246 ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider( |
240 CGDataProviderCreateWithCFData(pdf_data_)); | 247 CGDataProviderCreateWithCFData(pdf_data_)); |
241 pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider)); | 248 pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider)); |
242 } | 249 } |
243 return pdf_doc_.get(); | 250 return pdf_doc_.get(); |
244 } | 251 } |
245 | 252 |
246 } // namespace printing | 253 } // namespace printing |
OLD | NEW |