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

Unified Diff: Source/core/rendering/shapes/PolygonShape.h

Issue 226363003: [CSS Shapes] Simplify Polygon implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't change FloatRect.h Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/rendering/shapes/PolygonShape.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/shapes/PolygonShape.h
diff --git a/Source/core/rendering/shapes/PolygonShape.h b/Source/core/rendering/shapes/PolygonShape.h
index e69b35f1ff99775a94f1b037ac2526a421085c03..35d7efefd28d38f38ad7779921851d48e307f3b5 100644
--- a/Source/core/rendering/shapes/PolygonShape.h
+++ b/Source/core/rendering/shapes/PolygonShape.h
@@ -31,52 +31,30 @@
#define PolygonShape_h
#include "core/rendering/shapes/Shape.h"
+#include "core/rendering/shapes/ShapeInterval.h"
#include "platform/geometry/FloatPolygon.h"
namespace WebCore {
class OffsetPolygonEdge FINAL : public VertexPair {
public:
- enum Basis {
- Edge,
- Vertex,
- LineTop
- };
-
OffsetPolygonEdge(const FloatPolygonEdge& edge, const FloatSize& offset)
: m_vertex1(edge.vertex1() + offset)
, m_vertex2(edge.vertex2() + offset)
- , m_edgeIndex(edge.edgeIndex())
- , m_basis(Edge)
- {
- }
-
- OffsetPolygonEdge(const FloatPoint& reflexVertex, const FloatSize& offset1, const FloatSize& offset2)
- : m_vertex1(reflexVertex + offset1)
- , m_vertex2(reflexVertex + offset2)
- , m_edgeIndex(-1)
- , m_basis(Vertex)
- {
- }
-
- OffsetPolygonEdge(const FloatPolygon& polygon, float minLogicalIntervalTop, const FloatSize& offset)
- : m_vertex1(FloatPoint(polygon.boundingBox().x(), minLogicalIntervalTop) + offset)
- , m_vertex2(FloatPoint(polygon.boundingBox().maxX(), minLogicalIntervalTop) + offset)
- , m_edgeIndex(-1)
- , m_basis(LineTop)
{
}
virtual const FloatPoint& vertex1() const OVERRIDE { return m_vertex1; }
virtual const FloatPoint& vertex2() const OVERRIDE { return m_vertex2; }
- int edgeIndex() const { return m_edgeIndex; }
- Basis basis() const { return m_basis; }
+
+ bool isWithinYRange(float y1, float y2) const { return y1 <= minY() && y2 >= maxY(); }
eseidel 2014/04/05 01:49:05 One of these years we'll need a FloatRange or Floa
+ bool overlapsYRange(float y1, float y2) const { return y2 >= minY() && y1 <= maxY(); }
+ float xIntercept(float y) const;
+ FloatShapeInterval clippedEdgeXRange(float y1, float y2) const;
private:
FloatPoint m_vertex1;
FloatPoint m_vertex2;
- int m_edgeIndex;
- Basis m_basis;
};
class PolygonShape FINAL : public Shape {
@@ -85,19 +63,15 @@ public:
PolygonShape(PassOwnPtr<Vector<FloatPoint> > vertices, WindRule fillRule)
: Shape()
, m_polygon(vertices, fillRule)
- , m_marginBounds(nullptr)
{
}
- virtual LayoutRect shapeMarginLogicalBoundingBox() const OVERRIDE { return static_cast<LayoutRect>(shapeMarginBounds().boundingBox()); }
+ virtual LayoutRect shapeMarginLogicalBoundingBox() const OVERRIDE;
virtual bool isEmpty() const OVERRIDE { return m_polygon.isEmpty(); }
virtual void getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList&) const OVERRIDE;
private:
- const FloatPolygon& shapeMarginBounds() const;
-
FloatPolygon m_polygon;
- mutable OwnPtr<FloatPolygon> m_marginBounds;
};
} // namespace WebCore
« no previous file with comments | « no previous file | Source/core/rendering/shapes/PolygonShape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698