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 224 matching lines...) Loading... |
235 SkPathMeasure measure(m_path, false); | 235 SkPathMeasure measure(m_path, false); |
236 if (calculatePointAndNormalOnPath(measure, WebCoreFloatToSkScalar(length), p
oint, normal)) | 236 if (calculatePointAndNormalOnPath(measure, WebCoreFloatToSkScalar(length), p
oint, normal)) |
237 return; | 237 return; |
238 | 238 |
239 SkPoint position = m_path.getPoint(0); | 239 SkPoint position = m_path.getPoint(0); |
240 point = FloatPoint(SkScalarToFloat(position.fX), SkScalarToFloat(position.fY
)); | 240 point = FloatPoint(SkScalarToFloat(position.fX), SkScalarToFloat(position.fY
)); |
241 normal = 0; | 241 normal = 0; |
242 } | 242 } |
243 | 243 |
244 Path::PositionCalculator::PositionCalculator(const Path& path) | 244 Path::PositionCalculator::PositionCalculator(const Path& path) |
245 : m_path(path.skPath()) | 245 : m_path(path.getSkPath()) |
246 , m_pathMeasure(path.skPath(), false) | 246 , m_pathMeasure(path.getSkPath(), false) |
247 , m_accumulatedLength(0) | 247 , m_accumulatedLength(0) |
248 { | 248 { |
249 } | 249 } |
250 | 250 |
251 void Path::PositionCalculator::pointAndNormalAtLength(float length, FloatPoint&
point, float& normalAngle) | 251 void Path::PositionCalculator::pointAndNormalAtLength(float length, FloatPoint&
point, float& normalAngle) |
252 { | 252 { |
253 SkScalar skLength = WebCoreFloatToSkScalar(length); | 253 SkScalar skLength = WebCoreFloatToSkScalar(length); |
254 if (skLength >= 0) { | 254 if (skLength >= 0) { |
255 if (skLength < m_accumulatedLength) { | 255 if (skLength < m_accumulatedLength) { |
256 // Reset path measurer to rewind (and restart from 0). | 256 // Reset path measurer to rewind (and restart from 0). |
(...skipping 169 matching lines...) Loading... |
426 } | 426 } |
427 | 427 |
428 void Path::addEllipse(const FloatRect& rect) | 428 void Path::addEllipse(const FloatRect& rect) |
429 { | 429 { |
430 // Start at 3 o'clock, add clock-wise. | 430 // Start at 3 o'clock, add clock-wise. |
431 m_path.addOval(rect, SkPath::kCW_Direction, 1); | 431 m_path.addOval(rect, SkPath::kCW_Direction, 1); |
432 } | 432 } |
433 | 433 |
434 void Path::addRoundedRect(const FloatRoundedRect& r) | 434 void Path::addRoundedRect(const FloatRoundedRect& r) |
435 { | 435 { |
436 addRoundedRect(r.rect(), r.radii().topLeft(), r.radii().topRight(), r.radii(
).bottomLeft(), r.radii().bottomRight()); | 436 addRoundedRect(r.rect(), r.getRadii().topLeft(), r.getRadii().topRight(), r.
getRadii().bottomLeft(), r.getRadii().bottomRight()); |
437 } | 437 } |
438 | 438 |
439 void Path::addRoundedRect(const FloatRect& rect, const FloatSize& roundingRadii) | 439 void Path::addRoundedRect(const FloatRect& rect, const FloatSize& roundingRadii) |
440 { | 440 { |
441 if (rect.isEmpty()) | 441 if (rect.isEmpty()) |
442 return; | 442 return; |
443 | 443 |
444 FloatSize radius(roundingRadii); | 444 FloatSize radius(roundingRadii); |
445 FloatSize halfSize(rect.width() / 2, rect.height() / 2); | 445 FloatSize halfSize(rect.width() / 2, rect.height() / 2); |
446 | 446 |
(...skipping 41 matching lines...) Loading... |
488 void Path::addPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeft
Radius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, cons
t FloatSize& bottomRightRadius) | 488 void Path::addPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeft
Radius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, cons
t FloatSize& bottomRightRadius) |
489 { | 489 { |
490 // Start at upper-left (after corner radii), add clock-wise. | 490 // Start at upper-left (after corner radii), add clock-wise. |
491 m_path.addRRect( | 491 m_path.addRRect( |
492 FloatRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius,
bottomRightRadius), | 492 FloatRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius,
bottomRightRadius), |
493 SkPath::kCW_Direction, 0); | 493 SkPath::kCW_Direction, 0); |
494 } | 494 } |
495 | 495 |
496 void Path::addPath(const Path& src, const AffineTransform& transform) | 496 void Path::addPath(const Path& src, const AffineTransform& transform) |
497 { | 497 { |
498 m_path.addPath(src.skPath(), affineTransformToSkMatrix(transform)); | 498 m_path.addPath(src.getSkPath(), affineTransformToSkMatrix(transform)); |
499 } | 499 } |
500 | 500 |
501 void Path::translate(const FloatSize& size) | 501 void Path::translate(const FloatSize& size) |
502 { | 502 { |
503 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s
ize.height())); | 503 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s
ize.height())); |
504 } | 504 } |
505 | 505 |
506 bool Path::subtractPath(const Path& other) | 506 bool Path::subtractPath(const Path& other) |
507 { | 507 { |
508 return Op(m_path, other.m_path, kDifference_SkPathOp, &m_path); | 508 return Op(m_path, other.m_path, kDifference_SkPathOp, &m_path); |
(...skipping 11 matching lines...) Loading... |
520 | 520 |
521 #if ENABLE(ASSERT) | 521 #if ENABLE(ASSERT) |
522 bool ellipseIsRenderable(float startAngle, float endAngle) | 522 bool ellipseIsRenderable(float startAngle, float endAngle) |
523 { | 523 { |
524 return (std::abs(endAngle - startAngle) < twoPiFloat) | 524 return (std::abs(endAngle - startAngle) < twoPiFloat) |
525 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); | 525 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); |
526 } | 526 } |
527 #endif | 527 #endif |
528 | 528 |
529 } // namespace blink | 529 } // namespace blink |
OLD | NEW |