| 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 | |
| 160 bool PdfPsMetafile::StartPage(const gfx::Size& page_size, | 148 bool PdfPsMetafile::StartPage(const gfx::Size& page_size, |
| 161 const gfx::Point& content_origin, | 149 const gfx::Point& content_origin, |
| 162 const float& scale_factor) { | 150 const float& scale_factor) { |
| 163 DCHECK(IsSurfaceValid(surface_)); | 151 DCHECK(IsSurfaceValid(surface_)); |
| 164 DCHECK(IsContextValid(context_)); | 152 DCHECK(IsContextValid(context_)); |
| 165 // Passing this check implies page_surface_ is NULL, and current_page_ is | 153 // Passing this check implies page_surface_ is NULL, and current_page_ is |
| 166 // empty. | 154 // empty. |
| 167 DCHECK_GT(page_size.width(), 0); | 155 DCHECK_GT(page_size.width(), 0); |
| 168 DCHECK_GT(page_size.height(), 0); | 156 DCHECK_GT(page_size.height(), 0); |
| 169 // |scale_factor| is not supported yet. | 157 // |scale_factor| is not supported yet. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 276 } |
| 289 | 277 |
| 290 void PdfPsMetafile::CleanUpAll() { | 278 void PdfPsMetafile::CleanUpAll() { |
| 291 CleanUpContext(&context_); | 279 CleanUpContext(&context_); |
| 292 CleanUpSurface(&surface_); | 280 CleanUpSurface(&surface_); |
| 293 data_.clear(); | 281 data_.clear(); |
| 294 skia::VectorPlatformDevice::ClearFontCache(); | 282 skia::VectorPlatformDevice::ClearFontCache(); |
| 295 } | 283 } |
| 296 | 284 |
| 297 } // namespace printing | 285 } // namespace printing |
| OLD | NEW |