| 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/quad_sink.h" | 5 #include "cc/layers/quad_sink.h" |
| 6 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 6 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 7 #include "cc/quads/solid_color_draw_quad.h" | 7 #include "cc/quads/solid_color_draw_quad.h" |
| 8 #include "cc/trees/layer_tree_impl.h" | 8 #include "cc/trees/layer_tree_impl.h" |
| 9 #include "cc/trees/layer_tree_settings.h" | 9 #include "cc/trees/layer_tree_settings.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 scoped_ptr<SolidColorScrollbarLayerImpl> SolidColorScrollbarLayerImpl::Create( | 13 scoped_ptr<SolidColorScrollbarLayerImpl> SolidColorScrollbarLayerImpl::Create( |
| 14 LayerTreeImpl* tree_impl, | 14 LayerTreeImpl* tree_impl, |
| 15 int id, | 15 int id, |
| 16 ScrollbarOrientation orientation, | 16 ScrollbarOrientation orientation, |
| 17 int thumb_thickness, | 17 int thumb_thickness, |
| 18 bool is_left_side_vertical_scrollbar, | 18 bool is_left_side_vertical_scrollbar) { |
| 19 bool is_overlay) { | |
| 20 return make_scoped_ptr(new SolidColorScrollbarLayerImpl( | 19 return make_scoped_ptr(new SolidColorScrollbarLayerImpl( |
| 21 tree_impl, id, orientation, thumb_thickness, | 20 tree_impl, id, orientation, thumb_thickness, |
| 22 is_left_side_vertical_scrollbar, is_overlay)); | 21 is_left_side_vertical_scrollbar)); |
| 23 } | 22 } |
| 24 | 23 |
| 25 SolidColorScrollbarLayerImpl::~SolidColorScrollbarLayerImpl() {} | 24 SolidColorScrollbarLayerImpl::~SolidColorScrollbarLayerImpl() {} |
| 26 | 25 |
| 27 scoped_ptr<LayerImpl> SolidColorScrollbarLayerImpl::CreateLayerImpl( | 26 scoped_ptr<LayerImpl> SolidColorScrollbarLayerImpl::CreateLayerImpl( |
| 28 LayerTreeImpl* tree_impl) { | 27 LayerTreeImpl* tree_impl) { |
| 29 return SolidColorScrollbarLayerImpl::Create(tree_impl, | 28 return SolidColorScrollbarLayerImpl::Create( |
| 30 id(), | 29 tree_impl, id(), orientation(), thumb_thickness_, |
| 31 orientation(), | 30 is_left_side_vertical_scrollbar()).PassAs<LayerImpl>(); |
| 32 thumb_thickness_, | |
| 33 is_left_side_vertical_scrollbar(), | |
| 34 is_overlay_scrollbar()) | |
| 35 .PassAs<LayerImpl>(); | |
| 36 } | 31 } |
| 37 | 32 |
| 38 SolidColorScrollbarLayerImpl::SolidColorScrollbarLayerImpl( | 33 SolidColorScrollbarLayerImpl::SolidColorScrollbarLayerImpl( |
| 39 LayerTreeImpl* tree_impl, | 34 LayerTreeImpl* tree_impl, |
| 40 int id, | 35 int id, |
| 41 ScrollbarOrientation orientation, | 36 ScrollbarOrientation orientation, |
| 42 int thumb_thickness, | 37 int thumb_thickness, |
| 43 bool is_left_side_vertical_scrollbar, | 38 bool is_left_side_vertical_scrollbar) |
| 44 bool is_overlay) | |
| 45 : ScrollbarLayerImplBase(tree_impl, id, orientation, | 39 : ScrollbarLayerImplBase(tree_impl, id, orientation, |
| 46 is_left_side_vertical_scrollbar, is_overlay), | 40 is_left_side_vertical_scrollbar), |
| 47 thumb_thickness_(thumb_thickness), | 41 thumb_thickness_(thumb_thickness), |
| 48 color_(tree_impl->settings().solid_color_scrollbar_color) {} | 42 color_(tree_impl->settings().solid_color_scrollbar_color) {} |
| 49 | 43 |
| 50 void SolidColorScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { | 44 void SolidColorScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 51 ScrollbarLayerImplBase::PushPropertiesTo(layer); | 45 ScrollbarLayerImplBase::PushPropertiesTo(layer); |
| 52 } | 46 } |
| 53 | 47 |
| 54 int SolidColorScrollbarLayerImpl::ThumbThickness() const { | 48 int SolidColorScrollbarLayerImpl::ThumbThickness() const { |
| 55 if (thumb_thickness_ != -1) | 49 if (thumb_thickness_ != -1) |
| 56 return thumb_thickness_; | 50 return thumb_thickness_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 SharedQuadState* shared_quad_state = | 83 SharedQuadState* shared_quad_state = |
| 90 quad_sink->UseSharedQuadState(CreateSharedQuadState()); | 84 quad_sink->UseSharedQuadState(CreateSharedQuadState()); |
| 91 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); | 85 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); |
| 92 | 86 |
| 93 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); | 87 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
| 94 quad->SetNew(shared_quad_state, thumb_quad_rect, color_, false); | 88 quad->SetNew(shared_quad_state, thumb_quad_rect, color_, false); |
| 95 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); | 89 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); |
| 96 } | 90 } |
| 97 | 91 |
| 98 } // namespace cc | 92 } // namespace cc |
| OLD | NEW |