OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/layers/solid_color_scrollbar_layer.h" |
| 6 |
| 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "cc/layers/layer_impl.h" |
| 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 10 |
| 11 namespace cc { |
| 12 |
| 13 scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl( |
| 14 LayerTreeImpl* tree_impl) { |
| 15 return SolidColorScrollbarLayerImpl::Create( |
| 16 tree_impl, id(), orientation(), thumb_thickness_, color_) |
| 17 .PassAs<LayerImpl>(); |
| 18 } |
| 19 |
| 20 scoped_refptr<SolidColorScrollbarLayer> SolidColorScrollbarLayer::Create( |
| 21 ScrollbarOrientation orientation, |
| 22 int thumb_thickness, |
| 23 SkColor color, |
| 24 int scroll_layer_id) { |
| 25 return make_scoped_refptr(new SolidColorScrollbarLayer(orientation, |
| 26 thumb_thickness, |
| 27 color, |
| 28 scroll_layer_id)); |
| 29 } |
| 30 |
| 31 SolidColorScrollbarLayer::SolidColorScrollbarLayer( |
| 32 ScrollbarOrientation orientation, |
| 33 int thumb_thickness, |
| 34 SkColor color, |
| 35 int scroll_layer_id) |
| 36 : scroll_layer_id_(scroll_layer_id), |
| 37 orientation_(orientation), |
| 38 thumb_thickness_(thumb_thickness), |
| 39 color_(color) {} |
| 40 |
| 41 SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {} |
| 42 |
| 43 ScrollbarLayerInterface* SolidColorScrollbarLayer::ToScrollbarLayer() { |
| 44 return this; |
| 45 } |
| 46 |
| 47 bool SolidColorScrollbarLayer::OpacityCanAnimateOnImplThread() const { |
| 48 return true; |
| 49 } |
| 50 |
| 51 int SolidColorScrollbarLayer::scroll_layer_id() const { |
| 52 return scroll_layer_id_; |
| 53 } |
| 54 |
| 55 void SolidColorScrollbarLayer::SetScrollLayerId(int id) { |
| 56 if (id == scroll_layer_id_) |
| 57 return; |
| 58 |
| 59 scroll_layer_id_ = id; |
| 60 SetNeedsFullTreeSync(); |
| 61 } |
| 62 |
| 63 ScrollbarOrientation SolidColorScrollbarLayer::orientation() const { |
| 64 return orientation_; |
| 65 } |
| 66 |
| 67 } // namespace cc |
OLD | NEW |