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

Side by Side Diff: chrome/renderer/print_web_view_helper_linux.cc

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing comments. Created 9 years, 7 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 "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include "base/file_descriptor_posix.h" 7 #include "base/file_descriptor_posix.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 &margin_left_in_points); 223 &margin_left_in_points);
224 224
225 gfx::Size page_size( 225 gfx::Size page_size(
226 content_width_in_points + margin_right_in_points + 226 content_width_in_points + margin_right_in_points +
227 margin_left_in_points, 227 margin_left_in_points,
228 content_height_in_points + margin_top_in_points + 228 content_height_in_points + margin_top_in_points +
229 margin_bottom_in_points); 229 margin_bottom_in_points);
230 gfx::Rect content_area(margin_left_in_points, margin_top_in_points, 230 gfx::Rect content_area(margin_left_in_points, margin_top_in_points,
231 content_width_in_points, content_height_in_points); 231 content_width_in_points, content_height_in_points);
232 232
233 skia::PlatformDevice* device = metafile->StartPageForVectorCanvas( 233 SkDevice* device = metafile->StartPageForVectorCanvas(
234 page_size, content_area, 1.0f); 234 page_size, content_area, 1.0f);
235 if (!device) 235 if (!device)
236 return; 236 return;
237 237
238 canvas->reset(new skia::VectorCanvas(device)); 238 canvas->reset(new skia::VectorCanvas(device));
239 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas->get(), metafile); 239 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas->get(), metafile);
240 frame->printPage(params.page_number, canvas->get()); 240 frame->printPage(params.page_number, canvas->get());
241 241
242 // TODO(myhuang): We should handle transformation for paper margins. 242 // TODO(myhuang): We should handle transformation for paper margins.
243 // TODO(myhuang): We should render the header and the footer. 243 // TODO(myhuang): We should render the header and the footer.
244 244
245 // Done printing. Close the device context to retrieve the compiled metafile. 245 // Done printing. Close the device context to retrieve the compiled metafile.
246 if (!metafile->FinishPage()) 246 if (!metafile->FinishPage())
247 NOTREACHED() << "metafile failed"; 247 NOTREACHED() << "metafile failed";
248 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698