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

Unified Diff: cc/math_util.cc

Issue 11312154: cc: Add some early outs to avoid expensive operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extra casts 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
« no previous file with comments | « no previous file | cc/occlusion_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/math_util.cc
diff --git a/cc/math_util.cc b/cc/math_util.cc
index f18b840146025accc4bbf8541eafcbc38dcf641a..ecad845a752bc2c73e94d0e2bd0fe9bb1dd3bf68 100644
--- a/cc/math_util.cc
+++ b/cc/math_util.cc
@@ -117,7 +117,7 @@ gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, co
}
// Apply the transform, but retain the result in homogeneous coordinates.
- gfx::QuadF q = gfx::QuadF(gfx::RectF(srcRect));
+ gfx::QuadF q = gfx::QuadF(srcRect);
HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, gfx::Point3F(q.p1()));
HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, gfx::Point3F(q.p2()));
HomogeneousCoordinate h3 = mapHomogeneousPoint(transform, gfx::Point3F(q.p3()));
@@ -128,8 +128,14 @@ 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;
+ }
+
// Perform the projection, but retain the result in homogeneous coordinates.
- gfx::QuadF q = gfx::QuadF(gfx::RectF(srcRect));
+ gfx::QuadF q = gfx::QuadF(srcRect);
HomogeneousCoordinate h1 = projectHomogeneousPoint(transform, q.p1());
HomogeneousCoordinate h2 = projectHomogeneousPoint(transform, q.p2());
HomogeneousCoordinate h3 = projectHomogeneousPoint(transform, q.p3());
« no previous file with comments | « no previous file | cc/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698