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

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

Issue 300223009: Implement basic parts of hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed comments Created 6 years, 6 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 Path::Path() 44 Path::Path()
45 : m_path() 45 : m_path()
46 { 46 {
47 } 47 }
48 48
49 Path::Path(const Path& other) 49 Path::Path(const Path& other)
50 { 50 {
51 m_path = SkPath(other.m_path); 51 m_path = SkPath(other.m_path);
52 } 52 }
53 53
54 Path::Path(const SkPath& skPath)
55 {
56 m_path = skPath;
57 }
58
54 Path::~Path() 59 Path::~Path()
55 { 60 {
56 } 61 }
57 62
58 Path& Path::operator=(const Path& other) 63 Path& Path::operator=(const Path& other)
59 { 64 {
60 m_path = SkPath(other.m_path); 65 m_path = SkPath(other.m_path);
61 return *this; 66 return *this;
62 } 67 }
63 68
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 void Path::addPath(const Path& src, const AffineTransform& transform) 480 void Path::addPath(const Path& src, const AffineTransform& transform)
476 { 481 {
477 m_path.addPath(src.skPath(), affineTransformToSkMatrix(transform)); 482 m_path.addPath(src.skPath(), affineTransformToSkMatrix(transform));
478 } 483 }
479 484
480 void Path::translate(const FloatSize& size) 485 void Path::translate(const FloatSize& size)
481 { 486 {
482 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s ize.height())); 487 m_path.offset(WebCoreFloatToSkScalar(size.width()), WebCoreFloatToSkScalar(s ize.height()));
483 } 488 }
484 489
490 bool Path::subtractPath(const Path& other)
491 {
492 return Op(m_path, other.m_path, kDifference_PathOp, &m_path);
493 }
494
495 bool Path::intersectPath(const Path& other)
496 {
497 return Op(m_path, other.m_path, kIntersect_PathOp, &m_path);
498 }
499
485 bool Path::unionPath(const Path& other) 500 bool Path::unionPath(const Path& other)
486 { 501 {
487 return Op(m_path, other.m_path, kUnion_PathOp, &m_path); 502 return Op(m_path, other.m_path, kUnion_PathOp, &m_path);
488 } 503 }
489 504
490 #if !ASSERT_DISABLED 505 #if !ASSERT_DISABLED
491 bool ellipseIsRenderable(float startAngle, float endAngle) 506 bool ellipseIsRenderable(float startAngle, float endAngle)
492 { 507 {
493 return (std::abs(endAngle - startAngle) < twoPiFloat) 508 return (std::abs(endAngle - startAngle) < twoPiFloat)
494 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat); 509 || WebCoreFloatNearlyEqual(std::abs(endAngle - startAngle), twoPiFloat);
495 } 510 }
496 #endif 511 #endif
497 512
498 } 513 }
OLDNEW
« Source/core/html/canvas/CanvasRenderingContext2D.cpp ('K') | « Source/platform/graphics/Path.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698