Changeset 89625 in webkit
- Timestamp:
- Jun 23, 2011, 3:15:00 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/FloatPoint.h (modified) (1 diff)
-
platform/graphics/FloatRect.h (modified) (2 diffs)
-
platform/graphics/FloatSize.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89624 r89625 1 2011-06-23 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 FloatRect should implement the same methods as IntRect 6 https://bugs.webkit.org/show_bug.cgi?id=63273 7 8 Add missing methods from IntRect to FloatRect in preparation for moving 9 the rendering tree over to floats. 10 11 * platform/graphics/FloatPoint.h: 12 (WebCore::FloatPoint::expandedTo): 13 (WebCore::FloatPoint::transposedPoint): 14 * platform/graphics/FloatRect.h: 15 (WebCore::FloatRect::move): 16 (WebCore::FloatRect::expand): 17 (WebCore::FloatRect::contract): 18 (WebCore::FloatRect::shiftXEdgeTo): 19 (WebCore::FloatRect::shiftMaxXEdgeTo): 20 (WebCore::FloatRect::shiftYEdgeTo): 21 (WebCore::FloatRect::shiftMaxYEdgeTo): 22 (WebCore::FloatRect::minXMinYCorner): 23 (WebCore::FloatRect::maxXMinYCorner): 24 (WebCore::FloatRect::minXMaxYCorner): 25 (WebCore::FloatRect::maxXMaxYCorner): 26 (WebCore::FloatRect::transposedRect): 27 * platform/graphics/FloatSize.h: 28 (WebCore::FloatSize::expand): 29 (WebCore::FloatSize::transposedSize): 30 1 31 2011-06-23 Emil A Eklund <eae@chromium.org> 2 32 -
trunk/Source/WebCore/platform/graphics/FloatPoint.h
r89496 r89625 124 124 { 125 125 return FloatPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y)); 126 } 126 } 127 128 FloatPoint transposedPoint() const 129 { 130 return FloatPoint(m_y, m_x); 131 } 127 132 128 133 #if USE(CG) || USE(SKIA_ON_MAC_CHROME) -
trunk/Source/WebCore/platform/graphics/FloatRect.h
r89496 r89625 107 107 108 108 void move(const FloatSize& delta) { m_location += delta; } 109 void moveBy(const FloatPoint& delta) { m_location.move(delta.x(), delta.y()); } 109 110 void move(float dx, float dy) { m_location.move(dx, dy); } 110 void moveBy(const FloatPoint& delta) { m_location.move(delta.x(), delta.y()); } 111 112 void expand(const FloatSize& size) { m_size += size; } 113 void expand(float dw, float dh) { m_size.expand(dw, dh); } 114 void contract(const FloatSize& size) { m_size -= size; } 115 void contract(float dw, float dh) { m_size.expand(-dw, -dh); } 116 117 void shiftXEdgeTo(float edge) 118 { 119 float delta = edge - x(); 120 setX(edge); 121 setWidth(std::max(0.0f, width() - delta)); 122 } 123 void shiftMaxXEdgeTo(float edge) 124 { 125 float delta = edge - maxX(); 126 setWidth(std::max(0.0f, width() + delta)); 127 } 128 void shiftYEdgeTo(float edge) 129 { 130 float delta = edge - y(); 131 setY(edge); 132 setHeight(std::max(0.0f, height() - delta)); 133 } 134 void shiftMaxYEdgeTo(float edge) 135 { 136 float delta = edge - maxY(); 137 setHeight(std::max(0.0f, height() + delta)); 138 } 139 140 FloatPoint minXMinYCorner() const { return m_location; } // typically topLeft 141 FloatPoint maxXMinYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y()); } // typically topRight 142 FloatPoint minXMaxYCorner() const { return FloatPoint(m_location.x(), m_location.y() + m_size.height()); } // typically bottomLeft 143 FloatPoint maxXMaxYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y() + m_size.height()); } // typically bottomRight 111 144 112 145 bool intersects(const FloatRect&) const; … … 135 168 void scale(float sx, float sy); 136 169 170 FloatRect transposedRect() const { return FloatRect(m_location.transposedPoint(), m_size.transposedSize()); } 171 137 172 // Re-initializes this rectangle to fit the sets of passed points. 138 173 void fitToPoints(const FloatPoint& p0, const FloatPoint& p1); -
trunk/Source/WebCore/platform/graphics/FloatSize.h
r89496 r89625 66 66 float aspectRatio() const { return m_width / m_height; } 67 67 68 void expand(float width, float height) 69 { 70 m_width += width; 71 m_height += height; 72 } 73 68 74 void scale(float s) { scale(s, s); } 69 75 … … 90 96 { 91 97 return m_width * m_width + m_height * m_height; 98 } 99 100 FloatSize transposedSize() const 101 { 102 return FloatSize(m_height, m_width); 92 103 } 93 104
Note:
See TracChangeset
for help on using the changeset viewer.