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

Side by Side Diff: ui/compositor/layer.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear Created 7 years, 3 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { 631 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) {
632 cc_layer_->RequestCopyOfOutput(request.Pass()); 632 cc_layer_->RequestCopyOfOutput(request.Pass());
633 } 633 }
634 634
635 void Layer::PaintContents(SkCanvas* sk_canvas, 635 void Layer::PaintContents(SkCanvas* sk_canvas,
636 gfx::Rect clip, 636 gfx::Rect clip,
637 gfx::RectF* opaque) { 637 gfx::RectF* opaque) {
638 TRACE_EVENT0("ui", "Layer::PaintContents"); 638 TRACE_EVENT0("ui", "Layer::PaintContents");
639 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( 639 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling(
640 sk_canvas, ui::GetScaleFactorFromScale(device_scale_factor_))); 640 sk_canvas, device_scale_factor_));
641 641
642 bool scale_content = scale_content_; 642 bool scale_content = scale_content_;
643 if (scale_content) { 643 if (scale_content) {
644 canvas->Save(); 644 canvas->Save();
645 canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_), 645 canvas->sk_canvas()->scale(SkFloatToScalar(device_scale_factor_),
646 SkFloatToScalar(device_scale_factor_)); 646 SkFloatToScalar(device_scale_factor_));
647 } 647 }
648 648
649 if (delegate_) 649 if (delegate_)
650 delegate_->OnPaintLayer(canvas.get()); 650 delegate_->OnPaintLayer(canvas.get());
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); 971 cc_layer_->SetBounds(ConvertSizeToPixel(this, size));
972 } 972 }
973 973
974 void Layer::RecomputePosition() { 974 void Layer::RecomputePosition() {
975 cc_layer_->SetPosition(gfx::ScalePoint( 975 cc_layer_->SetPosition(gfx::ScalePoint(
976 gfx::PointF(bounds_.x(), bounds_.y()), 976 gfx::PointF(bounds_.x(), bounds_.y()),
977 device_scale_factor_)); 977 device_scale_factor_));
978 } 978 }
979 979
980 } // namespace ui 980 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698