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

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

Issue 170503002: Implement addPath() method for Path object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height())); 429 FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height()));
430 addLineTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height())); 430 addLineTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height()));
431 if (topLeftRadius.width() > 0 || topLeftRadius.height() > 0) 431 if (topLeftRadius.width() > 0 || topLeftRadius.height() > 0)
432 addBezierCurveTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height() * gCircleControlPoint), 432 addBezierCurveTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height() * gCircleControlPoint),
433 FloatPoint(rect.x() + topLeftRadius.width() * gCircleControlPoint, r ect.y()), 433 FloatPoint(rect.x() + topLeftRadius.width() * gCircleControlPoint, r ect.y()),
434 FloatPoint(rect.x() + topLeftRadius.width(), rect.y())); 434 FloatPoint(rect.x() + topLeftRadius.width(), rect.y()));
435 435
436 closeSubpath(); 436 closeSubpath();
437 } 437 }
438 438
439 void Path::addPath(const Path& src, const AffineTransform& transform)
440 {
441 m_path.addPath(src.skPath(), affineTransformToSkMatrix(transform));
442 }
443
439 void Path::translate(const FloatSize& size) 444 void Path::translate(const FloatSize& size)
440 { 445 {
441 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s ize.height())); 446 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s ize.height()));
442 } 447 }
443 448
444 bool Path::unionPath(const Path& other) 449 bool Path::unionPath(const Path& other)
445 { 450 {
446 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); 451 return Op(m_path, other.m_path, kUnion_PathOp, &m_path);
447 } 452 }
448 453
449 #if !ASSERT_DISABLED 454 #if !ASSERT_DISABLED
450 bool ellipseIsRenderable(float startAngle, float endAngle) 455 bool ellipseIsRenderable(float startAngle, float endAngle)
451 { 456 {
452 return (std::abs(endAngle - startAngle) < 2 * piFloat) 457 return (std::abs(endAngle - startAngle) < 2 * piFloat)
453 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), 2 * piFloat) ; 458 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), 2 * piFloat) ;
454 } 459 }
455 #endif 460 #endif
456 461
457 } 462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698