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