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

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

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_LAYERS_PICTURE_SCROLLBAR_LAYER_H_
6 #define CC_LAYERS_PICTURE_SCROLLBAR_LAYER_H_
7
8 #include "cc/base/cc_export.h"
9 #include "cc/input/scrollbar.h"
10 #include "cc/layers/contents_scaling_layer.h"
11 #include "cc/layers/scrollbar_theme_painter.h"
12 #include "cc/resources/layer_updater.h"
13 #include "cc/resources/ui_resource_manager.h"
14
15 namespace cc {
16 class ResourceUpdateQueue;
17 class ScrollbarThemeComposite;
18
19 class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer,
20 public UIResourceManagerClient {
21 public:
22 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
23 OVERRIDE;
24
25 static scoped_refptr<ScrollbarLayer> Create(
26 scoped_ptr<Scrollbar> scrollbar,
27 int scroll_layer_id);
28
29 int scroll_layer_id() const { return scroll_layer_id_; }
30 void SetScrollLayerId(int id);
31
32 virtual bool OpacityCanAnimateOnImplThread() const OVERRIDE;
33
34 ScrollbarOrientation Orientation() const;
35
36 // Layer interface
37 virtual void Update(ResourceUpdateQueue* queue,
38 const OcclusionTracker* occlusion) OVERRIDE;
39 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE;
40 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
41 virtual void CalculateContentsScale(float ideal_contents_scale,
42 float device_scale_factor,
43 float page_scale_factor,
44 bool animating_transform_to_screen,
45 float* contents_scale_x,
46 float* contents_scale_y,
47 gfx::Size* content_bounds) OVERRIDE;
48
49 virtual ScrollbarLayer* ToScrollbarLayer() OVERRIDE;
50
51 virtual void UIResourceReady(UIResourceId id) OVERRIDE;
52 virtual void UIResourceLost(UIResourceId id) OVERRIDE;
53
54 protected:
55 ScrollbarLayer(scoped_ptr<Scrollbar> scrollbar,
56 int scroll_layer_id);
57 virtual ~ScrollbarLayer();
58
59 private:
60 gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const;
61 gfx::Rect OriginThumbRect() const;
62
63 bool is_dirty() const { return !dirty_rect_.IsEmpty(); }
64
65 int MaxTextureSize();
66 float ClampScaleToMaxTextureSize(float scale);
67
68 scoped_ptr<Scrollbar> scrollbar_;
69
70 int thumb_thickness_;
71 int thumb_length_;
72 gfx::Rect track_rect_;
73 int scroll_layer_id_;
74
75 gfx::RectF dirty_rect_;
76
77 UIResourceId track_ui_resource_id_;
78 UIResourceId thumb_ui_resource_id_;
79 UIResourceStatus track_ui_resource_status_;
80 UIResourceStatus thumb_ui_resource_status_;
81 scoped_refptr<UIResourceBitmap> track_bitmap_;
82 scoped_refptr<UIResourceBitmap> thumb_bitmap_;
83 bool skip_update_;
84
85 DISALLOW_COPY_AND_ASSIGN(ScrollbarLayer);
86 };
87
88
89 } // namespace cc
90
91 #endif // CC_LAYERS_PICTURE_SCROLLBAR_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698