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

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

Issue 6879098: Fix print preview clipping issues due to scaling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 "chrome/common/print_messages.h" 10 #include "chrome/common/print_messages.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 &margin_top_in_points, 208 &margin_top_in_points,
209 &margin_right_in_points, 209 &margin_right_in_points,
210 &margin_bottom_in_points, 210 &margin_bottom_in_points,
211 &margin_left_in_points); 211 &margin_left_in_points);
212 212
213 gfx::Size page_size( 213 gfx::Size page_size(
214 content_width_in_points + margin_right_in_points + 214 content_width_in_points + margin_right_in_points +
215 margin_left_in_points, 215 margin_left_in_points,
216 content_height_in_points + margin_top_in_points + 216 content_height_in_points + margin_top_in_points +
217 margin_bottom_in_points); 217 margin_bottom_in_points);
218 gfx::Point content_origin(margin_left_in_points, margin_top_in_points); 218 gfx::Rect content_area(margin_left_in_points, margin_top_in_points,
219 content_width_in_points, content_height_in_points);
219 220
220 skia::PlatformDevice* device = metafile->StartPageForVectorCanvas( 221 skia::PlatformDevice* device = metafile->StartPageForVectorCanvas(
221 page_size, content_origin, 1.0f); 222 page_size, content_area, 1.0f);
222 if (!device) 223 if (!device)
223 return; 224 return;
224 225
225 canvas->reset(new skia::VectorCanvas(device)); 226 canvas->reset(new skia::VectorCanvas(device));
226 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas->get(), metafile); 227 printing::MetafileSkiaWrapper::SetMetafileOnCanvas(canvas->get(), metafile);
227 frame->printPage(params.page_number, canvas->get()); 228 frame->printPage(params.page_number, canvas->get());
228 229
229 // TODO(myhuang): We should handle transformation for paper margins. 230 // TODO(myhuang): We should handle transformation for paper margins.
230 // TODO(myhuang): We should render the header and the footer. 231 // TODO(myhuang): We should render the header and the footer.
231 232
232 // Done printing. Close the device context to retrieve the compiled metafile. 233 // Done printing. Close the device context to retrieve the compiled metafile.
233 if (!metafile->FinishPage()) 234 if (!metafile->FinishPage())
234 NOTREACHED() << "metafile failed"; 235 NOTREACHED() << "metafile failed";
235 } 236 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/print_web_view_helper_win.cc » ('j') | printing/pdf_metafile_skia.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698