Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(754)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/FloatClipRect.h

Issue 2802443002: Compute rounded-ness of visual rects (Closed)
Patch Set: none Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 FloatClipRect_h 5 #ifndef FloatClipRect_h
6 #define FloatClipRect_h 6 #define FloatClipRect_h
7 7
8 #include "platform/geometry/FloatRect.h" 8 #include "platform/geometry/FloatRect.h"
9 #include "platform/geometry/LayoutRect.h" 9 #include "platform/geometry/LayoutRect.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class PLATFORM_EXPORT FloatClipRect { 14 class PLATFORM_EXPORT FloatClipRect {
15 USING_FAST_MALLOC(FloatClipRect); 15 USING_FAST_MALLOC(FloatClipRect);
16 16
17 public: 17 public:
18 FloatClipRect() 18 FloatClipRect()
19 : m_rect(FloatRect(LayoutRect::infiniteIntRect())), 19 : m_rect(FloatRect(LayoutRect::infiniteIntRect())),
20 m_hasRadius(false), 20 m_hasRadius(false),
21 m_isInfinite(true) {} 21 m_isInfinite(true) {}
22 22
23 explicit FloatClipRect(const FloatRect& rect) 23 explicit FloatClipRect(const FloatRect& rect)
24 : m_rect(rect), m_hasRadius(false), m_isInfinite(false) {} 24 : m_rect(rect), m_hasRadius(false), m_isInfinite(false) {}
25 25
26 const FloatRect& rect() const { return m_rect; } 26 const FloatRect& rect() const { return m_rect; }
27 27
28 FloatRect& rect() { return m_rect; }
29
28 void intersect(const FloatRect& other) { 30 void intersect(const FloatRect& other) {
29 if (m_isInfinite) { 31 if (m_isInfinite) {
30 m_rect = other; 32 m_rect = other;
31 m_isInfinite = false; 33 m_isInfinite = false;
32 } else { 34 } else {
33 m_rect.intersect(other); 35 m_rect.intersect(other);
34 } 36 }
35 } 37 }
36 38
37 bool hasRadius() const { return m_hasRadius; } 39 bool hasRadius() const { return m_hasRadius; }
(...skipping 25 matching lines...) Expand all
63 if (a.isInfinite() && b.isInfinite()) 65 if (a.isInfinite() && b.isInfinite())
64 return true; 66 return true;
65 if (!a.isInfinite() && !b.isInfinite()) 67 if (!a.isInfinite() && !b.isInfinite())
66 return a.rect() == b.rect() && a.hasRadius() == b.hasRadius(); 68 return a.rect() == b.rect() && a.hasRadius() == b.hasRadius();
67 return false; 69 return false;
68 } 70 }
69 71
70 } // namespace blink 72 } // namespace blink
71 73
72 #endif // FloatClipRect_h 74 #endif // FloatClipRect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698