| OLD | NEW |
| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "cc/base/scoped_ptr_algorithm.h" | 13 #include "cc/base/scoped_ptr_algorithm.h" |
| 14 #include "cc/layers/content_layer.h" | 14 #include "cc/layers/content_layer.h" |
| 15 #include "cc/layers/delegated_renderer_layer.h" | 15 #include "cc/layers/delegated_renderer_layer.h" |
| 16 #include "cc/layers/solid_color_layer.h" | 16 #include "cc/layers/solid_color_layer.h" |
| 17 #include "cc/layers/texture_layer.h" | 17 #include "cc/layers/texture_layer.h" |
| 18 #include "cc/output/copy_output_request.h" |
| 18 #include "cc/output/delegated_frame_data.h" | 19 #include "cc/output/delegated_frame_data.h" |
| 19 #include "cc/output/filter_operation.h" | 20 #include "cc/output/filter_operation.h" |
| 20 #include "cc/output/filter_operations.h" | 21 #include "cc/output/filter_operations.h" |
| 21 #include "cc/resources/transferable_resource.h" | 22 #include "cc/resources/transferable_resource.h" |
| 22 #include "ui/base/animation/animation.h" | 23 #include "ui/base/animation/animation.h" |
| 23 #include "ui/compositor/compositor_switches.h" | 24 #include "ui/compositor/compositor_switches.h" |
| 24 #include "ui/compositor/dip_util.h" | 25 #include "ui/compositor/dip_util.h" |
| 25 #include "ui/compositor/layer_animator.h" | 26 #include "ui/compositor/layer_animator.h" |
| 26 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/display.h" | 28 #include "ui/gfx/display.h" |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 RecomputePosition(); | 619 RecomputePosition(); |
| 619 SchedulePaint(gfx::Rect(bounds_.size())); | 620 SchedulePaint(gfx::Rect(bounds_.size())); |
| 620 if (delegate_) | 621 if (delegate_) |
| 621 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); | 622 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); |
| 622 for (size_t i = 0; i < children_.size(); ++i) | 623 for (size_t i = 0; i < children_.size(); ++i) |
| 623 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); | 624 children_[i]->OnDeviceScaleFactorChanged(device_scale_factor); |
| 624 if (layer_mask_) | 625 if (layer_mask_) |
| 625 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor); | 626 layer_mask_->OnDeviceScaleFactorChanged(device_scale_factor); |
| 626 } | 627 } |
| 627 | 628 |
| 629 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { |
| 630 cc_layer_->RequestCopyOfOutput(request.Pass()); |
| 631 } |
| 632 |
| 628 void Layer::PaintContents(SkCanvas* sk_canvas, | 633 void Layer::PaintContents(SkCanvas* sk_canvas, |
| 629 gfx::Rect clip, | 634 gfx::Rect clip, |
| 630 gfx::RectF* opaque) { | 635 gfx::RectF* opaque) { |
| 631 TRACE_EVENT0("ui", "Layer::PaintContents"); | 636 TRACE_EVENT0("ui", "Layer::PaintContents"); |
| 632 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( | 637 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( |
| 633 sk_canvas, ui::GetScaleFactorFromScale(device_scale_factor_))); | 638 sk_canvas, ui::GetScaleFactorFromScale(device_scale_factor_))); |
| 634 | 639 |
| 635 bool scale_content = scale_content_; | 640 bool scale_content = scale_content_; |
| 636 if (scale_content) { | 641 if (scale_content) { |
| 637 canvas->Save(); | 642 canvas->Save(); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); | 963 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); |
| 959 } | 964 } |
| 960 | 965 |
| 961 void Layer::RecomputePosition() { | 966 void Layer::RecomputePosition() { |
| 962 cc_layer_->SetPosition(gfx::ScalePoint( | 967 cc_layer_->SetPosition(gfx::ScalePoint( |
| 963 gfx::PointF(bounds_.x(), bounds_.y()), | 968 gfx::PointF(bounds_.x(), bounds_.y()), |
| 964 device_scale_factor_)); | 969 device_scale_factor_)); |
| 965 } | 970 } |
| 966 | 971 |
| 967 } // namespace ui | 972 } // namespace ui |
| OLD | NEW |