summaryrefslogtreecommitdiffstats
path: root/cc/draw_quad_unittest.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 06:10:06 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 06:10:06 +0000
commit35d7e967e7182a63a43eaa6d0e3d43e1b727879c (patch)
tree91d434fbb6e7055da188cf7caba462be08725833 /cc/draw_quad_unittest.cc
parenta8883e454b594fbcc00b9d36a1958b6f85c0632d (diff)
downloadchromium_src-35d7e967e7182a63a43eaa6d0e3d43e1b727879c.zip
chromium_src-35d7e967e7182a63a43eaa6d0e3d43e1b727879c.tar.gz
chromium_src-35d7e967e7182a63a43eaa6d0e3d43e1b727879c.tar.bz2
cc: Remove opaque flags from SharedQuadState and DrawQuad
Now we will use the opaqueRect (already present on DrawQuad) to tell when things are opaque or not. Each Quad constructor that can be opaque take an opaqueRect. Generally, callers set it equal to the quadRect when contentsOpaque(). TiledLayerImpl can set it to a smaller rect sometimes since it has more knowledge. This made the scrollbar code a bit nicer for the thumb so that it doesn't need to set needs_blending anymore, as the thumb can be marked non-opaque. DebugBorderQuad sets an empty opaqueRect now, so it doesn't need to set needs_blending. Covered by existing tests. BUG=152337 R=enne Review URL: https://chromiumcodereview.appspot.com/11412044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/draw_quad_unittest.cc')
-rw-r--r--cc/draw_quad_unittest.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc
index 78ad0a9..e083905 100644
--- a/cc/draw_quad_unittest.cc
+++ b/cc/draw_quad_unittest.cc
@@ -28,10 +28,9 @@ TEST(DrawQuadTest, copySharedQuadState)
gfx::Rect visibleContentRect(10, 12, 14, 16);
gfx::Rect clippedRectInTarget(19, 21, 23, 25);
float opacity = 0.25;
- bool opaque = true;
int id = 3;
- scoped_ptr<SharedQuadState> state(SharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque));
+ scoped_ptr<SharedQuadState> state(SharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity));
state->id = id;
scoped_ptr<SharedQuadState> copy(state->copy());
@@ -40,7 +39,6 @@ TEST(DrawQuadTest, copySharedQuadState)
EXPECT_RECT_EQ(visibleContentRect, copy->visibleContentRect);
EXPECT_RECT_EQ(clippedRectInTarget, copy->clippedRectInTarget);
EXPECT_EQ(opacity, copy->opacity);
- EXPECT_EQ(opaque, copy->opaque);
}
scoped_ptr<SharedQuadState> createSharedQuadState()
@@ -49,10 +47,9 @@ scoped_ptr<SharedQuadState> createSharedQuadState()
gfx::Rect visibleContentRect(10, 12, 14, 16);
gfx::Rect clippedRectInTarget(19, 21, 23, 25);
float opacity = 1;
- bool opaque = false;
int id = 3;
- scoped_ptr<SharedQuadState> state(SharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque));
+ scoped_ptr<SharedQuadState> state(SharedQuadState::create(quadTransform, visibleContentRect, clippedRectInTarget, opacity));
state->id = id;
return state.Pass();
}
@@ -170,12 +167,14 @@ TEST(DrawQuadTest, copyDebugBorderDrawQuad)
TEST(DrawQuadTest, copyIOSurfaceDrawQuad)
{
+ gfx::Rect opaqueRect(3, 7, 10, 12);
gfx::Size size(58, 95);
unsigned textureId = 72;
IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::Unflipped;
CREATE_SHARED_STATE();
- CREATE_QUAD_3(IOSurfaceDrawQuad, size, textureId, orientation);
+ CREATE_QUAD_4(IOSurfaceDrawQuad, opaqueRect, size, textureId, orientation);
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
EXPECT_EQ(size, copyQuad->ioSurfaceSize());
EXPECT_EQ(textureId, copyQuad->ioSurfaceTextureId());
EXPECT_EQ(orientation, copyQuad->orientation());
@@ -217,24 +216,28 @@ TEST(DrawQuadTest, copySolidColorDrawQuad)
TEST(DrawQuadTest, copyStreamVideoDrawQuad)
{
+ gfx::Rect opaqueRect(3, 7, 10, 12);
unsigned textureId = 64;
WebTransformationMatrix matrix(0.5, 1, 0.25, 0.75, 0, 1);
CREATE_SHARED_STATE();
- CREATE_QUAD_2(StreamVideoDrawQuad, textureId, matrix);
+ CREATE_QUAD_3(StreamVideoDrawQuad, opaqueRect, textureId, matrix);
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
EXPECT_EQ(textureId, copyQuad->textureId());
EXPECT_EQ(matrix, copyQuad->matrix());
}
TEST(DrawQuadTest, copyTextureDrawQuad)
{
+ gfx::Rect opaqueRect(3, 7, 10, 12);
unsigned resourceId = 82;
bool premultipliedAlpha = true;
gfx::RectF uvRect(0.5, 224, -51, 36);
bool flipped = true;
CREATE_SHARED_STATE();
- CREATE_QUAD_4(TextureDrawQuad, resourceId, premultipliedAlpha, uvRect, flipped);
+ CREATE_QUAD_5(TextureDrawQuad, opaqueRect, resourceId, premultipliedAlpha, uvRect, flipped);
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
EXPECT_EQ(resourceId, copyQuad->resourceId());
EXPECT_EQ(premultipliedAlpha, copyQuad->premultipliedAlpha());
EXPECT_FLOAT_RECT_EQ(uvRect, copyQuad->uvRect());
@@ -268,6 +271,7 @@ TEST(DrawQuadTest, copyTileDrawQuad)
TEST(DrawQuadTest, copyYUVVideoDrawQuad)
{
+ gfx::Rect opaqueRect(3, 7, 10, 12);
gfx::SizeF texScale(0.75, 0.5);
VideoLayerImpl::FramePlane yPlane;
yPlane.resourceId = 45;
@@ -283,7 +287,8 @@ TEST(DrawQuadTest, copyYUVVideoDrawQuad)
vPlane.format = 46;
CREATE_SHARED_STATE();
- CREATE_QUAD_4(YUVVideoDrawQuad, texScale, yPlane, uPlane, vPlane);
+ CREATE_QUAD_5(YUVVideoDrawQuad, opaqueRect, texScale, yPlane, uPlane, vPlane);
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
EXPECT_EQ(texScale, copyQuad->texScale());
EXPECT_EQ(yPlane.resourceId, copyQuad->yPlane().resourceId);
EXPECT_EQ(yPlane.size, copyQuad->yPlane().size);