Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: printing/pdf_ps_metafile_cairo.cc

Issue 6665046: Unfork VectorPlatformCanvas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // raw_override_data_ 137 // raw_override_data_
138 if (src_buffer == NULL || src_buffer_size == 0) 138 if (src_buffer == NULL || src_buffer_size == 0)
139 return false; 139 return false;
140 140
141 raw_override_data_ = std::string(reinterpret_cast<const char*>(src_buffer), 141 raw_override_data_ = std::string(reinterpret_cast<const char*>(src_buffer),
142 src_buffer_size); 142 src_buffer_size);
143 143
144 return true; 144 return true;
145 } 145 }
146 146
147 skia::PlatformDevice* PdfPsMetafile::StartPageForVectorCanvas(
148 const gfx::Size& page_size, const gfx::Point& content_origin,
149 const float& scale_factor) {
150 DCHECK_EQ(1.0f, scale_factor); // We don't yet support scale_factor.
151 if (!StartPage(page_size, content_origin.y(), content_origin.x()))
152 return NULL;
153
154 return skia::VectorPlatformDeviceFactory::CreateDevice(context_,
155 page_size.width(),
156 page_size.height(),
157 true);
158 }
159
147 cairo_t* PdfPsMetafile::StartPage(const gfx::Size& page_size, 160 cairo_t* PdfPsMetafile::StartPage(const gfx::Size& page_size,
148 double margin_top_in_points, 161 double margin_top_in_points,
149 double margin_left_in_points) { 162 double margin_left_in_points) {
150 DCHECK(IsSurfaceValid(surface_)); 163 DCHECK(IsSurfaceValid(surface_));
151 DCHECK(IsContextValid(context_)); 164 DCHECK(IsContextValid(context_));
152 // 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
153 // empty. 166 // empty.
154 DCHECK_GT(page_size.width(), 0); 167 DCHECK_GT(page_size.width(), 0);
155 DCHECK_GT(page_size.height(), 0); 168 DCHECK_GT(page_size.height(), 0);
156 169
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 286 }
274 287
275 void PdfPsMetafile::CleanUpAll() { 288 void PdfPsMetafile::CleanUpAll() {
276 CleanUpContext(&context_); 289 CleanUpContext(&context_);
277 CleanUpSurface(&surface_); 290 CleanUpSurface(&surface_);
278 data_.clear(); 291 data_.clear();
279 skia::VectorPlatformDevice::ClearFontCache(); 292 skia::VectorPlatformDevice::ClearFontCache();
280 } 293 }
281 294
282 } // namespace printing 295 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698