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

Side by Side Diff: Source/platform/geometry/FloatRect.h

Issue 226363003: [CSS Shapes] Simplify Polygon implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | « Source/core/rendering/shapes/ShapeInterval.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, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2005 Nokia. All rights reserved. 3 * Copyright (C) 2005 Nokia. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void uniteIfNonZero(const FloatRect&); 135 void uniteIfNonZero(const FloatRect&);
136 void extend(const FloatPoint&); 136 void extend(const FloatPoint&);
137 137
138 // Note, this doesn't match what IntRect::contains(IntPoint&) does; the int version 138 // Note, this doesn't match what IntRect::contains(IntPoint&) does; the int version
139 // is really checking for containment of 1x1 rect, but that doesn't make sen se with floats. 139 // is really checking for containment of 1x1 rect, but that doesn't make sen se with floats.
140 bool contains(float px, float py) const 140 bool contains(float px, float py) const
141 { 141 {
142 return px >= x() && px <= maxX() && py >= y() && py <= maxY(); 142 return px >= x() && px <= maxX() && py >= y() && py <= maxY();
143 } 143 }
144 144
145 bool overlapsYRange(float y1, float y2) const { return !isEmpty() && y2 >= y 1 && y2 >= y() && y1 <= maxY(); }
Stephen Chennney 2014/04/04 20:42:35 I don't think this should be in FloatRect. It's c
146 bool overlapsXRange(float x1, float x2) const { return !isEmpty() && x2 >= x 1 && x2 >= x() && x1 <= maxX(); }
Stephen Chennney 2014/04/04 20:42:35 Ditto.
147
145 void inflateX(float dx) 148 void inflateX(float dx)
146 { 149 {
147 m_location.setX(m_location.x() - dx); 150 m_location.setX(m_location.x() - dx);
148 m_size.setWidth(m_size.width() + dx + dx); 151 m_size.setWidth(m_size.width() + dx + dx);
149 } 152 }
150 void inflateY(float dy) 153 void inflateY(float dy)
151 { 154 {
152 m_location.setY(m_location.y() - dy); 155 m_location.setY(m_location.y() - dy);
153 m_size.setHeight(m_size.height() + dy + dy); 156 m_size.setHeight(m_size.height() + dy + dy);
154 } 157 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&); 236 PLATFORM_EXPORT IntRect enclosedIntRect(const FloatRect&);
234 237
235 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&); 238 PLATFORM_EXPORT IntRect roundedIntRect(const FloatRect&);
236 239
237 // Map supplied rect from srcRect to an equivalent rect in destRect. 240 // Map supplied rect from srcRect to an equivalent rect in destRect.
238 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co nst FloatRect& destRect); 241 PLATFORM_EXPORT FloatRect mapRect(const FloatRect&, const FloatRect& srcRect, co nst FloatRect& destRect);
239 242
240 } 243 }
241 244
242 #endif 245 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/ShapeInterval.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698