OLD | NEW |
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 #include "printing/pdf_ps_metafile_cairo.h" | 5 #include "printing/pdf_ps_metafile_cairo.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <cairo.h> | 9 #include <cairo.h> |
10 #include <cairo-pdf.h> | 10 #include <cairo-pdf.h> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // raw_override_data_ | 138 // raw_override_data_ |
139 if (src_buffer == NULL || src_buffer_size == 0) | 139 if (src_buffer == NULL || src_buffer_size == 0) |
140 return false; | 140 return false; |
141 | 141 |
142 raw_override_data_ = std::string(reinterpret_cast<const char*>(src_buffer), | 142 raw_override_data_ = std::string(reinterpret_cast<const char*>(src_buffer), |
143 src_buffer_size); | 143 src_buffer_size); |
144 | 144 |
145 return true; | 145 return true; |
146 } | 146 } |
147 | 147 |
| 148 skia::PlatformDevice* PdfPsMetafile::StartPageForVectorCanvas( |
| 149 const gfx::Size& page_size, const gfx::Point& content_origin, |
| 150 const float& scale_factor) { |
| 151 if (!StartPage(page_size, content_origin, scale_factor)) |
| 152 return NULL; |
| 153 |
| 154 return skia::VectorPlatformDeviceFactory::CreateDevice(context_, |
| 155 page_size.width(), |
| 156 page_size.height(), |
| 157 true); |
| 158 } |
| 159 |
148 bool PdfPsMetafile::StartPage(const gfx::Size& page_size, | 160 bool PdfPsMetafile::StartPage(const gfx::Size& page_size, |
149 const gfx::Point& content_origin, | 161 const gfx::Point& content_origin, |
150 const float& scale_factor) { | 162 const float& scale_factor) { |
151 DCHECK(IsSurfaceValid(surface_)); | 163 DCHECK(IsSurfaceValid(surface_)); |
152 DCHECK(IsContextValid(context_)); | 164 DCHECK(IsContextValid(context_)); |
153 // Passing this check implies page_surface_ is NULL, and current_page_ is | 165 // Passing this check implies page_surface_ is NULL, and current_page_ is |
154 // empty. | 166 // empty. |
155 DCHECK_GT(page_size.width(), 0); | 167 DCHECK_GT(page_size.width(), 0); |
156 DCHECK_GT(page_size.height(), 0); | 168 DCHECK_GT(page_size.height(), 0); |
157 // |scale_factor| is not supported yet. | 169 // |scale_factor| is not supported yet. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 288 } |
277 | 289 |
278 void PdfPsMetafile::CleanUpAll() { | 290 void PdfPsMetafile::CleanUpAll() { |
279 CleanUpContext(&context_); | 291 CleanUpContext(&context_); |
280 CleanUpSurface(&surface_); | 292 CleanUpSurface(&surface_); |
281 data_.clear(); | 293 data_.clear(); |
282 skia::VectorPlatformDevice::ClearFontCache(); | 294 skia::VectorPlatformDevice::ClearFontCache(); |
283 } | 295 } |
284 | 296 |
285 } // namespace printing | 297 } // namespace printing |
OLD | NEW |