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

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

Issue 2826773002: Rename CanvasPathMethods to CanvasPath (Closed)
Patch Set: x Created 3 years, 8 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void Path::CloseSubpath() { 357 void Path::CloseSubpath() {
358 path_.close(); 358 path_.close();
359 } 359 }
360 360
361 void Path::AddEllipse(const FloatPoint& p, 361 void Path::AddEllipse(const FloatPoint& p,
362 float radius_x, 362 float radius_x,
363 float radius_y, 363 float radius_y,
364 float start_angle, 364 float start_angle,
365 float end_angle, 365 float end_angle,
366 bool anticlockwise) { 366 bool anticlockwise) {
367 #if DCHECK_IS_ON()
368 DCHECK(EllipseIsRenderable(start_angle, end_angle)); 367 DCHECK(EllipseIsRenderable(start_angle, end_angle));
369 #endif
370 DCHECK_GE(start_angle, 0); 368 DCHECK_GE(start_angle, 0);
371 DCHECK_LT(start_angle, twoPiFloat); 369 DCHECK_LT(start_angle, twoPiFloat);
372 DCHECK((anticlockwise && (start_angle - end_angle) >= 0) || 370 DCHECK((anticlockwise && (start_angle - end_angle) >= 0) ||
373 (!anticlockwise && (end_angle - start_angle) >= 0)); 371 (!anticlockwise && (end_angle - start_angle) >= 0));
374 372
375 SkScalar cx = WebCoreFloatToSkScalar(p.X()); 373 SkScalar cx = WebCoreFloatToSkScalar(p.X());
376 SkScalar cy = WebCoreFloatToSkScalar(p.Y()); 374 SkScalar cy = WebCoreFloatToSkScalar(p.Y());
377 SkScalar radius_x_scalar = WebCoreFloatToSkScalar(radius_x); 375 SkScalar radius_x_scalar = WebCoreFloatToSkScalar(radius_x);
378 SkScalar radius_y_scalar = WebCoreFloatToSkScalar(radius_y); 376 SkScalar radius_y_scalar = WebCoreFloatToSkScalar(radius_y);
379 377
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 path_.addRect(rect, SkPath::kCW_Direction, 0); 419 path_.addRect(rect, SkPath::kCW_Direction, 0);
422 } 420 }
423 421
424 void Path::AddEllipse(const FloatPoint& p, 422 void Path::AddEllipse(const FloatPoint& p,
425 float radius_x, 423 float radius_x,
426 float radius_y, 424 float radius_y,
427 float rotation, 425 float rotation,
428 float start_angle, 426 float start_angle,
429 float end_angle, 427 float end_angle,
430 bool anticlockwise) { 428 bool anticlockwise) {
431 #if DCHECK_IS_ON()
432 DCHECK(EllipseIsRenderable(start_angle, end_angle)); 429 DCHECK(EllipseIsRenderable(start_angle, end_angle));
433 #endif
434 DCHECK_GE(start_angle, 0); 430 DCHECK_GE(start_angle, 0);
435 DCHECK_LT(start_angle, twoPiFloat); 431 DCHECK_LT(start_angle, twoPiFloat);
436 DCHECK((anticlockwise && (start_angle - end_angle) >= 0) || 432 DCHECK((anticlockwise && (start_angle - end_angle) >= 0) ||
437 (!anticlockwise && (end_angle - start_angle) >= 0)); 433 (!anticlockwise && (end_angle - start_angle) >= 0));
438 434
439 if (!rotation) { 435 if (!rotation) {
440 AddEllipse(FloatPoint(p.X(), p.Y()), radius_x, radius_y, start_angle, 436 AddEllipse(FloatPoint(p.X(), p.Y()), radius_x, radius_y, start_angle,
441 end_angle, anticlockwise); 437 end_angle, anticlockwise);
442 return; 438 return;
443 } 439 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 540 }
545 541
546 bool Path::UnionPath(const Path& other) { 542 bool Path::UnionPath(const Path& other) {
547 return Op(path_, other.path_, kUnion_SkPathOp, &path_); 543 return Op(path_, other.path_, kUnion_SkPathOp, &path_);
548 } 544 }
549 545
550 bool Path::IntersectPath(const Path& other) { 546 bool Path::IntersectPath(const Path& other) {
551 return Op(path_, other.path_, kIntersect_SkPathOp, &path_); 547 return Op(path_, other.path_, kIntersect_SkPathOp, &path_);
552 } 548 }
553 549
554 #if DCHECK_IS_ON()
555 bool EllipseIsRenderable(float start_angle, float end_angle) { 550 bool EllipseIsRenderable(float start_angle, float end_angle) {
556 return (std::abs(end_angle - start_angle) < twoPiFloat) || 551 return (std::abs(end_angle - start_angle) < twoPiFloat) ||
557 WebCoreFloatNearlyEqual(std::abs(end_angle - start_angle), twoPiFloat); 552 WebCoreFloatNearlyEqual(std::abs(end_angle - start_angle), twoPiFloat);
558 } 553 }
559 #endif
560 554
561 } // namespace blink 555 } // 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