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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Path.cpp

Issue 1623073003: [SVG] Paint unnormalized paths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed review comments Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Path.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void Path::addBezierCurveTo(const FloatPoint& p1, const FloatPoint& p2, const Fl oatPoint& ep) 324 void Path::addBezierCurveTo(const FloatPoint& p1, const FloatPoint& p2, const Fl oatPoint& ep)
325 { 325 {
326 m_path.cubicTo(p1.data(), p2.data(), ep.data()); 326 m_path.cubicTo(p1.data(), p2.data(), ep.data());
327 } 327 }
328 328
329 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) 329 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
330 { 330 {
331 m_path.arcTo(p1.data(), p2.data(), WebCoreFloatToSkScalar(radius)); 331 m_path.arcTo(p1.data(), p2.data(), WebCoreFloatToSkScalar(radius));
332 } 332 }
333 333
334 void Path::addArcTo(const FloatPoint& p, const FloatSize& r, float xRotate, bool largeArc, bool sweep)
335 {
336 m_path.arcTo(
337 WebCoreFloatToSkScalar(r.width()), WebCoreFloatToSkScalar(r.height()),
338 WebCoreFloatToSkScalar(xRotate),
339 largeArc ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
340 sweep ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
341 WebCoreFloatToSkScalar(p.x()), WebCoreFloatToSkScalar(p.y()));
342 }
343
334 void Path::closeSubpath() 344 void Path::closeSubpath()
335 { 345 {
336 m_path.close(); 346 m_path.close();
337 } 347 }
338 348
339 void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float s tartAngle, float endAngle, bool anticlockwise) 349 void Path::addEllipse(const FloatPoint& p, float radiusX, float radiusY, float s tartAngle, float endAngle, bool anticlockwise)
340 { 350 {
341 ASSERT(ellipseIsRenderable(startAngle, endAngle)); 351 ASSERT(ellipseIsRenderable(startAngle, endAngle));
342 ASSERT(startAngle >= 0 && startAngle < twoPiFloat); 352 ASSERT(startAngle >= 0 && startAngle < twoPiFloat);
343 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise && (endAngle - startAngle) >= 0)); 353 ASSERT((anticlockwise && (startAngle - endAngle) >= 0) || (!anticlockwise && (endAngle - startAngle) >= 0));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 505
496 #if ENABLE(ASSERT) 506 #if ENABLE(ASSERT)
497 bool ellipseIsRenderable(float startAngle, float endAngle) 507 bool ellipseIsRenderable(float startAngle, float endAngle)
498 { 508 {
499 return (std::abs(endAngle - startAngle) < twoPiFloat) 509 return (std::abs(endAngle - startAngle) < twoPiFloat)
500 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); 510 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat);
501 } 511 }
502 #endif 512 #endif
503 513
504 } // namespace blink 514 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Path.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698