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

Side by Side Diff: Source/platform/geometry/FloatRoundedRect.cpp

Issue 1136083002: Drop assert for degenerate cases in FloatRoundedRect::radiusCenterRect() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/geometry/FloatRoundedRectTest.cpp » ('j') | 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) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 #endif 151 #endif
152 152
153 static inline float cornerRectIntercept(float y, const FloatRect& cornerRect) 153 static inline float cornerRectIntercept(float y, const FloatRect& cornerRect)
154 { 154 {
155 ASSERT(cornerRect.height() > 0); 155 ASSERT(cornerRect.height() > 0);
156 return cornerRect.width() * sqrt(1 - (y * y) / (cornerRect.height() * corner Rect.height())); 156 return cornerRect.width() * sqrt(1 - (y * y) / (cornerRect.height() * corner Rect.height()));
157 } 157 }
158 158
159 FloatRect FloatRoundedRect::radiusCenterRect() const 159 FloatRect FloatRoundedRect::radiusCenterRect() const
160 { 160 {
161 ASSERT(isRenderable()); 161 FloatRectOutsets maximumRadiusInsets(
162 int minX = m_rect.x() + std::max(m_radii.topLeft().width(), m_radii.bottomLe ft().width()); 162 -std::max(m_radii.topLeft().height(), m_radii.topRight().height()),
163 int minY = m_rect.y() + std::max(m_radii.topLeft().height(), m_radii.topRigh t().height()); 163 -std::max(m_radii.topRight().width(), m_radii.bottomRight().width()),
164 int maxX = m_rect.maxX() - std::max(m_radii.topRight().width(), m_radii.bott omRight().width()); 164 -std::max(m_radii.bottomLeft().height(), m_radii.bottomRight().height()) ,
165 int maxY = m_rect.maxY() - std::max(m_radii.bottomLeft().height(), m_radii.b ottomRight().height()); 165 -std::max(m_radii.topLeft().width(), m_radii.bottomLeft().width()));
166 return FloatRect(minX, minY, maxX - minX, maxY - minY); 166 FloatRect centerRect(m_rect);
167 centerRect.expand(maximumRadiusInsets);
168 return centerRect;
167 } 169 }
168 170
169 bool FloatRoundedRect::xInterceptsAtY(float y, float& minXIntercept, float& maxX Intercept) const 171 bool FloatRoundedRect::xInterceptsAtY(float y, float& minXIntercept, float& maxX Intercept) const
170 { 172 {
171 if (y < rect().y() || y > rect().maxY()) 173 if (y < rect().y() || y > rect().maxY())
172 return false; 174 return false;
173 175
174 if (!isRounded()) { 176 if (!isRounded()) {
175 minXIntercept = rect().x(); 177 minXIntercept = rect().x();
176 maxXIntercept = rect().maxX(); 178 maxXIntercept = rect().maxX();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 void FloatRoundedRect::show() 354 void FloatRoundedRect::show()
353 { 355 {
354 fprintf(stderr, "FloatRoundedRect:\n rect: "); 356 fprintf(stderr, "FloatRoundedRect:\n rect: ");
355 m_rect.show(); 357 m_rect.show();
356 fprintf(stderr, " radii: "); 358 fprintf(stderr, " radii: ");
357 m_radii.show(); 359 m_radii.show();
358 } 360 }
359 #endif 361 #endif
360 362
361 } // namespace blink 363 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/geometry/FloatRoundedRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698