Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1411)

Side by Side Diff: cc/layers/scrollbar_layer.h

Issue 21555004: Scrollbar Layer revert (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/resources/scoped_ui_resource.h"
14 13
15 namespace cc { 14 namespace cc {
15 class CachingBitmapContentLayerUpdater;
16 class ResourceUpdateQueue;
16 class ScrollbarThemeComposite; 17 class ScrollbarThemeComposite;
17 18
18 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer { 19 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer {
19 public: 20 public:
20 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) 21 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
21 OVERRIDE; 22 OVERRIDE;
22 23
23 static scoped_refptr<ScrollbarLayer> Create( 24 static scoped_refptr<ScrollbarLayer> Create(
24 scoped_ptr<Scrollbar> scrollbar, 25 scoped_ptr<Scrollbar> scrollbar,
25 int scroll_layer_id); 26 int scroll_layer_id);
26 27
27 int scroll_layer_id() const { return scroll_layer_id_; } 28 int scroll_layer_id() const { return scroll_layer_id_; }
28 void SetScrollLayerId(int id); 29 void SetScrollLayerId(int id);
29 30
30 virtual bool OpacityCanAnimateOnImplThread() const OVERRIDE; 31 virtual bool OpacityCanAnimateOnImplThread() const OVERRIDE;
31 32
32 ScrollbarOrientation Orientation() const; 33 ScrollbarOrientation Orientation() const;
33 34
34 // Layer interface 35 // Layer interface
36 virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
37 OVERRIDE;
35 virtual bool Update(ResourceUpdateQueue* queue, 38 virtual bool Update(ResourceUpdateQueue* queue,
36 const OcclusionTracker* occlusion) OVERRIDE; 39 const OcclusionTracker* occlusion) OVERRIDE;
37 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; 40 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE;
38 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; 41 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
39 virtual void CalculateContentsScale(float ideal_contents_scale, 42 virtual void CalculateContentsScale(float ideal_contents_scale,
40 float device_scale_factor, 43 float device_scale_factor,
41 float page_scale_factor, 44 float page_scale_factor,
42 bool animating_transform_to_screen, 45 bool animating_transform_to_screen,
43 float* contents_scale_x, 46 float* contents_scale_x,
44 float* contents_scale_y, 47 float* contents_scale_y,
45 gfx::Size* content_bounds) OVERRIDE; 48 gfx::Size* content_bounds) OVERRIDE;
46 49
47 virtual ScrollbarLayer* ToScrollbarLayer() OVERRIDE; 50 virtual ScrollbarLayer* ToScrollbarLayer() OVERRIDE;
48 51
49 protected: 52 protected:
50 ScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, 53 ScrollbarLayer(scoped_ptr<Scrollbar> scrollbar,
51 int scroll_layer_id); 54 int scroll_layer_id);
52 virtual ~ScrollbarLayer(); 55 virtual ~ScrollbarLayer();
53 56
54 private: 57 private:
58 bool UpdatePart(CachingBitmapContentLayerUpdater* painter,
59 LayerUpdater::Resource* resource,
60 gfx::Rect rect,
61 ResourceUpdateQueue* queue);
62 void CreateUpdaterIfNeeded();
55 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const; 63 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const;
56 gfx::Rect OriginThumbRect() const; 64 gfx::Rect OriginThumbRect() const;
57 65
66 bool is_dirty() const { return !dirty_rect_.IsEmpty(); }
67
58 int MaxTextureSize(); 68 int MaxTextureSize();
59 float ClampScaleToMaxTextureSize(float scale); 69 float ClampScaleToMaxTextureSize(float scale);
60 70
61 scoped_refptr<UIResourceBitmap> RasterizeTrack();
62 scoped_refptr<UIResourceBitmap> RasterizeThumb();
63
64 scoped_ptr<Scrollbar> scrollbar_; 71 scoped_ptr<Scrollbar> scrollbar_;
65 72
66 int thumb_thickness_; 73 int thumb_thickness_;
67 int thumb_length_; 74 int thumb_length_;
68 gfx::Rect track_rect_; 75 gfx::Rect track_rect_;
69 gfx::Rect thumb_rect_;
70 int scroll_layer_id_; 76 int scroll_layer_id_;
71 77
72 scoped_ptr<ScopedUIResource> track_resource_; 78 unsigned texture_format_;
73 scoped_ptr<ScopedUIResource> thumb_resource_; 79
80 gfx::RectF dirty_rect_;
81
82 scoped_refptr<CachingBitmapContentLayerUpdater> track_updater_;
83 scoped_refptr<CachingBitmapContentLayerUpdater> thumb_updater_;
84
85 // All the parts of the scrollbar except the thumb
86 scoped_ptr<LayerUpdater::Resource> track_;
87 scoped_ptr<LayerUpdater::Resource> thumb_;
74 88
75 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayer); 89 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayer);
76 }; 90 };
77 91
78 } // namespace cc 92 } // namespace cc
79 93
80 #endif // CC_LAYERS_SCROLLBAR_LAYER_H_ 94 #endif // CC_LAYERS_SCROLLBAR_LAYER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/layers/scrollbar_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698