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_metafile_cairo_linux.h" | 5 #include "printing/pdf_metafile_cairo_linux.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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 current_data_ = &raw_data_; | 117 current_data_ = &raw_data_; |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 SkDevice* PdfMetafileCairo::StartPageForVectorCanvas( | 121 SkDevice* PdfMetafileCairo::StartPageForVectorCanvas( |
122 const gfx::Size& page_size, const gfx::Rect& content_area, | 122 const gfx::Size& page_size, const gfx::Rect& content_area, |
123 const float& scale_factor) { | 123 const float& scale_factor) { |
124 if (!StartPage(page_size, content_area, scale_factor)) | 124 if (!StartPage(page_size, content_area, scale_factor)) |
125 return NULL; | 125 return NULL; |
126 | 126 |
127 return skia::VectorPlatformDeviceCairoFactory::CreateDevice( | 127 return skia::VectorPlatformDeviceCairo::CreateDevice( |
128 context_, page_size.width(), page_size.height(), true); | 128 context_, page_size.width(), page_size.height(), true); |
129 } | 129 } |
130 | 130 |
131 bool PdfMetafileCairo::StartPage(const gfx::Size& page_size, | 131 bool PdfMetafileCairo::StartPage(const gfx::Size& page_size, |
132 const gfx::Rect& content_area, | 132 const gfx::Rect& content_area, |
133 const float& scale_factor) { | 133 const float& scale_factor) { |
134 DCHECK(IsSurfaceValid(surface_)); | 134 DCHECK(IsSurfaceValid(surface_)); |
135 DCHECK(IsContextValid(context_)); | 135 DCHECK(IsContextValid(context_)); |
136 // Passing this check implies page_surface_ is NULL, and current_page_ is | 136 // Passing this check implies page_surface_ is NULL, and current_page_ is |
137 // empty. | 137 // empty. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 void PdfMetafileCairo::CleanUpAll() { | 251 void PdfMetafileCairo::CleanUpAll() { |
252 CleanUpContext(&context_); | 252 CleanUpContext(&context_); |
253 CleanUpSurface(&surface_); | 253 CleanUpSurface(&surface_); |
254 cairo_data_.clear(); | 254 cairo_data_.clear(); |
255 raw_data_.clear(); | 255 raw_data_.clear(); |
256 skia::VectorPlatformDeviceCairo::ClearFontCache(); | 256 skia::VectorPlatformDeviceCairo::ClearFontCache(); |
257 } | 257 } |
258 | 258 |
259 } // namespace printing | 259 } // namespace printing |
OLD | NEW |