| 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 return make_scoped_ptr(new SolidColorScrollbarLayerImpl( | 19 bool is_overlay) { |
| 20 tree_impl, id, orientation, thumb_thickness, | 20 return make_scoped_ptr( |
| 21 is_left_side_vertical_scrollbar)); | 21 new SolidColorScrollbarLayerImpl(tree_impl, |
| 22 id, |
| 23 orientation, |
| 24 thumb_thickness, |
| 25 is_left_side_vertical_scrollbar, |
| 26 is_overlay)); |
| 22 } | 27 } |
| 23 | 28 |
| 24 SolidColorScrollbarLayerImpl::~SolidColorScrollbarLayerImpl() {} | 29 SolidColorScrollbarLayerImpl::~SolidColorScrollbarLayerImpl() {} |
| 25 | 30 |
| 26 scoped_ptr<LayerImpl> SolidColorScrollbarLayerImpl::CreateLayerImpl( | 31 scoped_ptr<LayerImpl> SolidColorScrollbarLayerImpl::CreateLayerImpl( |
| 27 LayerTreeImpl* tree_impl) { | 32 LayerTreeImpl* tree_impl) { |
| 28 return SolidColorScrollbarLayerImpl::Create( | 33 return SolidColorScrollbarLayerImpl::Create(tree_impl, |
| 29 tree_impl, id(), orientation(), thumb_thickness_, | 34 id(), |
| 30 is_left_side_vertical_scrollbar()).PassAs<LayerImpl>(); | 35 orientation(), |
| 36 thumb_thickness_, |
| 37 is_left_side_vertical_scrollbar(), |
| 38 is_overlay_scrollbar()) |
| 39 .PassAs<LayerImpl>(); |
| 31 } | 40 } |
| 32 | 41 |
| 33 SolidColorScrollbarLayerImpl::SolidColorScrollbarLayerImpl( | 42 SolidColorScrollbarLayerImpl::SolidColorScrollbarLayerImpl( |
| 34 LayerTreeImpl* tree_impl, | 43 LayerTreeImpl* tree_impl, |
| 35 int id, | 44 int id, |
| 36 ScrollbarOrientation orientation, | 45 ScrollbarOrientation orientation, |
| 37 int thumb_thickness, | 46 int thumb_thickness, |
| 38 bool is_left_side_vertical_scrollbar) | 47 bool is_left_side_vertical_scrollbar, |
| 39 : ScrollbarLayerImplBase(tree_impl, id, orientation, | 48 bool is_overlay) |
| 40 is_left_side_vertical_scrollbar), | 49 : ScrollbarLayerImplBase(tree_impl, |
| 50 id, |
| 51 orientation, |
| 52 is_left_side_vertical_scrollbar, |
| 53 is_overlay), |
| 41 thumb_thickness_(thumb_thickness), | 54 thumb_thickness_(thumb_thickness), |
| 42 color_(tree_impl->settings().solid_color_scrollbar_color) {} | 55 color_(tree_impl->settings().solid_color_scrollbar_color) {} |
| 43 | 56 |
| 44 void SolidColorScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { | 57 void SolidColorScrollbarLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 45 ScrollbarLayerImplBase::PushPropertiesTo(layer); | 58 ScrollbarLayerImplBase::PushPropertiesTo(layer); |
| 46 } | 59 } |
| 47 | 60 |
| 48 int SolidColorScrollbarLayerImpl::ThumbThickness() const { | 61 int SolidColorScrollbarLayerImpl::ThumbThickness() const { |
| 49 if (thumb_thickness_ != -1) | 62 if (thumb_thickness_ != -1) |
| 50 return thumb_thickness_; | 63 return thumb_thickness_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 SharedQuadState* shared_quad_state = | 96 SharedQuadState* shared_quad_state = |
| 84 quad_sink->UseSharedQuadState(CreateSharedQuadState()); | 97 quad_sink->UseSharedQuadState(CreateSharedQuadState()); |
| 85 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); | 98 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); |
| 86 | 99 |
| 87 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); | 100 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
| 88 quad->SetNew(shared_quad_state, thumb_quad_rect, color_, false); | 101 quad->SetNew(shared_quad_state, thumb_quad_rect, color_, false); |
| 89 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); | 102 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); |
| 90 } | 103 } |
| 91 | 104 |
| 92 } // namespace cc | 105 } // namespace cc |
| OLD | NEW |