Index: ui/views/view.h |
diff --git a/ui/views/view.h b/ui/views/view.h |
index 027e212d7c47faa1878806eb40dacc2ed7828515..f26d8f05046b3c5349504b0c861dd24969703e3b 100644 |
--- a/ui/views/view.h |
+++ b/ui/views/view.h |
@@ -27,10 +27,12 @@ |
#include "ui/events/event.h" |
#include "ui/events/event_target.h" |
#include "ui/events/event_targeter.h" |
+#include "ui/gfx/geometry/r_tree.h" |
#include "ui/gfx/insets.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/vector2d.h" |
+#include "ui/views/cull_set.h" |
#include "ui/views/views_export.h" |
#if defined(OS_WIN) |
@@ -502,7 +504,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// for View coordinates and language direction as required, allows the View |
// to paint itself via the various OnPaint*() event handlers and then paints |
// the hierarchy beneath it. |
- virtual void Paint(gfx::Canvas* canvas); |
+ virtual void Paint(gfx::Canvas* canvas, const CullSet& cull_set); |
// The background object is owned by this object and may be NULL. |
void set_background(Background* b); |
@@ -1076,7 +1078,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// Responsible for calling Paint() on child Views. Override to control the |
// order child Views are painted. |
- virtual void PaintChildren(gfx::Canvas* canvas); |
+ virtual void PaintChildren(gfx::Canvas* canvas, const CullSet& cull_set); |
// Override to provide rendering in any part of the View's bounds. Typically |
// this is the "contents" of the view. If you override this method you will |
@@ -1091,6 +1093,11 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// Override to paint a border not specified by SetBorder(). |
virtual void OnPaintBorder(gfx::Canvas* canvas); |
+ // Returns true if this View is the root for paint events, and should |
+ // therefore maintain a |bounds_tree_| member and use it for paint damage rect |
+ // calculations. |
+ virtual bool IsPaintRoot(); |
+ |
// Accelerated painting ------------------------------------------------------ |
// Returns the offset from this view to the nearest ancestor with a layer. If |
@@ -1251,7 +1258,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// Common Paint() code shared by accelerated and non-accelerated code paths to |
// invoke OnPaint() on the View. |
- void PaintCommon(gfx::Canvas* canvas); |
+ void PaintCommon(gfx::Canvas* canvas, const CullSet& cull_set); |
// Tree operations ----------------------------------------------------------- |
@@ -1320,6 +1327,25 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// Sets the layer's bounds given in DIP coordinates. |
void SetLayerBounds(const gfx::Rect& bounds_in_dip); |
+ // Sets the bit indicating that the cached bounds for this object within the |
+ // root view bounds tree are no longer valid. If |origin_changed| is true sets |
+ // the same bit for all of our children as well. |
+ void SetRootBoundsDirty(bool origin_changed); |
+ |
+ // If needed, updates the bounds rectangle in paint root coordinate space |
+ // in the supplied RTree. Recurses to children for recomputation as well. |
+ void UpdateRootBounds(gfx::RTree* bounds_tree, const gfx::Vector2d& offset); |
+ |
+ // Remove self and all children from the supplied bounds tree. This is used, |
+ // for example, when a view gets a layer and therefore becomes paint root. It |
+ // needs to remove all references to itself and its children from any previous |
+ // paint root that may have been tracking it. |
+ void RemoveRootBounds(gfx::RTree* bounds_tree); |
+ |
+ // Traverse up the View hierarchy to the first ancestor that is a paint root |
+ // and return a pointer to its |bounds_tree_| or NULL if no tree is found. |
+ gfx::RTree* GetBoundsTreeFromPaintRoot(); |
+ |
// Transformations ----------------------------------------------------------- |
// Returns in |transform| the transform to get from coordinates of |ancestor| |
@@ -1492,6 +1518,15 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, |
// List of descendants wanting notification when their visible bounds change. |
scoped_ptr<Views> descendants_to_notify_; |
+ // True if the bounds on this object have changed since the last time the |
+ // paint root view constructed the spatial database. |
+ bool root_bounds_dirty_; |
+ |
+ // If this View IsPaintRoot() then this will be a pointer to a spatial data |
+ // structure where we will keep the bounding boxes of all our children, for |
+ // efficient paint damage rectangle intersection. |
+ scoped_ptr<gfx::RTree> bounds_tree_; |
+ |
// Transformations ----------------------------------------------------------- |
// Clipping parameters. skia transformation matrix does not give us clipping. |