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

Unified Diff: Source/platform/geometry/FloatRoundedRect.h

Issue 815933006: Change all uses of the RoundedRect class to use FloatRoundedRect instead. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/geometry/FloatRoundedRect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/FloatRoundedRect.h
diff --git a/Source/platform/geometry/FloatRoundedRect.h b/Source/platform/geometry/FloatRoundedRect.h
index 9e3b4c4b6a53422505d05f6a9c09e35200b4000c..7694a2f948eae41eac1b14d75b6bcba82cff601c 100644
--- a/Source/platform/geometry/FloatRoundedRect.h
+++ b/Source/platform/geometry/FloatRoundedRect.h
@@ -32,10 +32,11 @@
#include "platform/geometry/FloatRect.h"
#include "platform/geometry/FloatSize.h"
-#include "platform/geometry/RoundedRect.h"
namespace blink {
+class FloatQuad;
+
class PLATFORM_EXPORT FloatRoundedRect {
public:
class PLATFORM_EXPORT Radii {
@@ -49,7 +50,7 @@ public:
{
}
- Radii(const RoundedRect::Radii& intRadii)
+ Radii(const FloatRoundedRect::Radii& intRadii)
: m_topLeft(intRadii.topLeft())
, m_topRight(intRadii.topRight())
, m_bottomLeft(intRadii.bottomLeft())
@@ -74,6 +75,8 @@ public:
void shrink(float topWidth, float bottomWidth, float leftWidth, float rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }
void shrink(float size) { shrink(size, size, size, size); }
+ void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
+
private:
FloatSize m_topLeft;
FloatSize m_topRight;
@@ -94,10 +97,14 @@ public:
void setRadii(const Radii& radii) { m_radii = radii; }
void move(const FloatSize& size) { m_rect.move(size); }
- void inflate(float size) { m_rect.inflate(size); }
+ void inflateWithRadii(int size);
+ void inflate(float size) { m_rect.inflate(size); }
void expandRadii(float size) { m_radii.expand(size); }
void shrinkRadii(float size) { m_radii.shrink(size); }
+ // Returns a quickly computed rect enclosed by the rounded rect.
+ FloatRect radiusCenterRect() const;
+
FloatRect topLeftCorner() const
{
return FloatRect(m_rect.x(), m_rect.y(), m_radii.topLeft().width(), m_radii.topLeft().height());
@@ -117,6 +124,15 @@ public:
bool xInterceptsAtY(float y, float& minXIntercept, float& maxXIntercept) const;
+ void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
+
+ // Tests whether the quad intersects any part of this rounded rectangle.
+ // This only works for convex quads.
+ bool intersectsQuad(const FloatQuad&) const;
+
+ void adjustRadii();
+ bool isRenderable() const;
+
private:
FloatRect m_rect;
Radii m_radii;
@@ -127,6 +143,13 @@ inline bool operator==(const FloatRoundedRect::Radii& a, const FloatRoundedRect:
return a.topLeft() == b.topLeft() && a.topRight() == b.topRight() && a.bottomLeft() == b.bottomLeft() && a.bottomRight() == b.bottomRight();
}
+
+inline bool operator!=(const FloatRoundedRect::Radii& a, const FloatRoundedRect::Radii& b)
+{
+ return !(a == b);
+}
+
+
inline bool operator==(const FloatRoundedRect& a, const FloatRoundedRect& b)
{
return a.rect() == b.rect() && a.radii() == b.radii();
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/geometry/FloatRoundedRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698