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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_scrollbar_layer.h
===================================================================
--- cc/layers/picture_scrollbar_layer.h (revision 0)
+++ cc/layers/picture_scrollbar_layer.h (revision 0)
@@ -0,0 +1,91 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_LAYERS_PICTURE_SCROLLBAR_LAYER_H_
+#define CC_LAYERS_PICTURE_SCROLLBAR_LAYER_H_
+
+#include "cc/base/cc_export.h"
+#include "cc/input/scrollbar.h"
+#include "cc/layers/contents_scaling_layer.h"
+#include "cc/layers/scrollbar_theme_painter.h"
+#include "cc/resources/layer_updater.h"
+#include "cc/resources/ui_resource_manager.h"
+
+namespace cc {
+class ResourceUpdateQueue;
+class ScrollbarThemeComposite;
+
+class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer,
+ public UIResourceManagerClient {
+ public:
+ virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
+ OVERRIDE;
+
+ static scoped_refptr<ScrollbarLayer> Create(
+ scoped_ptr<Scrollbar> scrollbar,
+ int scroll_layer_id);
+
+ int scroll_layer_id() const { return scroll_layer_id_; }
+ void SetScrollLayerId(int id);
+
+ virtual bool OpacityCanAnimateOnImplThread() const OVERRIDE;
+
+ ScrollbarOrientation Orientation() const;
+
+ // Layer interface
+ virtual void Update(ResourceUpdateQueue* queue,
+ const OcclusionTracker* occlusion) OVERRIDE;
+ virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE;
+ virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
+ virtual void CalculateContentsScale(float ideal_contents_scale,
+ float device_scale_factor,
+ float page_scale_factor,
+ bool animating_transform_to_screen,
+ float* contents_scale_x,
+ float* contents_scale_y,
+ gfx::Size* content_bounds) OVERRIDE;
+
+ virtual ScrollbarLayer* ToScrollbarLayer() OVERRIDE;
+
+ virtual void UIResourceReady(UIResourceId id) OVERRIDE;
+ virtual void UIResourceLost(UIResourceId id) OVERRIDE;
+
+ protected:
+ ScrollbarLayer(scoped_ptr<Scrollbar> scrollbar,
+ int scroll_layer_id);
+ virtual ~ScrollbarLayer();
+
+ private:
+ gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const;
+ gfx::Rect OriginThumbRect() const;
+
+ bool is_dirty() const { return !dirty_rect_.IsEmpty(); }
+
+ int MaxTextureSize();
+ float ClampScaleToMaxTextureSize(float scale);
+
+ scoped_ptr<Scrollbar> scrollbar_;
+
+ int thumb_thickness_;
+ int thumb_length_;
+ gfx::Rect track_rect_;
+ int scroll_layer_id_;
+
+ gfx::RectF dirty_rect_;
+
+ UIResourceId track_ui_resource_id_;
+ UIResourceId thumb_ui_resource_id_;
+ UIResourceStatus track_ui_resource_status_;
+ UIResourceStatus thumb_ui_resource_status_;
+ scoped_refptr<UIResourceBitmap> track_bitmap_;
+ scoped_refptr<UIResourceBitmap> thumb_bitmap_;
+ bool skip_update_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScrollbarLayer);
+};
+
+
+} // namespace cc
+
+#endif // CC_LAYERS_PICTURE_SCROLLBAR_LAYER_H_

Powered by Google App Engine
This is Rietveld 408576698