Chromium Code Reviews| Index: cc/math_util.cc |
| =================================================================== |
| --- cc/math_util.cc (revision 171781) |
| +++ cc/math_util.cc (working copy) |
| @@ -109,15 +109,23 @@ |
| { |
| if (transform.IsIdentityOrTranslation()) |
| return srcRect + gfx::Vector2dF(static_cast<float>(transform.matrix().getDouble(0, 3)), static_cast<float>(transform.matrix().getDouble(1, 3))); |
| - |
| + |
| // Apply the transform, but retain the result in homogeneous coordinates. |
| - 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())); |
| - HomogeneousCoordinate h4 = mapHomogeneousPoint(transform, gfx::Point3F(q.p4())); |
| - return computeEnclosingClippedRect(h1, h2, h3, h4); |
| + double quad[4 * 2]; // input: 4 x 2D points |
| + quad[0] = srcRect.x(); quad[1] = srcRect.y(); |
|
danakj
2012/12/07 18:26:34
nit: one statement per line
reed1
2012/12/07 19:12:27
Done.
|
| + quad[2] = srcRect.right(); quad[3] = srcRect.y(); |
| + quad[4] = srcRect.x(); quad[5] = srcRect.bottom(); |
|
danakj
2012/12/07 18:26:34
Does the ordering here end up producing a twisted
reed1
2012/12/07 19:12:27
Done.
|
| + quad[6] = srcRect.right(); quad[7] = srcRect.bottom(); |
| + |
| + double result[4 * 4]; // output: 4 x 4D homogeneous points |
| + transform.matrix().map2(quad, 4, result); |
| + |
| + HomogeneousCoordinate hc0(result[0], result[1], result[2], result[3]); |
|
danakj
2012/12/07 18:26:34
nit: one space between each.
we don't line things
reed1
2012/12/07 19:12:27
Done.
|
| + HomogeneousCoordinate hc1(result[4], result[5], result[6], result[7]); |
| + HomogeneousCoordinate hc2(result[8], result[9], result[10], result[11]); |
| + HomogeneousCoordinate hc3(result[12], result[13], result[14], result[15]); |
| + return computeEnclosingClippedRect(hc0, hc1, hc2, hc3); |
| } |
| gfx::RectF MathUtil::projectClippedRect(const gfx::Transform& transform, const gfx::RectF& srcRect) |