| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/layers/painted_scrollbar_layer.h" | 5 #include "cc/layers/painted_scrollbar_layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace cc { | 25 namespace cc { |
| 26 | 26 |
| 27 scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( | 27 scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( |
| 28 LayerTreeImpl* tree_impl) { | 28 LayerTreeImpl* tree_impl) { |
| 29 return PaintedScrollbarLayerImpl::Create( | 29 return PaintedScrollbarLayerImpl::Create( |
| 30 tree_impl, id(), scrollbar_->Orientation()); | 30 tree_impl, id(), scrollbar_->Orientation()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( | 33 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( |
| 34 const LayerSettings& settings, | |
| 35 scoped_ptr<Scrollbar> scrollbar, | 34 scoped_ptr<Scrollbar> scrollbar, |
| 36 int scroll_layer_id) { | 35 int scroll_layer_id) { |
| 37 return make_scoped_refptr(new PaintedScrollbarLayer( | 36 return make_scoped_refptr( |
| 38 settings, std::move(scrollbar), scroll_layer_id)); | 37 new PaintedScrollbarLayer(std::move(scrollbar), scroll_layer_id)); |
| 39 } | 38 } |
| 40 | 39 |
| 41 PaintedScrollbarLayer::PaintedScrollbarLayer(const LayerSettings& settings, | 40 PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, |
| 42 scoped_ptr<Scrollbar> scrollbar, | |
| 43 int scroll_layer_id) | 41 int scroll_layer_id) |
| 44 : Layer(settings), | 42 : scrollbar_(std::move(scrollbar)), |
| 45 scrollbar_(std::move(scrollbar)), | |
| 46 scroll_layer_id_(scroll_layer_id), | 43 scroll_layer_id_(scroll_layer_id), |
| 47 internal_contents_scale_(1.f), | 44 internal_contents_scale_(1.f), |
| 48 thumb_thickness_(scrollbar_->ThumbThickness()), | 45 thumb_thickness_(scrollbar_->ThumbThickness()), |
| 49 thumb_length_(scrollbar_->ThumbLength()), | 46 thumb_length_(scrollbar_->ThumbLength()), |
| 50 is_overlay_(scrollbar_->IsOverlay()), | 47 is_overlay_(scrollbar_->IsOverlay()), |
| 51 has_thumb_(scrollbar_->HasThumb()), | 48 has_thumb_(scrollbar_->HasThumb()), |
| 52 thumb_opacity_(scrollbar_->ThumbOpacity()) { | 49 thumb_opacity_(scrollbar_->ThumbOpacity()) { |
| 53 if (!scrollbar_->IsOverlay()) | 50 if (!scrollbar_->IsOverlay()) |
| 54 AddMainThreadScrollingReasons( | 51 AddMainThreadScrollingReasons( |
| 55 MainThreadScrollingReason::kScrollbarScrolling); | 52 MainThreadScrollingReason::kScrollbarScrolling); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 300 |
| 304 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 301 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
| 305 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 302 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
| 306 // allocation and copying. | 303 // allocation and copying. |
| 307 skbitmap.setImmutable(); | 304 skbitmap.setImmutable(); |
| 308 | 305 |
| 309 return UIResourceBitmap(skbitmap); | 306 return UIResourceBitmap(skbitmap); |
| 310 } | 307 } |
| 311 | 308 |
| 312 } // namespace cc | 309 } // namespace cc |
| OLD | NEW |