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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatPolygon.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 17 matching lines...) Expand all
28 */ 28 */
29 29
30 #ifndef FloatPolygon_h 30 #ifndef FloatPolygon_h
31 #define FloatPolygon_h 31 #define FloatPolygon_h
32 32
33 #include "platform/PODIntervalTree.h" 33 #include "platform/PODIntervalTree.h"
34 #include "platform/geometry/FloatPoint.h" 34 #include "platform/geometry/FloatPoint.h"
35 #include "platform/geometry/FloatRect.h" 35 #include "platform/geometry/FloatRect.h"
36 #include "platform/graphics/GraphicsTypes.h" 36 #include "platform/graphics/GraphicsTypes.h"
37 #include "wtf/Allocator.h" 37 #include "wtf/Allocator.h"
38 #include "wtf/OwnPtr.h"
39 #include "wtf/PassOwnPtr.h"
40 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
39 #include <memory>
41 40
42 namespace blink { 41 namespace blink {
43 42
44 class FloatPolygonEdge; 43 class FloatPolygonEdge;
45 44
46 // This class is used by PODIntervalTree for debugging. 45 // This class is used by PODIntervalTree for debugging.
47 #ifndef NDEBUG 46 #ifndef NDEBUG
48 template <class> struct ValueToString; 47 template <class> struct ValueToString;
49 #endif 48 #endif
50 49
51 class PLATFORM_EXPORT FloatPolygon { 50 class PLATFORM_EXPORT FloatPolygon {
52 USING_FAST_MALLOC(FloatPolygon); 51 USING_FAST_MALLOC(FloatPolygon);
53 WTF_MAKE_NONCOPYABLE(FloatPolygon); 52 WTF_MAKE_NONCOPYABLE(FloatPolygon);
54 public: 53 public:
55 FloatPolygon(PassOwnPtr<Vector<FloatPoint>> vertices, WindRule fillRule); 54 FloatPolygon(std::unique_ptr<Vector<FloatPoint>> vertices, WindRule fillRule );
56 55
57 const FloatPoint& vertexAt(unsigned index) const { return (*m_vertices)[inde x]; } 56 const FloatPoint& vertexAt(unsigned index) const { return (*m_vertices)[inde x]; }
58 unsigned numberOfVertices() const { return m_vertices->size(); } 57 unsigned numberOfVertices() const { return m_vertices->size(); }
59 58
60 WindRule fillRule() const { return m_fillRule; } 59 WindRule fillRule() const { return m_fillRule; }
61 60
62 const FloatPolygonEdge& edgeAt(unsigned index) const { return m_edges[index] ; } 61 const FloatPolygonEdge& edgeAt(unsigned index) const { return m_edges[index] ; }
63 unsigned numberOfEdges() const { return m_edges.size(); } 62 unsigned numberOfEdges() const { return m_edges.size(); }
64 63
65 FloatRect boundingBox() const { return m_boundingBox; } 64 FloatRect boundingBox() const { return m_boundingBox; }
66 bool overlappingEdges(float minY, float maxY, Vector<const FloatPolygonEdge* >& result) const; 65 bool overlappingEdges(float minY, float maxY, Vector<const FloatPolygonEdge* >& result) const;
67 bool contains(const FloatPoint&) const; 66 bool contains(const FloatPoint&) const;
68 bool isEmpty() const { return m_empty; } 67 bool isEmpty() const { return m_empty; }
69 68
70 private: 69 private:
71 typedef PODInterval<float, FloatPolygonEdge*> EdgeInterval; 70 typedef PODInterval<float, FloatPolygonEdge*> EdgeInterval;
72 typedef PODIntervalTree<float, FloatPolygonEdge*> EdgeIntervalTree; 71 typedef PODIntervalTree<float, FloatPolygonEdge*> EdgeIntervalTree;
73 72
74 bool containsNonZero(const FloatPoint&) const; 73 bool containsNonZero(const FloatPoint&) const;
75 bool containsEvenOdd(const FloatPoint&) const; 74 bool containsEvenOdd(const FloatPoint&) const;
76 75
77 OwnPtr<Vector<FloatPoint>> m_vertices; 76 std::unique_ptr<Vector<FloatPoint>> m_vertices;
78 WindRule m_fillRule; 77 WindRule m_fillRule;
79 FloatRect m_boundingBox; 78 FloatRect m_boundingBox;
80 bool m_empty; 79 bool m_empty;
81 Vector<FloatPolygonEdge> m_edges; 80 Vector<FloatPolygonEdge> m_edges;
82 EdgeIntervalTree m_edgeTree; // Each EdgeIntervalTree node stores minY, maxY , and a ("UserData") pointer to a FloatPolygonEdge. 81 EdgeIntervalTree m_edgeTree; // Each EdgeIntervalTree node stores minY, maxY , and a ("UserData") pointer to a FloatPolygonEdge.
83 82
84 }; 83 };
85 84
86 class PLATFORM_EXPORT VertexPair { 85 class PLATFORM_EXPORT VertexPair {
87 public: 86 public:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 148
150 template<> struct ValueToString<FloatPolygonEdge*> { 149 template<> struct ValueToString<FloatPolygonEdge*> {
151 STATIC_ONLY(ValueToString); 150 STATIC_ONLY(ValueToString);
152 static String toString(const FloatPolygonEdge* edge) { return String::format ("%p (%f,%f %f,%f)", edge, edge->vertex1().x(), edge->vertex1().y(), edge->verte x2().x(), edge->vertex2().y()); } 151 static String toString(const FloatPolygonEdge* edge) { return String::format ("%p (%f,%f %f,%f)", edge, edge->vertex1().x(), edge->vertex1().y(), edge->verte x2().x(), edge->vertex2().y()); }
153 }; 152 };
154 #endif 153 #endif
155 154
156 } // namespace blink 155 } // namespace blink
157 156
158 #endif // FloatPolygon_h 157 #endif // FloatPolygon_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698