| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef CC_LAYERS_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_LAYERS_SCROLLBAR_LAYER_H_ |
| 6 #define CC_LAYERS_SCROLLBAR_LAYER_H_ | 6 #define CC_LAYERS_SCROLLBAR_LAYER_H_ |
| 7 | 7 |
| 8 #include "cc/base/cc_export.h" | 8 #include "cc/base/cc_export.h" |
| 9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
| 10 #include "cc/layers/contents_scaling_layer.h" | 10 #include "cc/layers/contents_scaling_layer.h" |
| 11 #include "cc/layers/scrollbar_theme_painter.h" | 11 #include "cc/layers/scrollbar_theme_painter.h" |
| 12 #include "cc/resources/layer_updater.h" | 12 #include "cc/resources/layer_updater.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 class CachingBitmapContentLayerUpdater; | 15 class CachingBitmapContentLayerUpdater; |
| 16 class ResourceUpdateQueue; | 16 class ResourceUpdateQueue; |
| 17 class ScrollbarThemeComposite; | 17 class ScrollbarThemeComposite; |
| 18 | 18 |
| 19 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer { | 19 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer { |
| 20 public: | 20 public: |
| 21 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 21 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
| 22 OVERRIDE; | 22 OVERRIDE; |
| 23 | 23 |
| 24 static scoped_refptr<ScrollbarLayer> Create( | 24 static scoped_refptr<ScrollbarLayer> Create( |
| 25 scoped_ptr<Scrollbar> scrollbar, | 25 scoped_ptr<Scrollbar> scrollbar, |
| 26 int scroll_layer_id); | 26 int scroll_layer_id, |
| 27 bool is_solid_color); |
| 27 | 28 |
| 28 int scroll_layer_id() const { return scroll_layer_id_; } | 29 int scroll_layer_id() const { return scroll_layer_id_; } |
| 29 void SetScrollLayerId(int id); | 30 void SetScrollLayerId(int id); |
| 30 | 31 |
| 31 virtual bool OpacityCanAnimateOnImplThread() const OVERRIDE; | 32 virtual bool OpacityCanAnimateOnImplThread() const OVERRIDE; |
| 32 | 33 |
| 33 ScrollbarOrientation Orientation() const; | 34 ScrollbarOrientation Orientation() const; |
| 35 bool IsSolidColor() const; |
| 34 | 36 |
| 35 // Layer interface | 37 // Layer interface |
| 36 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) | 38 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc) |
| 37 OVERRIDE; | 39 OVERRIDE; |
| 38 virtual void Update(ResourceUpdateQueue* queue, | 40 virtual void Update(ResourceUpdateQueue* queue, |
| 39 const OcclusionTracker* occlusion, | 41 const OcclusionTracker* occlusion, |
| 40 RenderingStats* stats) OVERRIDE; | 42 RenderingStats* stats) OVERRIDE; |
| 41 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; | 43 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; |
| 42 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 44 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 43 virtual void CalculateContentsScale(float ideal_contents_scale, | 45 virtual void CalculateContentsScale(float ideal_contents_scale, |
| 44 float device_scale_factor, | 46 float device_scale_factor, |
| 45 float page_scale_factor, | 47 float page_scale_factor, |
| 46 bool animating_transform_to_screen, | 48 bool animating_transform_to_screen, |
| 47 float* contents_scale_x, | 49 float* contents_scale_x, |
| 48 float* contents_scale_y, | 50 float* contents_scale_y, |
| 49 gfx::Size* content_bounds) OVERRIDE; | 51 gfx::Size* content_bounds) OVERRIDE; |
| 50 | 52 |
| 51 virtual ScrollbarLayer* ToScrollbarLayer() OVERRIDE; | 53 virtual ScrollbarLayer* ToScrollbarLayer() OVERRIDE; |
| 52 | 54 |
| 53 protected: | 55 protected: |
| 54 ScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, | 56 ScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, |
| 55 int scroll_layer_id); | 57 int scroll_layer_id, |
| 58 bool is_solid_color); |
| 56 virtual ~ScrollbarLayer(); | 59 virtual ~ScrollbarLayer(); |
| 57 | 60 |
| 58 private: | 61 private: |
| 59 void UpdatePart(CachingBitmapContentLayerUpdater* painter, | 62 void UpdatePart(CachingBitmapContentLayerUpdater* painter, |
| 60 LayerUpdater::Resource* resource, | 63 LayerUpdater::Resource* resource, |
| 61 gfx::Rect rect, | 64 gfx::Rect rect, |
| 62 ResourceUpdateQueue* queue, | 65 ResourceUpdateQueue* queue, |
| 63 RenderingStats* stats); | 66 RenderingStats* stats); |
| 64 void CreateUpdaterIfNeeded(); | 67 void CreateUpdaterIfNeeded(); |
| 65 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; | 68 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; |
| 66 gfx::Rect OriginThumbRect() const; | 69 gfx::Rect OriginThumbRect() const; |
| 67 | 70 |
| 68 bool is_dirty() const { return !dirty_rect_.IsEmpty(); } | 71 bool is_dirty() const { return !dirty_rect_.IsEmpty(); } |
| 69 | 72 |
| 70 int MaxTextureSize(); | 73 int MaxTextureSize(); |
| 71 float ClampScaleToMaxTextureSize(float scale); | 74 float ClampScaleToMaxTextureSize(float scale); |
| 72 | 75 |
| 73 scoped_ptr<Scrollbar> scrollbar_; | 76 scoped_ptr<Scrollbar> scrollbar_; |
| 74 | 77 |
| 75 int thumb_thickness_; | 78 int thumb_thickness_; |
| 76 int thumb_length_; | 79 int thumb_length_; |
| 77 gfx::Rect track_rect_; | 80 gfx::Rect track_rect_; |
| 78 int scroll_layer_id_; | 81 int scroll_layer_id_; |
| 82 bool is_solid_color_; |
| 79 | 83 |
| 80 unsigned texture_format_; | 84 unsigned texture_format_; |
| 81 | 85 |
| 82 gfx::RectF dirty_rect_; | 86 gfx::RectF dirty_rect_; |
| 83 | 87 |
| 84 scoped_refptr<CachingBitmapContentLayerUpdater> track_updater_; | 88 scoped_refptr<CachingBitmapContentLayerUpdater> track_updater_; |
| 85 scoped_refptr<CachingBitmapContentLayerUpdater> thumb_updater_; | 89 scoped_refptr<CachingBitmapContentLayerUpdater> thumb_updater_; |
| 86 | 90 |
| 87 // All the parts of the scrollbar except the thumb | 91 // All the parts of the scrollbar except the thumb |
| 88 scoped_ptr<LayerUpdater::Resource> track_; | 92 scoped_ptr<LayerUpdater::Resource> track_; |
| 89 scoped_ptr<LayerUpdater::Resource> thumb_; | 93 scoped_ptr<LayerUpdater::Resource> thumb_; |
| 90 | 94 |
| 91 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayer); | 95 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayer); |
| 92 }; | 96 }; |
| 93 | 97 |
| 94 } // namespace cc | 98 } // namespace cc |
| 95 | 99 |
| 96 #endif // CC_LAYERS_SCROLLBAR_LAYER_H_ | 100 #endif // CC_LAYERS_SCROLLBAR_LAYER_H_ |
| OLD | NEW |