1 // Copyright 2014 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.
5 #ifndef UI_VIEWS_CULL_SET_H_
6 #define UI_VIEWS_CULL_SET_H_
8 #include "base/containers/hash_tables.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/views/views_export.h"
17 // A CullSet defines a set of View pointers which have been possibly culled
18 // from painting or other bounds-checking operations. It wraps a set of
19 // pointers to views, or NULL if no such set is available.
20 class VIEWS_EXPORT CullSet
{
22 // Default constructor builds a CullSet that will always return true for
27 // Wraps a set of pointers to Views, as might be provided by
28 // gfx::RTree::Query(), that intersect the damage rect and therefore need
29 // to be painted. CullSet takes ownership of the provided pointer.
30 CullSet(scoped_ptr
<base::hash_set
<intptr_t> > cull_set
);
32 // Returns true if |view| needs to be painted.
33 bool ShouldPaint(const View
* view
) const;
36 friend class BoundsTreeTestView
;
38 // The set of Views that collided with the query rectangle provided to the
39 // RTree data structure, or NULL if one is not available.
40 scoped_ptr
<base::hash_set
<intptr_t> > cull_set_
;
42 DISALLOW_COPY_AND_ASSIGN(CullSet
);
47 #endif // UI_VIEWS_CULL_SET_H_