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

Unified Diff: cc/math_util.cc

Issue 11293194: ui: Prefer +/- operators to apply offsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: floats Created 8 years, 1 month 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
Index: cc/math_util.cc
diff --git a/cc/math_util.cc b/cc/math_util.cc
index ecad845a752bc2c73e94d0e2bd0fe9bb1dd3bf68..7639e62261e7a8478dd07a33801c269d25a9c1f1 100644
--- a/cc/math_util.cc
+++ b/cc/math_util.cc
@@ -110,11 +110,8 @@ gfx::Rect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, con
gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
{
- if (transform.isIdentityOrTranslation()) {
- gfx::RectF mappedRect(srcRect);
- mappedRect.Offset(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
- return mappedRect;
- }
+ if (transform.isIdentityOrTranslation())
+ return srcRect + gfx::Vector2dF(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
// Apply the transform, but retain the result in homogeneous coordinates.
gfx::QuadF q = gfx::QuadF(srcRect);
@@ -128,11 +125,8 @@ gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, co
gfx::RectF MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
{
- if (transform.isIdentityOrTranslation()) {
- gfx::RectF projectedRect(srcRect);
- projectedRect.Offset(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
- return projectedRect;
- }
+ if (transform.isIdentityOrTranslation())
+ return srcRect + gfx::Vector2dF(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
// Perform the projection, but retain the result in homogeneous coordinates.
gfx::QuadF q = gfx::QuadF(srcRect);

Powered by Google App Engine
This is Rietveld 408576698