OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CullRect_h | 5 #ifndef CullRect_h |
6 #define CullRect_h | 6 #define CullRect_h |
7 | 7 |
8 #include "platform/geometry/IntRect.h" | 8 #include "platform/geometry/IntRect.h" |
9 #include "platform/transforms/AffineTransform.h" | 9 #include "platform/transforms/AffineTransform.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 #include "wtf/HashMap.h" | 11 #include "wtf/HashMap.h" |
12 #include "wtf/ListHashSet.h" | 12 #include "wtf/ListHashSet.h" |
13 | 13 |
14 #include <limits> | 14 #include <limits> |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class FloatRect; | 18 class FloatRect; |
19 class LayoutRect; | 19 class LayoutRect; |
20 class LayoutUnit; | 20 class LayoutUnit; |
21 | 21 |
22 class PLATFORM_EXPORT CullRect { | 22 class PLATFORM_EXPORT CullRect { |
23 DISALLOW_NEW(); | 23 DISALLOW_NEW(); |
24 | 24 |
25 public: | 25 public: |
| 26 CullRect() {} |
26 explicit CullRect(const IntRect& rect) : m_rect(rect) {} | 27 explicit CullRect(const IntRect& rect) : m_rect(rect) {} |
27 CullRect(const CullRect&, const IntPoint& offset); | 28 CullRect(const CullRect&, const IntPoint& offset); |
28 CullRect(const CullRect&, const IntSize& offset); | 29 CullRect(const CullRect&, const IntSize& offset); |
29 | 30 |
30 bool intersectsCullRect(const AffineTransform&, | 31 bool intersectsCullRect(const AffineTransform&, |
31 const FloatRect& boundingBox) const; | 32 const FloatRect& boundingBox) const; |
32 void updateCullRect(const AffineTransform& localToParentTransform); | 33 void updateCullRect(const AffineTransform& localToParentTransform); |
33 bool intersectsCullRect(const IntRect&) const; | 34 bool intersectsCullRect(const IntRect&) const; |
34 bool intersectsCullRect(const LayoutRect&) const; | 35 bool intersectsCullRect(const LayoutRect&) const; |
35 bool intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const; | 36 bool intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const; |
36 bool intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const; | 37 bool intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const; |
37 | 38 |
38 private: | 39 private: |
39 IntRect m_rect; | 40 IntRect m_rect; |
40 | 41 |
| 42 friend bool operator==(const CullRect&, const CullRect&); |
| 43 |
41 // TODO(chrishtr): temporary while we implement CullRect everywhere. | 44 // TODO(chrishtr): temporary while we implement CullRect everywhere. |
42 friend class FramePainter; | 45 friend class FramePainter; |
43 friend class GridPainter; | 46 friend class GridPainter; |
44 friend class SVGInlineTextBoxPainter; | 47 friend class SVGInlineTextBoxPainter; |
45 friend class SVGPaintContext; | 48 friend class SVGPaintContext; |
46 friend class SVGRootInlineBoxPainter; | 49 friend class SVGRootInlineBoxPainter; |
47 friend class SVGShapePainter; | 50 friend class SVGShapePainter; |
48 friend class TableSectionPainter; | 51 friend class TableSectionPainter; |
49 friend class ThemePainterMac; | 52 friend class ThemePainterMac; |
50 friend class WebPluginContainerImpl; | 53 friend class WebPluginContainerImpl; |
51 }; | 54 }; |
52 | 55 |
| 56 inline bool operator==(const CullRect& a, const CullRect& b) { |
| 57 return a.m_rect == b.m_rect; |
| 58 } |
| 59 inline bool operator!=(const CullRect& a, const CullRect& b) { |
| 60 return !(a == b); |
| 61 } |
| 62 |
53 } // namespace blink | 63 } // namespace blink |
54 | 64 |
55 #endif // CullRect_h | 65 #endif // CullRect_h |
OLD | NEW |