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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/FloatPolygonTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 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 12 matching lines...) Expand all
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 * OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "platform/geometry/FloatPolygon.h" 30 #include "platform/geometry/FloatPolygon.h"
31 31
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 #include "wtf/PtrUtil.h"
34 #include <memory>
35 33
36 namespace blink { 34 namespace blink {
37 35
38 class FloatPolygonTestValue { 36 class FloatPolygonTestValue {
39 public: 37 public:
40 FloatPolygonTestValue(const float* coordinates, unsigned coordinatesLength, WindRule fillRule) 38 FloatPolygonTestValue(const float* coordinates, unsigned coordinatesLength, WindRule fillRule)
41 { 39 {
42 ASSERT(!(coordinatesLength % 2)); 40 ASSERT(!(coordinatesLength % 2));
43 std::unique_ptr<Vector<FloatPoint>> vertices = wrapUnique(new Vector<Flo atPoint>(coordinatesLength / 2)); 41 OwnPtr<Vector<FloatPoint>> vertices = adoptPtr(new Vector<FloatPoint>(co ordinatesLength / 2));
44 for (unsigned i = 0; i < coordinatesLength; i += 2) 42 for (unsigned i = 0; i < coordinatesLength; i += 2)
45 (*vertices)[i / 2] = FloatPoint(coordinates[i], coordinates[i + 1]); 43 (*vertices)[i / 2] = FloatPoint(coordinates[i], coordinates[i + 1]);
46 m_polygon = wrapUnique(new FloatPolygon(std::move(vertices), fillRule)); 44 m_polygon = adoptPtr(new FloatPolygon(std::move(vertices), fillRule));
47 } 45 }
48 46
49 const FloatPolygon& polygon() const { return *m_polygon; } 47 const FloatPolygon& polygon() const { return *m_polygon; }
50 48
51 private: 49 private:
52 std::unique_ptr<FloatPolygon> m_polygon; 50 OwnPtr<FloatPolygon> m_polygon;
53 }; 51 };
54 52
55 namespace { 53 namespace {
56 54
57 bool compareEdgeIndex(const FloatPolygonEdge* edge1, const FloatPolygonEdge* edg e2) 55 bool compareEdgeIndex(const FloatPolygonEdge* edge1, const FloatPolygonEdge* edg e2)
58 { 56 {
59 return edge1->edgeIndex() < edge2->edgeIndex(); 57 return edge1->edgeIndex() < edge2->edgeIndex();
60 } 58 }
61 59
62 Vector<const FloatPolygonEdge*> sortedOverlappingEdges(const FloatPolygon& polyg on, float minY, float maxY) 60 Vector<const FloatPolygonEdge*> sortedOverlappingEdges(const FloatPolygon& polyg on, float minY, float maxY)
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 EXPECT_FALSE(h.contains(FloatPoint(151, 100))); 318 EXPECT_FALSE(h.contains(FloatPoint(151, 100)));
321 EXPECT_FALSE(h.contains(FloatPoint(199, 100))); 319 EXPECT_FALSE(h.contains(FloatPoint(199, 100)));
322 EXPECT_FALSE(h.contains(FloatPoint(175, 125))); 320 EXPECT_FALSE(h.contains(FloatPoint(175, 125)));
323 EXPECT_FALSE(h.contains(FloatPoint(151, 250))); 321 EXPECT_FALSE(h.contains(FloatPoint(151, 250)));
324 EXPECT_FALSE(h.contains(FloatPoint(199, 250))); 322 EXPECT_FALSE(h.contains(FloatPoint(199, 250)));
325 EXPECT_FALSE(h.contains(FloatPoint(199, 250))); 323 EXPECT_FALSE(h.contains(FloatPoint(199, 250)));
326 EXPECT_FALSE(h.contains(FloatPoint(175, 225))); 324 EXPECT_FALSE(h.contains(FloatPoint(175, 225)));
327 } 325 }
328 326
329 } // namespace blink 327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698