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

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
Index: Source/platform/geometry/FloatRoundedRect.h
diff --git a/Source/platform/geometry/FloatRoundedRect.h b/Source/platform/geometry/FloatRoundedRect.h
index 9e3b4c4b6a53422505d05f6a9c09e35200b4000c..0147abdd0f91d1148da9577c59ee933e906c2e67 100644
--- a/Source/platform/geometry/FloatRoundedRect.h
+++ b/Source/platform/geometry/FloatRoundedRect.h
@@ -74,6 +74,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 +96,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 +123,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 +142,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();

Powered by Google App Engine
This is Rietveld 408576698