| 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 LayoutBoxModelObject; | 19 class LayoutBoxModelObject; |
| 20 class LayoutInline; | 20 class LayoutInline; |
| 21 class LayoutObject; | 21 class LayoutObject; |
| 22 class LayoutRect; | 22 class LayoutRect; |
| 23 class LayoutUnit; | 23 class LayoutUnit; |
| 24 class PaintInvalidationState; | 24 class PaintInvalidationState; |
| 25 | 25 |
| 26 class PLATFORM_EXPORT CullRect { | 26 class PLATFORM_EXPORT CullRect { |
| 27 DISALLOW_NEW(); | 27 DISALLOW_NEW(); |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 CullRect() {} |
| 30 explicit CullRect(const IntRect& rect) : m_rect(rect) {} | 31 explicit CullRect(const IntRect& rect) : m_rect(rect) {} |
| 31 CullRect(const CullRect&, const IntPoint& offset); | 32 CullRect(const CullRect&, const IntPoint& offset); |
| 32 CullRect(const CullRect&, const IntSize& offset); | 33 CullRect(const CullRect&, const IntSize& offset); |
| 33 | 34 |
| 34 bool intersectsCullRect(const AffineTransform&, | 35 bool intersectsCullRect(const AffineTransform&, |
| 35 const FloatRect& boundingBox) const; | 36 const FloatRect& boundingBox) const; |
| 36 void updateCullRect(const AffineTransform& localToParentTransform); | 37 void updateCullRect(const AffineTransform& localToParentTransform); |
| 37 bool intersectsCullRect(const IntRect&) const; | 38 bool intersectsCullRect(const IntRect&) const; |
| 38 bool intersectsCullRect(const LayoutRect&) const; | 39 bool intersectsCullRect(const LayoutRect&) const; |
| 39 bool intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const; | 40 bool intersectsHorizontalRange(LayoutUnit lo, LayoutUnit hi) const; |
| 40 bool intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const; | 41 bool intersectsVerticalRange(LayoutUnit lo, LayoutUnit hi) const; |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 IntRect m_rect; | 44 IntRect m_rect; |
| 44 | 45 |
| 46 friend bool operator==(const CullRect&, const CullRect&); |
| 47 |
| 45 // TODO(chrishtr): temporary while we implement CullRect everywhere. | 48 // TODO(chrishtr): temporary while we implement CullRect everywhere. |
| 46 friend class FramePainter; | 49 friend class FramePainter; |
| 47 friend class GridPainter; | 50 friend class GridPainter; |
| 48 friend class SVGInlineTextBoxPainter; | 51 friend class SVGInlineTextBoxPainter; |
| 49 friend class SVGPaintContext; | 52 friend class SVGPaintContext; |
| 50 friend class SVGRootInlineBoxPainter; | 53 friend class SVGRootInlineBoxPainter; |
| 51 friend class SVGShapePainter; | 54 friend class SVGShapePainter; |
| 52 friend class TableSectionPainter; | 55 friend class TableSectionPainter; |
| 53 friend class ThemePainterMac; | 56 friend class ThemePainterMac; |
| 54 friend class WebPluginContainerImpl; | 57 friend class WebPluginContainerImpl; |
| 55 }; | 58 }; |
| 56 | 59 |
| 60 inline bool operator==(const CullRect& a, const CullRect& b) { |
| 61 return a.m_rect == b.m_rect; |
| 62 } |
| 63 inline bool operator!=(const CullRect& a, const CullRect& b) { |
| 64 return !(a == b); |
| 65 } |
| 66 |
| 57 } // namespace blink | 67 } // namespace blink |
| 58 | 68 |
| 59 #endif // CullRect_h | 69 #endif // CullRect_h |
| OLD | NEW |