Sort unlaunched apps on app list start page by apps grid order.
[chromium-blink-merge.git] / ui / views / cull_set.h
blob03f7cff86ee4b8954d1915e9a3533878421d0ea0
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"
13 namespace views {
15 class View;
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 {
21 public:
22 // Default constructor builds a CullSet that will always return true for
23 // ShouldPaint().
24 CullSet();
25 ~CullSet();
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;
35 private:
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);
45 } // namespace views
47 #endif // UI_VIEWS_CULL_SET_H_