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 "base/basictypes.h" | 10 #include "base/basictypes.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, |
34 scoped_ptr<Scrollbar> scrollbar, | 35 scoped_ptr<Scrollbar> scrollbar, |
35 int scroll_layer_id) { | 36 int scroll_layer_id) { |
36 return make_scoped_refptr( | 37 return make_scoped_refptr( |
37 new PaintedScrollbarLayer(scrollbar.Pass(), scroll_layer_id)); | 38 new PaintedScrollbarLayer(settings, scrollbar.Pass(), scroll_layer_id)); |
38 } | 39 } |
39 | 40 |
40 PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, | 41 PaintedScrollbarLayer::PaintedScrollbarLayer(const LayerSettings& settings, |
| 42 scoped_ptr<Scrollbar> scrollbar, |
41 int scroll_layer_id) | 43 int scroll_layer_id) |
42 : scrollbar_(scrollbar.Pass()), | 44 : Layer(settings), |
| 45 scrollbar_(scrollbar.Pass()), |
43 scroll_layer_id_(scroll_layer_id), | 46 scroll_layer_id_(scroll_layer_id), |
44 clip_layer_id_(Layer::INVALID_ID), | 47 clip_layer_id_(Layer::INVALID_ID), |
45 internal_contents_scale_(0.f), | 48 internal_contents_scale_(0.f), |
46 thumb_thickness_(scrollbar_->ThumbThickness()), | 49 thumb_thickness_(scrollbar_->ThumbThickness()), |
47 thumb_length_(scrollbar_->ThumbLength()), | 50 thumb_length_(scrollbar_->ThumbLength()), |
48 is_overlay_(scrollbar_->IsOverlay()), | 51 is_overlay_(scrollbar_->IsOverlay()), |
49 has_thumb_(scrollbar_->HasThumb()) { | 52 has_thumb_(scrollbar_->HasThumb()) { |
50 if (!scrollbar_->IsOverlay()) | 53 if (!scrollbar_->IsOverlay()) |
51 SetShouldScrollOnMainThread(true); | 54 SetShouldScrollOnMainThread(true); |
52 } | 55 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 307 |
305 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 308 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
306 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 309 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
307 // allocation and copying. | 310 // allocation and copying. |
308 skbitmap.setImmutable(); | 311 skbitmap.setImmutable(); |
309 | 312 |
310 return UIResourceBitmap(skbitmap); | 313 return UIResourceBitmap(skbitmap); |
311 } | 314 } |
312 | 315 |
313 } // namespace cc | 316 } // namespace cc |
OLD | NEW |