summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/cc.gyp2
-rw-r--r--cc/damage_tracker_unittest.cc2
-rw-r--r--cc/float_quad_unittest.cc11
-rw-r--r--cc/gl_renderer.cc31
-rw-r--r--cc/gl_renderer.h7
-rw-r--r--cc/layer_quad.cc9
-rw-r--r--cc/layer_quad.h10
-rw-r--r--cc/layer_quad_unittest.cc17
-rw-r--r--cc/layer_sorter.cc16
-rw-r--r--cc/layer_sorter.h4
-rw-r--r--cc/layer_sorter_unittest.cc2
-rw-r--r--cc/layer_tree_host_common_unittest.cc4
-rw-r--r--cc/layer_tree_host_impl.h1
-rw-r--r--cc/math_util.cc32
-rw-r--r--cc/math_util.h8
-rw-r--r--cc/occlusion_tracker.cc16
-rw-r--r--cc/occlusion_tracker.h1
-rw-r--r--cc/overdraw_metrics.cc16
-rw-r--r--cc/renderer.h1
-rw-r--r--cc/stubs/float_quad.h87
-rw-r--r--cc/tiled_layer_impl.cc6
21 files changed, 102 insertions, 181 deletions
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 24973eb..15bcc69 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -257,7 +257,6 @@
'sources': [
'<@(cc_source_files)',
'stubs/FloatPoint.h',
- 'stubs/FloatQuad.h',
'stubs/FloatRect.h',
'stubs/FloatSize.h',
'stubs/IntPoint.h',
@@ -269,7 +268,6 @@
'stubs/config.h',
'stubs/float_point.h',
- 'stubs/float_quad.h',
'stubs/float_rect.h',
'stubs/float_size.h',
'stubs/int_point.h',
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc
index 22280e4..6c24c67 100644
--- a/cc/damage_tracker_unittest.cc
+++ b/cc/damage_tracker_unittest.cc
@@ -348,7 +348,7 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
// Sanity check that the child layer's bounds would actually get clipped by w < 0,
// otherwise this test is not actually testing the intended scenario.
- FloatQuad testQuad(gfx::RectF(gfx::PointF(), gfx::SizeF(100, 100)));
+ gfx::QuadF testQuad(gfx::RectF(gfx::PointF(), gfx::SizeF(100, 100)));
bool clipped = false;
MathUtil::mapQuad(transform, testQuad, clipped);
EXPECT_TRUE(clipped);
diff --git a/cc/float_quad_unittest.cc b/cc/float_quad_unittest.cc
index d4a4976..ebcdc28 100644
--- a/cc/float_quad_unittest.cc
+++ b/cc/float_quad_unittest.cc
@@ -4,10 +4,10 @@
#include "config.h"
-#include "FloatQuad.h"
#include "cc/math_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/rect_f.h"
+#include "ui/gfx/quad_f.h"
#include <public/WebTransformationMatrix.h>
using namespace cc;
@@ -15,6 +15,7 @@ using WebKit::WebTransformationMatrix;
namespace {
+// TODO(danakj) Move this test to ui/gfx/ when we don't use WebTransformationMatrix.
TEST(FloatQuadTest, IsRectilinearTest)
{
const int numRectilinear = 8;
@@ -31,9 +32,9 @@ TEST(FloatQuadTest, IsRectilinearTest)
for (int i = 0; i < numRectilinear; ++i) {
bool clipped = false;
- FloatQuad quad = MathUtil::mapQuad(rectilinearTrans[i], gfx::RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped);
+ gfx::QuadF quad = MathUtil::mapQuad(rectilinearTrans[i], gfx::QuadF(gfx::RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)), clipped);
ASSERT_TRUE(!clipped);
- EXPECT_TRUE(quad.isRectilinear());
+ EXPECT_TRUE(quad.IsRectilinear());
}
const int numNonRectilinear = 10;
@@ -51,9 +52,9 @@ TEST(FloatQuadTest, IsRectilinearTest)
for (int i = 0; i < numNonRectilinear; ++i) {
bool clipped = false;
- FloatQuad quad = MathUtil::mapQuad(nonRectilinearTrans[i], gfx::RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f), clipped);
+ gfx::QuadF quad = MathUtil::mapQuad(nonRectilinearTrans[i], gfx::QuadF(gfx::RectF(0.01010101f, 0.01010101f, 100.01010101f, 100.01010101f)), clipped);
ASSERT_TRUE(!clipped);
- EXPECT_FALSE(quad.isRectilinear());
+ EXPECT_FALSE(quad.IsRectilinear());
}
}
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index 35444b3..016edd5 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -6,7 +6,7 @@
#include "cc/gl_renderer.h"
-#include "FloatQuad.h"
+#include "FloatRect.h"
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/string_split.h"
@@ -34,6 +34,7 @@
#include "third_party/skia/include/gpu/GrTexture.h"
#include "third_party/skia/include/gpu/SkGpuDevice.h"
#include "third_party/skia/include/gpu/SkGrTexturePixelRef.h"
+#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect_conversions.h"
#include <public/WebGraphicsContext3D.h>
#include <public/WebSharedGraphicsContext3D.h>
@@ -456,7 +457,7 @@ scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters(DrawingFrame& frame,
DCHECK(!frame.currentTexture);
// FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused).
- gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox()));
+ gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().BoundingBox()));
int top, right, bottom, left;
filters.getOutsets(top, right, bottom, left);
@@ -545,13 +546,13 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
}
bool clipped = false;
- FloatQuad deviceQuad = MathUtil::mapQuad(contentsDeviceTransform, sharedGeometryQuad(), clipped);
+ gfx::QuadF deviceQuad = MathUtil::mapQuad(contentsDeviceTransform, sharedGeometryQuad(), clipped);
DCHECK(!clipped);
- LayerQuad deviceLayerBounds = LayerQuad(FloatQuad(deviceQuad.boundingBox()));
+ LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceQuad.BoundingBox()));
LayerQuad deviceLayerEdges = LayerQuad(deviceQuad);
// Use anti-aliasing programs only when necessary.
- bool useAA = (!deviceQuad.isRectilinear() || !cc::FloatRect(deviceQuad.boundingBox()).isExpressibleAsIntRect());
+ bool useAA = (!deviceQuad.IsRectilinear() || !cc::FloatRect(deviceQuad.BoundingBox()).isExpressibleAsIntRect());
if (useAA) {
deviceLayerBounds.inflateAntiAliasingDistance();
deviceLayerEdges.inflateAntiAliasingDistance();
@@ -635,11 +636,11 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
}
// Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project.
- FloatQuad surfaceQuad = MathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped);
+ gfx::QuadF surfaceQuad = MathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.ToQuadF(), clipped);
DCHECK(!clipped);
setShaderOpacity(quad->opacity(), shaderAlphaLocation);
- setShaderFloatQuad(surfaceQuad, shaderQuadLocation);
+ setShaderQuadF(surfaceQuad, shaderQuadLocation);
drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation);
}
@@ -714,13 +715,13 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
float fragmentTexScaleY = clampRect.height() / textureSize.height();
- FloatQuad localQuad;
+ gfx::QuadF localQuad;
WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.windowMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform();
if (!deviceTransform.isInvertible())
return;
bool clipped = false;
- FloatQuad deviceLayerQuad = MathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped);
+ gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(quad->visibleContentRect()), clipped);
DCHECK(!clipped);
TileProgramUniforms uniforms;
@@ -755,7 +756,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
bool useAA = !clipped && quad->isAntialiased();
if (useAA) {
- LayerQuad deviceLayerBounds = LayerQuad(FloatQuad(deviceLayerQuad.boundingBox()));
+ LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceLayerQuad.BoundingBox()));
deviceLayerBounds.inflateAntiAliasingDistance();
LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad);
@@ -799,7 +800,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
if (quad->bottomEdgeAA() && tileRect.bottom() == quad->quadRect().bottom())
bottomEdge = deviceLayerEdges.bottom();
- float sign = FloatQuad(tileRect).isCounterclockwise() ? -1 : 1;
+ float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
bottomEdge.scale(sign);
leftEdge.scale(sign);
topEdge.scale(sign);
@@ -810,7 +811,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
// Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project.
WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse();
- localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped);
+ localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF(), clipped);
// We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
// clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case.
@@ -832,10 +833,10 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
}
// Normalize to tileRect.
- localQuad.scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
+ localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
setShaderOpacity(quad->opacity(), uniforms.alphaLocation);
- setShaderFloatQuad(localQuad, uniforms.pointLocation);
+ setShaderQuadF(localQuad, uniforms.pointLocation);
// The tile quad shader behaves differently compared to all other shaders.
// The transform and vertex data are used to figure out the extents that the
@@ -1051,7 +1052,7 @@ void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m)
flattened[15] = m.m44();
}
-void GLRenderer::setShaderFloatQuad(const FloatQuad& quad, int quadLocation)
+void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation)
{
if (quadLocation == -1)
return;
diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h
index cb03c06..7d39f18 100644
--- a/cc/gl_renderer.h
+++ b/cc/gl_renderer.h
@@ -14,6 +14,7 @@
#include "cc/solid_color_draw_quad.h"
#include "cc/tile_draw_quad.h"
#include "cc/yuv_video_draw_quad.h"
+#include "ui/gfx/quad_f.h"
namespace WebKit {
class WebGraphicsContext3D;
@@ -66,7 +67,7 @@ protected:
bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
bool initialize();
- const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
+ const gfx::QuadF& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
bool getFramebufferTexture(ScopedTexture*, const gfx::Rect& deviceRect);
@@ -99,7 +100,7 @@ private:
void drawYUVVideoQuad(const DrawingFrame&, const YUVVideoDrawQuad*);
void setShaderOpacity(float opacity, int alphaLocation);
- void setShaderFloatQuad(const FloatQuad&, int quadLocation);
+ void setShaderQuadF(const gfx::QuadF&, int quadLocation);
void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMatrix& drawTransform, const gfx::RectF& quadRect, int matrixLocation);
void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx::Rect&, const WebKit::WebTransformationMatrix& drawMatrix);
@@ -129,7 +130,7 @@ private:
unsigned m_offscreenFramebufferId;
scoped_ptr<GeometryBinding> m_sharedGeometry;
- FloatQuad m_sharedGeometryQuad;
+ gfx::QuadF m_sharedGeometryQuad;
// This block of bindings defines all of the programs used by the compositor itself.
diff --git a/cc/layer_quad.cc b/cc/layer_quad.cc
index a510ea8..0a66873 100644
--- a/cc/layer_quad.cc
+++ b/cc/layer_quad.cc
@@ -7,6 +7,7 @@
#include "cc/layer_quad.h"
#include "base/logging.h"
+#include "ui/gfx/quad_f.h"
namespace cc {
@@ -21,7 +22,7 @@ LayerQuad::Edge::Edge(const gfx::PointF& p, const gfx::PointF& q)
scale(1.0f / tangent.Length());
}
-LayerQuad::LayerQuad(const FloatQuad& quad)
+LayerQuad::LayerQuad(const gfx::QuadF& quad)
{
// Create edges.
m_left = Edge(quad.p4(), quad.p1());
@@ -29,7 +30,7 @@ LayerQuad::LayerQuad(const FloatQuad& quad)
m_top = Edge(quad.p1(), quad.p2());
m_bottom = Edge(quad.p3(), quad.p4());
- float sign = quad.isCounterclockwise() ? -1 : 1;
+ float sign = quad.IsCounterClockwise() ? -1 : 1;
m_left.scale(sign);
m_right.scale(sign);
m_top.scale(sign);
@@ -44,9 +45,9 @@ LayerQuad::LayerQuad(const Edge& left, const Edge& top, const Edge& right, const
{
}
-FloatQuad LayerQuad::floatQuad() const
+gfx::QuadF LayerQuad::ToQuadF() const
{
- return FloatQuad(m_left.intersect(m_top),
+ return gfx::QuadF(m_left.intersect(m_top),
m_top.intersect(m_right),
m_right.intersect(m_bottom),
m_bottom.intersect(m_left));
diff --git a/cc/layer_quad.h b/cc/layer_quad.h
index 7283d9ca..4de7bd8 100644
--- a/cc/layer_quad.h
+++ b/cc/layer_quad.h
@@ -6,7 +6,11 @@
#ifndef CCLayerQuad_h
#define CCLayerQuad_h
-#include "FloatQuad.h"
+#include "ui/gfx/point_f.h"
+
+namespace gfx {
+class QuadF;
+}
static const float kAntiAliasingInflateDistance = 0.5f;
@@ -73,7 +77,7 @@ public:
};
LayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom);
- LayerQuad(const FloatQuad&);
+ LayerQuad(const gfx::QuadF&);
Edge left() const { return m_left; }
Edge top() const { return m_top; }
@@ -85,7 +89,7 @@ public:
void inflate(float d) { inflateX(d); inflateY(d); }
void inflateAntiAliasingDistance() { inflate(kAntiAliasingInflateDistance); }
- FloatQuad floatQuad() const;
+ gfx::QuadF ToQuadF() const;
void toFloatArray(float[12]) const;
diff --git a/cc/layer_quad_unittest.cc b/cc/layer_quad_unittest.cc
index 8aa9adb..23b0d09 100644
--- a/cc/layer_quad_unittest.cc
+++ b/cc/layer_quad_unittest.cc
@@ -7,25 +7,26 @@
#include "cc/layer_quad.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/quad_f.h"
using namespace cc;
namespace {
-TEST(LayerQuadTest, FloatQuadConversion)
+TEST(LayerQuadTest, QuadFConversion)
{
gfx::PointF p1(-0.5, -0.5);
gfx::PointF p2( 0.5, -0.5);
gfx::PointF p3( 0.5, 0.5);
gfx::PointF p4(-0.5, 0.5);
- FloatQuad quadCW(p1, p2, p3, p4);
+ gfx::QuadF quadCW(p1, p2, p3, p4);
LayerQuad layerQuadCW(quadCW);
- EXPECT_TRUE(layerQuadCW.floatQuad() == quadCW);
+ EXPECT_TRUE(layerQuadCW.ToQuadF() == quadCW);
- FloatQuad quadCCW(p1, p4, p3, p2);
+ gfx::QuadF quadCCW(p1, p4, p3, p2);
LayerQuad layerQuadCCW(quadCCW);
- EXPECT_TRUE(layerQuadCCW.floatQuad() == quadCCW);
+ EXPECT_TRUE(layerQuadCCW.ToQuadF() == quadCCW);
}
TEST(LayerQuadTest, Inflate)
@@ -35,11 +36,11 @@ TEST(LayerQuadTest, Inflate)
gfx::PointF p3( 0.5, 0.5);
gfx::PointF p4(-0.5, 0.5);
- FloatQuad quad(p1, p2, p3, p4);
+ gfx::QuadF quad(p1, p2, p3, p4);
LayerQuad layerQuad(quad);
- quad.scale(2, 2);
+ quad.Scale(2, 2);
layerQuad.inflate(0.5);
- EXPECT_TRUE(layerQuad.floatQuad() == quad);
+ EXPECT_TRUE(layerQuad.ToQuadF() == quad);
}
} // namespace
diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc
index c4a540d..ca1e8b2 100644
--- a/cc/layer_sorter.cc
+++ b/cc/layer_sorter.cc
@@ -92,9 +92,9 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape
// Check all four corners of one layer against the other layer's quad.
for (int i = 0; i < 4; ++i) {
- if (a->projectedQuad.containsPoint(bPoints[i]))
+ if (a->projectedQuad.Contains(bPoints[i]))
overlapPoints.push_back(bPoints[i]);
- if (b->projectedQuad.containsPoint(aPoints[i]))
+ if (b->projectedQuad.Contains(aPoints[i]))
overlapPoints.push_back(aPoints[i]);
}
@@ -149,7 +149,7 @@ LayerShape::LayerShape()
LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& drawTransform)
{
- FloatQuad layerQuad(gfx::RectF(0, 0, width, height));
+ gfx::QuadF layerQuad(gfx::RectF(0, 0, width, height));
// Compute the projection of the layer quad onto the z = 0 plane.
@@ -169,13 +169,13 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix&
// sorting it is equally correct to take a subsection of the polygon that can be made
// into a quad. This will only be incorrect in the case of intersecting layers, which
// are not supported yet anyway.
- projectedQuad.setP1(clippedQuad[0]);
- projectedQuad.setP2(clippedQuad[1]);
- projectedQuad.setP3(clippedQuad[2]);
+ projectedQuad.set_p1(clippedQuad[0]);
+ projectedQuad.set_p2(clippedQuad[1]);
+ projectedQuad.set_p3(clippedQuad[2]);
if (numVerticesInClippedQuad >= 4)
- projectedQuad.setP4(clippedQuad[3]);
+ projectedQuad.set_p4(clippedQuad[3]);
else
- projectedQuad.setP4(clippedQuad[2]); // this will be a degenerate quad that is actually a triangle.
+ projectedQuad.set_p4(clippedQuad[2]); // this will be a degenerate quad that is actually a triangle.
// Compute the normal of the layer's plane.
bool clipped = false;
diff --git a/cc/layer_sorter.h b/cc/layer_sorter.h
index 6c5b9c5..a129d66 100644
--- a/cc/layer_sorter.h
+++ b/cc/layer_sorter.h
@@ -5,11 +5,11 @@
#ifndef CCLayerSorter_h
#define CCLayerSorter_h
-#include "FloatQuad.h"
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "cc/layer_impl.h"
#include "ui/gfx/point3_f.h"
+#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect_f.h"
#include "ui/gfx/vector3d_f.h"
@@ -47,7 +47,7 @@ struct LayerShape {
gfx::Vector3dF layerNormal;
gfx::Point3F transformOrigin;
- FloatQuad projectedQuad;
+ gfx::QuadF projectedQuad;
gfx::RectF projectedBounds;
};
diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc
index 6c54fc5..4737c2e 100644
--- a/cc/layer_sorter_unittest.cc
+++ b/cc/layer_sorter_unittest.cc
@@ -178,7 +178,7 @@ TEST(LayerSorterTest, LayersUnderPathologicalPerspectiveTransform)
// Sanity check that the test case actually covers the intended scenario, where part
// of layer B go behind the w = 0 plane.
- FloatQuad testQuad = FloatQuad(gfx::RectF(-0.5, -0.5, 1, 1));
+ gfx::QuadF testQuad = gfx::QuadF(gfx::RectF(-0.5, -0.5, 1, 1));
bool clipped = false;
MathUtil::mapQuad(perspectiveMatrix * transformB, testQuad, clipped);
ASSERT_TRUE(clipped);
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index d25bb58..e18137a 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -1941,7 +1941,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
// Sanity check that this transform does indeed cause w < 0 when applying the
// transform, otherwise this code is not testing the intended scenario.
bool clipped = false;
- MathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(gfx::RectF(layerContentRect)), clipped);
+ MathUtil::mapQuad(layerToSurfaceTransform, gfx::QuadF(gfx::RectF(layerContentRect)), clipped);
ASSERT_TRUE(clipped);
int expectedXPosition = 0;
@@ -1972,7 +1972,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
// testing the intended scenario.
bool clipped = false;
gfx::RectF clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
- MathUtil::projectQuad(layerToSurfaceTransform.inverse(), FloatQuad(clippedRect), clipped);
+ MathUtil::projectQuad(layerToSurfaceTransform.inverse(), gfx::QuadF(clippedRect), clipped);
ASSERT_TRUE(clipped);
// Only the corner of the layer is not visible on the surface because of being
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index 036c6bd..2d4f175 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -5,6 +5,7 @@
#ifndef CCLayerTreeHostImpl_h
#define CCLayerTreeHostImpl_h
+#include "FloatPoint.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
diff --git a/cc/math_util.cc b/cc/math_util.cc
index f77300a..23fd588 100644
--- a/cc/math_util.cc
+++ b/cc/math_util.cc
@@ -6,8 +6,8 @@
#include "cc/math_util.h"
-#include "FloatQuad.h"
#include "FloatSize.h"
+#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/rect_f.h"
@@ -112,7 +112,7 @@ gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, co
}
// Apply the transform, but retain the result in homogeneous coordinates.
- FloatQuad q = FloatQuad(gfx::RectF(srcRect));
+ gfx::QuadF q = gfx::QuadF(gfx::RectF(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()));
@@ -124,7 +124,7 @@ gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, co
gfx::RectF MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
{
// Perform the projection, but retain the result in homogeneous coordinates.
- FloatQuad q = FloatQuad(gfx::RectF(srcRect));
+ gfx::QuadF q = gfx::QuadF(gfx::RectF(srcRect));
HomogeneousCoordinate h1 = projectHomogeneousPoint(transform, q.p1());
HomogeneousCoordinate h2 = projectHomogeneousPoint(transform, q.p2());
HomogeneousCoordinate h3 = projectHomogeneousPoint(transform, q.p3());
@@ -133,7 +133,7 @@ gfx::RectF MathUtil::projectClippedRect(const WebTransformationMatrix& transform
return computeEnclosingClippedRect(h1, h2, h3, h4);
}
-void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad)
+void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const gfx::QuadF& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad)
{
HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, gfx::Point3F(srcQuad.p1()));
HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, gfx::Point3F(srcQuad.p2()));
@@ -196,8 +196,8 @@ gfx::RectF MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1
// If no vertices on the quad are clipped, then we can simply return the enclosing rect directly.
bool somethingClipped = h1.shouldBeClipped() || h2.shouldBeClipped() || h3.shouldBeClipped() || h4.shouldBeClipped();
if (!somethingClipped) {
- FloatQuad mappedQuad = FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
- return mappedQuad.boundingBox();
+ gfx::QuadF mappedQuad = gfx::QuadF(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
+ return mappedQuad.BoundingBox();
}
bool everythingClipped = h1.shouldBeClipped() && h2.shouldBeClipped() && h3.shouldBeClipped() && h4.shouldBeClipped();
@@ -237,11 +237,11 @@ gfx::RectF MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1
return gfx::RectF(gfx::PointF(xmin, ymin), gfx::SizeF(xmax - xmin, ymax - ymin));
}
-FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped)
+gfx::QuadF MathUtil::mapQuad(const WebTransformationMatrix& transform, const gfx::QuadF& q, bool& clipped)
{
if (transform.isIdentityOrTranslation()) {
- FloatQuad mappedQuad(q);
- mappedQuad.move(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
+ gfx::QuadF mappedQuad(q);
+ mappedQuad += gfx::Vector2dF(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
clipped = false;
return mappedQuad;
}
@@ -254,7 +254,7 @@ FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const Floa
clipped = h1.shouldBeClipped() || h2.shouldBeClipped() || h3.shouldBeClipped() || h4.shouldBeClipped();
// Result will be invalid if clipped == true. But, compute it anyway just in case, to emulate existing behavior.
- return FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
+ return gfx::QuadF(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
}
gfx::PointF MathUtil::mapPoint(const WebTransformationMatrix& transform, const gfx::PointF& p, bool& clipped)
@@ -303,17 +303,17 @@ gfx::Point3F MathUtil::mapPoint(const WebTransformationMatrix& transform, const
return h.cartesianPoint3d();
}
-FloatQuad MathUtil::projectQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped)
+gfx::QuadF MathUtil::projectQuad(const WebTransformationMatrix& transform, const gfx::QuadF& q, bool& clipped)
{
- FloatQuad projectedQuad;
+ gfx::QuadF projectedQuad;
bool clippedPoint;
- projectedQuad.setP1(projectPoint(transform, q.p1(), clippedPoint));
+ projectedQuad.set_p1(projectPoint(transform, q.p1(), clippedPoint));
clipped = clippedPoint;
- projectedQuad.setP2(projectPoint(transform, q.p2(), clippedPoint));
+ projectedQuad.set_p2(projectPoint(transform, q.p2(), clippedPoint));
clipped |= clippedPoint;
- projectedQuad.setP3(projectPoint(transform, q.p3(), clippedPoint));
+ projectedQuad.set_p3(projectPoint(transform, q.p3(), clippedPoint));
clipped |= clippedPoint;
- projectedQuad.setP4(projectPoint(transform, q.p4(), clippedPoint));
+ projectedQuad.set_p4(projectPoint(transform, q.p4(), clippedPoint));
clipped |= clippedPoint;
return projectedQuad;
diff --git a/cc/math_util.h b/cc/math_util.h
index 1c2072a..dae4efb 100644
--- a/cc/math_util.h
+++ b/cc/math_util.h
@@ -14,13 +14,13 @@ class WebTransformationMatrix;
}
namespace gfx {
+class QuadF;
class Rect;
class RectF;
}
namespace cc {
-class FloatQuad;
class FloatSize;
struct HomogeneousCoordinate {
@@ -84,17 +84,17 @@ public:
// 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that
// numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and
// none of the vertices in the array are valid.
- static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
+ static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
static gfx::RectF computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices);
static gfx::RectF computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
// NOTE: These functions do not do correct clipping against w = 0 plane, but they
// correctly detect the clipped condition via the boolean clipped.
- static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
+ static gfx::QuadF mapQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF&, bool& clipped);
static gfx::PointF mapPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
static gfx::Point3F mapPoint(const WebKit::WebTransformationMatrix&, const gfx::Point3F&, bool& clipped);
- static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
+ static gfx::QuadF projectQuad(const WebKit::WebTransformationMatrix&, const gfx::QuadF&, bool& clipped);
static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index f31819d..1523362 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -8,10 +8,12 @@
#include <algorithm>
+#include "FloatRect.h"
#include "cc/layer.h"
#include "cc/layer_impl.h"
#include "cc/math_util.h"
#include "cc/overdraw_metrics.h"
+#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect_conversions.h"
using namespace std;
@@ -122,9 +124,9 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
// apply |transform| to each rect within |region| in order to transform the entire Region.
bool clipped;
- FloatQuad transformedBoundsQuad = MathUtil::mapQuad(transform, FloatQuad(region.bounds()), clipped);
+ gfx::QuadF transformedBoundsQuad = MathUtil::mapQuad(transform, gfx::QuadF(region.bounds()), clipped);
// FIXME: Find a rect interior to each transformed quad.
- if (clipped || !transformedBoundsQuad.isRectilinear())
+ if (clipped || !transformedBoundsQuad.IsRectilinear())
return Region();
Region transformedRegion;
@@ -251,9 +253,9 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye
DCHECK(layer->visibleContentRect().Contains(opaqueContents.bounds()));
bool clipped;
- FloatQuad visibleTransformedQuad = MathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped);
+ gfx::QuadF visibleTransformedQuad = MathUtil::mapQuad(transform, gfx::QuadF(layer->visibleContentRect()), clipped);
// FIXME: Find a rect interior to each transformed quad.
- if (clipped || !visibleTransformedQuad.isRectilinear())
+ if (clipped || !visibleTransformedQuad.IsRectilinear())
return;
Vector<WebCore::IntRect> contentRects = opaqueContents.rects();
@@ -297,11 +299,11 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
if (layerTransformsToScreenKnown(layer)) {
WebTransformationMatrix targetToScreenTransform = m_stack.last().target->renderSurface()->screenSpaceTransform();
bool clipped;
- FloatQuad clipQuadInScreen = MathUtil::mapQuad(targetToScreenTransform, FloatQuad(clipRectInTarget), clipped);
+ gfx::QuadF clipQuadInScreen = MathUtil::mapQuad(targetToScreenTransform, gfx::QuadF(clipRectInTarget), clipped);
// FIXME: Find a rect interior to the transformed clip quad.
- if (clipped || !clipQuadInScreen.isRectilinear())
+ if (clipped || !clipQuadInScreen.IsRectilinear())
return;
- gfx::Rect clipRectInScreen = gfx::IntersectRects(m_rootTargetRect, gfx::ToEnclosedRect(clipQuadInScreen.boundingBox()));
+ gfx::Rect clipRectInScreen = gfx::IntersectRects(m_rootTargetRect, gfx::ToEnclosedRect(clipQuadInScreen.BoundingBox()));
addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInScreen, layer, layer->screenSpaceTransform(), opaqueContents, clipRectInScreen, m_minimumTrackingSize, m_occludingScreenSpaceRects);
}
}
diff --git a/cc/occlusion_tracker.h b/cc/occlusion_tracker.h
index 841dea4..0bb6dc0 100644
--- a/cc/occlusion_tracker.h
+++ b/cc/occlusion_tracker.h
@@ -5,7 +5,6 @@
#ifndef CCOcclusionTracker_h
#define CCOcclusionTracker_h
-#include "FloatQuad.h"
#include "Region.h"
#include "base/basictypes.h"
#include "cc/layer_iterator.h"
diff --git a/cc/overdraw_metrics.cc b/cc/overdraw_metrics.cc
index 3e16f26..9509bfa 100644
--- a/cc/overdraw_metrics.cc
+++ b/cc/overdraw_metrics.cc
@@ -6,12 +6,12 @@
#include "cc/overdraw_metrics.h"
-#include "FloatQuad.h"
#include "base/debug/trace_event.h"
#include "base/metrics/histogram.h"
#include "cc/layer_tree_host.h"
#include "cc/layer_tree_host_impl.h"
#include "cc/math_util.h"
+#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect.h"
#include <public/WebTransformationMatrix.h>
@@ -51,7 +51,7 @@ static inline float polygonArea(const gfx::PointF points[8], int numPoints)
}
// Takes a given quad, maps it by the given transformation, and gives the area of the resulting polygon.
-static inline float areaOfMappedQuad(const WebTransformationMatrix& transform, const FloatQuad& quad)
+static inline float areaOfMappedQuad(const WebTransformationMatrix& transform, const gfx::QuadF& quad)
{
gfx::PointF clippedQuad[8];
int numVerticesInClippedQuad = 0;
@@ -78,8 +78,8 @@ void OverdrawMetrics::didUpload(const WebTransformationMatrix& transformToTarget
if (!m_recordMetricsForFrame)
return;
- float uploadArea = areaOfMappedQuad(transformToTarget, FloatQuad(uploadRect));
- float uploadOpaqueArea = areaOfMappedQuad(transformToTarget, FloatQuad(gfx::IntersectRects(opaqueRect, uploadRect)));
+ float uploadArea = areaOfMappedQuad(transformToTarget, gfx::QuadF(uploadRect));
+ float uploadOpaqueArea = areaOfMappedQuad(transformToTarget, gfx::QuadF(gfx::IntersectRects(opaqueRect, uploadRect)));
m_pixelsUploadedOpaque += uploadOpaqueArea;
m_pixelsUploadedTranslucent += uploadArea - uploadOpaqueArea;
@@ -106,8 +106,8 @@ void OverdrawMetrics::didCullForDrawing(const WebTransformationMatrix& transform
if (!m_recordMetricsForFrame)
return;
- float beforeCullArea = areaOfMappedQuad(transformToTarget, FloatQuad(beforeCullRect));
- float afterCullArea = areaOfMappedQuad(transformToTarget, FloatQuad(afterCullRect));
+ float beforeCullArea = areaOfMappedQuad(transformToTarget, gfx::QuadF(beforeCullRect));
+ float afterCullArea = areaOfMappedQuad(transformToTarget, gfx::QuadF(afterCullRect));
m_pixelsCulledForDrawing += beforeCullArea - afterCullArea;
}
@@ -117,8 +117,8 @@ void OverdrawMetrics::didDraw(const WebTransformationMatrix& transformToTarget,
if (!m_recordMetricsForFrame)
return;
- float afterCullArea = areaOfMappedQuad(transformToTarget, FloatQuad(afterCullRect));
- float afterCullOpaqueArea = areaOfMappedQuad(transformToTarget, FloatQuad(gfx::IntersectRects(opaqueRect, afterCullRect)));
+ float afterCullArea = areaOfMappedQuad(transformToTarget, gfx::QuadF(afterCullRect));
+ float afterCullOpaqueArea = areaOfMappedQuad(transformToTarget, gfx::QuadF(gfx::IntersectRects(opaqueRect, afterCullRect)));
m_pixelsDrawnOpaque += afterCullOpaqueArea;
m_pixelsDrawnTranslucent += afterCullArea - afterCullOpaqueArea;
diff --git a/cc/renderer.h b/cc/renderer.h
index 11e00fc..1b54a6a 100644
--- a/cc/renderer.h
+++ b/cc/renderer.h
@@ -5,7 +5,6 @@
#ifndef CCRenderer_h
#define CCRenderer_h
-#include "FloatQuad.h"
#include "base/basictypes.h"
#include "cc/layer_tree_host.h"
#include "cc/managed_memory_policy.h"
diff --git a/cc/stubs/float_quad.h b/cc/stubs/float_quad.h
deleted file mode 100644
index 33b4c08..0000000
--- a/cc/stubs/float_quad.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_STUBS_FLOATQUAD_H_
-#define CC_STUBS_FLOATQUAD_H_
-
-#include "ui/gfx/rect.h"
-#include "ui/gfx/rect_f.h"
-#include "FloatPoint.h"
-#include "FloatRect.h"
-#if INSIDE_WEBKIT_BUILD
-#include "Source/WebCore/platform/graphics/FloatQuad.h"
-#else
-#include "third_party/WebKit/Source/WebCore/platform/graphics/FloatQuad.h"
-#endif
-
-namespace cc {
-
-class FloatQuad : public WebCore::FloatQuad
-{
-public:
- FloatQuad() { }
-
- FloatQuad(const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3, const FloatPoint& p4)
- : WebCore::FloatQuad(p1, p2, p3, p4)
- {
- }
-
- FloatQuad(const FloatRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const IntRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const WebCore::FloatRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const WebCore::IntRect& rect)
- : WebCore::FloatQuad(rect)
- {
- }
-
- FloatQuad(const WebCore::FloatQuad& quad)
- : WebCore::FloatQuad(quad)
- {
- }
-
- FloatQuad(const gfx::Rect& rect)
- : WebCore::FloatQuad(WebCore::IntRect(rect.x(), rect.y(), rect.width(), rect.height()))
- {
- }
-
- FloatQuad(const gfx::RectF& rect)
- : WebCore::FloatQuad(WebCore::FloatRect(rect.x(), rect.y(), rect.width(), rect.height()))
- {
- }
-
- FloatQuad(const gfx::PointF& p1, const gfx::PointF& p2, const gfx::PointF& p3, const gfx::PointF& p4)
- : WebCore::FloatQuad(cc::FloatPoint(p1), cc::FloatPoint(p2), cc::FloatPoint(p3), cc::FloatPoint(p4))
- {
- }
-
- cc::FloatPoint p1() const { return cc::FloatPoint(WebCore::FloatQuad::p1()); }
- cc::FloatPoint p2() const { return cc::FloatPoint(WebCore::FloatQuad::p2()); }
- cc::FloatPoint p3() const { return cc::FloatPoint(WebCore::FloatQuad::p3()); }
- cc::FloatPoint p4() const { return cc::FloatPoint(WebCore::FloatQuad::p4()); }
-
- void setP1(gfx::PointF p) { WebCore::FloatQuad::setP1(cc::FloatPoint(p)); }
- void setP2(gfx::PointF p) { WebCore::FloatQuad::setP2(cc::FloatPoint(p)); }
- void setP3(gfx::PointF p) { WebCore::FloatQuad::setP3(cc::FloatPoint(p)); }
- void setP4(gfx::PointF p) { WebCore::FloatQuad::setP4(cc::FloatPoint(p)); }
-
- gfx::RectF boundingBox() const { return cc::FloatRect(WebCore::FloatQuad::boundingBox()); }
-
- bool containsPoint(gfx::PointF p) { return WebCore::FloatQuad::containsPoint(cc::FloatPoint(p)); }
-};
-
-}
-
-#endif
diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc
index fdbaa3c..cb9261a 100644
--- a/cc/tiled_layer_impl.cc
+++ b/cc/tiled_layer_impl.cc
@@ -6,7 +6,6 @@
#include "cc/tiled_layer_impl.h"
-#include "FloatQuad.h"
#include "base/basictypes.h"
#include "base/stringprintf.h"
#include "cc/append_quads_data.h"
@@ -19,6 +18,7 @@
#include "cc/tile_draw_quad.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/quad_f.h"
using namespace std;
using WebKit::WebTransformationMatrix;
@@ -189,8 +189,8 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
gfx::Size textureSize(tileWidth, tileHeight);
bool clipped = false;
- FloatQuad visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), FloatQuad(visibleContentRect()), clipped);
- bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.isRectilinear();
+ gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), gfx::QuadF(visibleContentRect()), clipped);
+ bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.IsRectilinear();
bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget;
bool leftEdgeAA = !i && useAA;