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

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

Issue 10790128: Revert 147915 - Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 paint->SetFontSize(printing::kSettingHeaderFooterFontSize / 446 paint->SetFontSize(printing::kSettingHeaderFooterFontSize /
447 webkit_scale_factor); 447 webkit_scale_factor);
448 gfx::Size size(paint->GetStringSize()); 448 gfx::Size size(paint->GetStringSize());
449 gfx::Rect rect(point.x(), point.y() - paint->GetBaseline(), 449 gfx::Rect rect(point.x(), point.y() - paint->GetBaseline(),
450 size.width(), size.height()); 450 size.width(), size.height());
451 paint->SetDisplayRect(rect); 451 paint->SetDisplayRect(rect);
452 { 452 {
453 SkMatrix m = canvas->getTotalMatrix(); 453 SkMatrix m = canvas->getTotalMatrix();
454 ui::ScaleFactor device_scale_factor = ui::GetScaleFactorFromScale( 454 ui::ScaleFactor device_scale_factor = ui::GetScaleFactorFromScale(
455 SkScalarAbs(m.getScaleX())); 455 SkScalarAbs(m.getScaleX()));
456 scoped_ptr<gfx::Canvas> gfx_canvas(gfx::Canvas::CreateCanvasWithoutScaling( 456 gfx::Canvas gfx_canvas(canvas, device_scale_factor, false);
457 canvas, device_scale_factor)); 457 paint->Draw(&gfx_canvas);
458 paint->Draw(gfx_canvas.get());
459 } 458 }
460 #else 459 #else
461 // TODO(arthurhsu): following code has issues with i18n BiDi, see 460 // TODO(arthurhsu): following code has issues with i18n BiDi, see
462 // crbug.com/108599. 461 // crbug.com/108599.
463 size_t text_byte_length = text.length() * sizeof(char16); 462 size_t text_byte_length = text.length() * sizeof(char16);
464 double text_width_in_points = SkScalarToDouble(paint.measureText( 463 double text_width_in_points = SkScalarToDouble(paint.measureText(
465 text.c_str(), text_byte_length)); 464 text.c_str(), text_byte_length));
466 SkPoint point = GetHeaderFooterPosition(webkit_scale_factor, page_layout, 465 SkPoint point = GetHeaderFooterPosition(webkit_scale_factor, page_layout,
467 horizontal_position, 466 horizontal_position,
468 vertical_position, offset_to_baseline, 467 vertical_position, offset_to_baseline,
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 DCHECK(IsRendering()); 1874 DCHECK(IsRendering());
1876 return prep_frame_view_->GetPrintCanvasSize(); 1875 return prep_frame_view_->GetPrintCanvasSize();
1877 } 1876 }
1878 1877
1879 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { 1878 void PrintWebViewHelper::PrintPreviewContext::ClearContext() {
1880 prep_frame_view_.reset(); 1879 prep_frame_view_.reset();
1881 metafile_.reset(); 1880 metafile_.reset();
1882 pages_to_render_.clear(); 1881 pages_to_render_.clear();
1883 error_ = PREVIEW_ERROR_NONE; 1882 error_ = PREVIEW_ERROR_NONE;
1884 } 1883 }
OLDNEW
« no previous file with comments | « chrome/common/badge_util.cc ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698