OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
3 * 2006 Rob Buis <buis@kde.org> | 3 * 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 return *this; | 61 return *this; |
62 } | 62 } |
63 | 63 |
64 bool Path::operator==(const Path& other) const | 64 bool Path::operator==(const Path& other) const |
65 { | 65 { |
66 return m_path == other.m_path; | 66 return m_path == other.m_path; |
67 } | 67 } |
68 | 68 |
69 bool Path::contains(const FloatPoint& point, WindRule rule) const | 69 bool Path::contains(const FloatPoint& point, WindRule rule) const |
70 { | 70 { |
71 return SkPathContainsPoint(m_path, point, rule == RULE_NONZERO ? SkPath::kWi nding_FillType : SkPath::kEvenOdd_FillType); | 71 return SkPathContainsPoint(m_path, point, static_cast<SkPath::FillType>(rule )); |
72 } | 72 } |
73 | 73 |
74 bool Path::strokeContains(const FloatPoint& point, const StrokeData& strokeData) const | 74 bool Path::strokeContains(const FloatPoint& point, const StrokeData& strokeData) const |
75 { | 75 { |
76 SkPaint paint; | 76 SkPaint paint; |
77 strokeData.setupPaint(&paint); | 77 strokeData.setupPaint(&paint); |
78 SkPath strokePath; | 78 SkPath strokePath; |
79 paint.getFillPath(m_path, &strokePath); | 79 paint.getFillPath(m_path, &strokePath); |
80 | 80 |
81 return SkPathContainsPoint(strokePath, point, SkPath::kWinding_FillType); | 81 return SkPathContainsPoint(strokePath, point, SkPath::kWinding_FillType); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 return result; | 263 return result; |
264 } | 264 } |
265 | 265 |
266 // FIXME: Why does this return quietNaN? Other ports return 0,0. | 266 // FIXME: Why does this return quietNaN? Other ports return 0,0. |
267 float quietNaN = std::numeric_limits<float>::quiet_NaN(); | 267 float quietNaN = std::numeric_limits<float>::quiet_NaN(); |
268 return FloatPoint(quietNaN, quietNaN); | 268 return FloatPoint(quietNaN, quietNaN); |
269 } | 269 } |
270 | 270 |
271 WindRule Path::windRule() const | 271 WindRule Path::windRule() const |
272 { | 272 { |
273 return m_path.getFillType() == SkPath::kEvenOdd_FillType | 273 return static_cast<WindRule>(m_path.getFillType()); |
f(malita)
2014/08/07 15:40:17
Note that WindRule <-> FillType is not a bijection
| |
274 ? RULE_EVENODD | |
275 : RULE_NONZERO; | |
276 } | 274 } |
277 | 275 |
278 void Path::setWindRule(const WindRule rule) | 276 void Path::setWindRule(const WindRule rule) |
279 { | 277 { |
280 m_path.setFillType(rule == RULE_EVENODD | 278 m_path.setFillType(static_cast<SkPath::FillType>(rule)); |
281 ? SkPath::kEvenOdd_FillType | |
282 : SkPath::kWinding_FillType); | |
283 } | 279 } |
284 | 280 |
285 void Path::moveTo(const FloatPoint& point) | 281 void Path::moveTo(const FloatPoint& point) |
286 { | 282 { |
287 m_path.moveTo(point.data()); | 283 m_path.moveTo(point.data()); |
288 } | 284 } |
289 | 285 |
290 void Path::addLineTo(const FloatPoint& point) | 286 void Path::addLineTo(const FloatPoint& point) |
291 { | 287 { |
292 m_path.lineTo(point.data()); | 288 m_path.lineTo(point.data()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 | 495 |
500 #if ENABLE(ASSERT) | 496 #if ENABLE(ASSERT) |
501 bool ellipseIsRenderable(float startAngle, float endAngle) | 497 bool ellipseIsRenderable(float startAngle, float endAngle) |
502 { | 498 { |
503 return (std::abs(endAngle - startAngle) < twoPiFloat) | 499 return (std::abs(endAngle - startAngle) < twoPiFloat) |
504 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); | 500 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); |
505 } | 501 } |
506 #endif | 502 #endif |
507 | 503 |
508 } | 504 } |
OLD | NEW |