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

Unified Diff: Source/platform/geometry/IntRect.cpp

Issue 25494003: Move geometry classes from core/platform/graphics to platform/geometry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/geometry/IntRect.h ('k') | Source/platform/geometry/IntRectExtent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/geometry/IntRect.cpp
diff --git a/Source/core/platform/graphics/IntRect.cpp b/Source/platform/geometry/IntRect.cpp
similarity index 79%
rename from Source/core/platform/graphics/IntRect.cpp
rename to Source/platform/geometry/IntRect.cpp
index d8f2ad0fbad37b2c21796bed7affe5ad3dca5564..6768f84e514076cf9f1e899403d10b15decb75d9 100644
--- a/Source/core/platform/graphics/IntRect.cpp
+++ b/Source/platform/geometry/IntRect.cpp
@@ -24,17 +24,14 @@
*/
#include "config.h"
-#include "core/platform/graphics/IntRect.h"
+#include "platform/geometry/IntRect.h"
-#include "core/platform/graphics/FloatRect.h"
-#include "core/platform/graphics/LayoutRect.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/LayoutRect.h"
#include "third_party/skia/include/core/SkRect.h"
#include <algorithm>
-using std::max;
-using std::min;
-
namespace WebCore {
IntRect::IntRect(const FloatRect& r)
@@ -65,23 +62,23 @@ bool IntRect::contains(const IntRect& other) const
void IntRect::intersect(const IntRect& other)
{
- int l = max(x(), other.x());
- int t = max(y(), other.y());
- int r = min(maxX(), other.maxX());
- int b = min(maxY(), other.maxY());
+ int left = std::max(x(), other.x());
+ int top = std::max(y(), other.y());
+ int right = std::min(maxX(), other.maxX());
+ int bottom = std::min(maxY(), other.maxY());
// Return a clean empty rectangle for non-intersecting cases.
- if (l >= r || t >= b) {
- l = 0;
- t = 0;
- r = 0;
- b = 0;
+ if (left >= right || top >= bottom) {
+ left = 0;
+ top = 0;
+ right = 0;
+ bottom = 0;
}
- m_location.setX(l);
- m_location.setY(t);
- m_size.setWidth(r - l);
- m_size.setHeight(b - t);
+ m_location.setX(left);
+ m_location.setY(top);
+ m_size.setWidth(right - left);
+ m_size.setHeight(bottom - top);
}
void IntRect::unite(const IntRect& other)
@@ -94,15 +91,15 @@ void IntRect::unite(const IntRect& other)
return;
}
- int l = min(x(), other.x());
- int t = min(y(), other.y());
- int r = max(maxX(), other.maxX());
- int b = max(maxY(), other.maxY());
+ int left = std::min(x(), other.x());
+ int top = std::min(y(), other.y());
+ int right = std::max(maxX(), other.maxX());
+ int bottom = std::max(maxY(), other.maxY());
- m_location.setX(l);
- m_location.setY(t);
- m_size.setWidth(r - l);
- m_size.setHeight(b - t);
+ m_location.setX(left);
+ m_location.setY(top);
+ m_size.setWidth(right - left);
+ m_size.setHeight(bottom - top);
}
void IntRect::uniteIfNonZero(const IntRect& other)
@@ -115,10 +112,10 @@ void IntRect::uniteIfNonZero(const IntRect& other)
return;
}
- int left = min(x(), other.x());
- int top = min(y(), other.y());
- int right = max(maxX(), other.maxX());
- int bottom = max(maxY(), other.maxY());
+ int left = std::min(x(), other.x());
+ int top = std::min(y(), other.y());
+ int right = std::max(maxX(), other.maxX());
+ int bottom = std::max(maxY(), other.maxY());
m_location.setX(left);
m_location.setY(top);
« no previous file with comments | « Source/platform/geometry/IntRect.h ('k') | Source/platform/geometry/IntRectExtent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698