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

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

Issue 300223009: Implement basic parts of hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add clip tests 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, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
3 * 2006 Rob Buis <buis@kde.org> 3 * 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007-2008 Torch Mobile, Inc. 4 * Copyright (C) 2007-2008 Torch Mobile, Inc.
5 * Copyright (C) 2013 Google Inc. All rights reserved. 5 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 typedef void (*PathApplierFunction)(void* info, const PathElement*); 67 typedef void (*PathApplierFunction)(void* info, const PathElement*);
68 68
69 class PLATFORM_EXPORT Path { 69 class PLATFORM_EXPORT Path {
70 WTF_MAKE_FAST_ALLOCATED; 70 WTF_MAKE_FAST_ALLOCATED;
71 public: 71 public:
72 Path(); 72 Path();
73 ~Path(); 73 ~Path();
74 74
75 Path(const Path&); 75 Path(const Path&);
76 Path(const SkPath&);
76 Path& operator=(const Path&); 77 Path& operator=(const Path&);
77 bool operator==(const Path&) const; 78 bool operator==(const Path&) const;
78 79
79 bool contains(const FloatPoint&, WindRule = RULE_NONZERO) const; 80 bool contains(const FloatPoint&, WindRule = RULE_NONZERO) const;
80 bool strokeContains(const FloatPoint&, const StrokeData&) const; 81 bool strokeContains(const FloatPoint&, const StrokeData&) const;
81 FloatRect boundingRect() const; 82 FloatRect boundingRect() const;
82 FloatRect strokeBoundingRect(const StrokeData&) const; 83 FloatRect strokeBoundingRect(const StrokeData&) const;
83 84
84 float length() const; 85 float length() const;
85 FloatPoint pointAtLength(float length, bool& ok) const; 86 FloatPoint pointAtLength(float length, bool& ok) const;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void translate(const FloatSize&); 137 void translate(const FloatSize&);
137 138
138 const SkPath& skPath() const { return m_path; } 139 const SkPath& skPath() const { return m_path; }
139 140
140 void apply(void* info, PathApplierFunction) const; 141 void apply(void* info, PathApplierFunction) const;
141 void transform(const AffineTransform&); 142 void transform(const AffineTransform&);
142 143
143 void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Float Size& bottomRightRadius); 144 void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Float Size& bottomRightRadius);
144 void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadi us, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Fl oatSize& bottomRightRadius); 145 void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeftRadi us, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const Fl oatSize& bottomRightRadius);
145 146
147 bool subtractPath(const Path&);
148 bool intersectPath(const Path&);
149
146 // Updates the path to the union (inclusive-or) of itself with the given arg ument. 150 // Updates the path to the union (inclusive-or) of itself with the given arg ument.
147 bool unionPath(const Path& other); 151 bool unionPath(const Path& other);
148 152
149 private: 153 private:
150 void addEllipse(const FloatPoint&, float radiusX, float radiusY, float start Angle, float endAngle, bool anticlockwise); 154 void addEllipse(const FloatPoint&, float radiusX, float radiusY, float start Angle, float endAngle, bool anticlockwise);
151 155
152 SkPath m_path; 156 SkPath m_path;
153 }; 157 };
154 158
155 #if !ASSERT_DISABLED 159 #if !ASSERT_DISABLED
156 PLATFORM_EXPORT bool ellipseIsRenderable(float startAngle, float endAngle); 160 PLATFORM_EXPORT bool ellipseIsRenderable(float startAngle, float endAngle);
157 #endif 161 #endif
158 162
159 } 163 }
160 164
161 #endif 165 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698