summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/checkerboard_draw_quad.cc4
-rw-r--r--cc/debug_border_draw_quad.cc3
-rw-r--r--cc/delegated_renderer_layer_impl_unittest.cc6
-rw-r--r--cc/draw_quad.cc6
-rw-r--r--cc/draw_quad.h9
-rw-r--r--cc/draw_quad_unittest.cc23
-rw-r--r--cc/heads_up_display_layer_impl.cc3
-rw-r--r--cc/io_surface_draw_quad.cc8
-rw-r--r--cc/io_surface_draw_quad.h4
-rw-r--r--cc/io_surface_layer_impl.cc3
-rw-r--r--cc/layer_impl.cc2
-rw-r--r--cc/layer_tree_host_impl_unittest.cc6
-rw-r--r--cc/nine_patch_layer_impl.cc20
-rw-r--r--cc/render_pass.cc3
-rw-r--r--cc/render_pass_draw_quad.cc2
-rw-r--r--cc/render_pass_unittest.cc2
-rw-r--r--cc/render_surface_impl.cc5
-rw-r--r--cc/render_surface_unittest.cc1
-rw-r--r--cc/scrollbar_layer_impl.cc19
-rw-r--r--cc/shared_quad_state.cc9
-rw-r--r--cc/shared_quad_state.h5
-rw-r--r--cc/software_renderer_unittest.cc4
-rw-r--r--cc/solid_color_draw_quad.cc6
-rw-r--r--cc/stream_video_draw_quad.cc8
-rw-r--r--cc/stream_video_draw_quad.h4
-rw-r--r--cc/test/render_pass_test_common.cc13
-rw-r--r--cc/texture_draw_quad.cc8
-rw-r--r--cc/texture_draw_quad.h4
-rw-r--r--cc/texture_layer_impl.cc3
-rw-r--r--cc/tile_draw_quad.cc3
-rw-r--r--cc/tiled_layer_impl.cc3
-rw-r--r--cc/video_layer_impl.cc11
-rw-r--r--cc/yuv_video_draw_quad.cc6
-rw-r--r--cc/yuv_video_draw_quad.h2
34 files changed, 116 insertions, 102 deletions
diff --git a/cc/checkerboard_draw_quad.cc b/cc/checkerboard_draw_quad.cc
index d12cd4b..c8e3021 100644
--- a/cc/checkerboard_draw_quad.cc
+++ b/cc/checkerboard_draw_quad.cc
@@ -14,9 +14,11 @@ scoped_ptr<CheckerboardDrawQuad> CheckerboardDrawQuad::create(const SharedQuadSt
}
CheckerboardDrawQuad::CheckerboardDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, SkColor color)
- : DrawQuad(sharedQuadState, DrawQuad::CHECKERBOARD, quadRect)
+ : DrawQuad(sharedQuadState, DrawQuad::CHECKERBOARD, quadRect, quadRect)
, m_color(color)
{
+ if (SkColorGetA(m_color) < 255)
+ m_opaqueRect = gfx::Rect();
}
const CheckerboardDrawQuad* CheckerboardDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/debug_border_draw_quad.cc b/cc/debug_border_draw_quad.cc
index 282f91c..576ddb1 100644
--- a/cc/debug_border_draw_quad.cc
+++ b/cc/debug_border_draw_quad.cc
@@ -14,11 +14,10 @@ scoped_ptr<DebugBorderDrawQuad> DebugBorderDrawQuad::create(const SharedQuadStat
}
DebugBorderDrawQuad::DebugBorderDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, SkColor color, int width)
- : DrawQuad(sharedQuadState, DrawQuad::DEBUG_BORDER, quadRect)
+ : DrawQuad(sharedQuadState, DrawQuad::DEBUG_BORDER, quadRect, gfx::Rect())
, m_color(color)
, m_width(width)
{
- m_quadOpaque = false;
if (SkColorGetA(m_color) < 255)
m_needsBlending = true;
}
diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc
index ced90a2..8dcbab87 100644
--- a/cc/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/delegated_renderer_layer_impl_unittest.cc
@@ -78,7 +78,7 @@ static SolidColorDrawQuad* addQuad(TestRenderPass* pass, gfx::Rect rect, SkColor
{
MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList());
AppendQuadsData data(pass->id());
- SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), rect, rect, 1, false));
+ SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), rect, rect, 1));
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::create(sharedState, rect, color);
SolidColorDrawQuad* quadPtr = quad.get();
quadSink.append(quad.PassAs<DrawQuad>(), data);
@@ -90,7 +90,7 @@ static void addRenderPassQuad(TestRenderPass* toPass, TestRenderPass* contributi
MockQuadCuller quadSink(toPass->quadList(), toPass->sharedQuadStateList());
AppendQuadsData data(toPass->id());
gfx::Rect outputRect = contributingPass->outputRect();
- SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), outputRect, outputRect, 1, false));
+ SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), outputRect, outputRect, 1));
scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::create(sharedState, outputRect, contributingPass->id(), false, 0, outputRect, 0, 0, 0, 0);
quadSink.append(quad.PassAs<DrawQuad>(), data);
}
@@ -402,7 +402,7 @@ public:
TestRenderPass* pass = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), passRect, WebTransformationMatrix());
MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList());
AppendQuadsData data(pass->id());
- SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), passRect, passRect, 1, false));
+ SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), passRect, passRect, 1));
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(0, 0, 10, 10), 1u).PassAs<DrawQuad>(), data);
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(0, 10, 10, 10), 2u).PassAs<DrawQuad>(), data);
quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(10, 0, 10, 10), 3u).PassAs<DrawQuad>(), data);
diff --git a/cc/draw_quad.cc b/cc/draw_quad.cc
index aba2412..805561b 100644
--- a/cc/draw_quad.cc
+++ b/cc/draw_quad.cc
@@ -25,14 +25,14 @@ template<typename T> T* TypedCopy(const cc::DrawQuad* other) {
namespace cc {
-DrawQuad::DrawQuad(const SharedQuadState* sharedQuadState, Material material, const gfx::Rect& quadRect)
+DrawQuad::DrawQuad(const SharedQuadState* sharedQuadState, Material material, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect)
: m_sharedQuadState(sharedQuadState)
, m_sharedQuadStateId(sharedQuadState->id)
, m_material(material)
, m_quadRect(quadRect)
, m_quadVisibleRect(quadRect)
- , m_quadOpaque(true)
, m_needsBlending(false)
+ , m_opaqueRect(opaqueRect)
{
DCHECK(m_sharedQuadState);
DCHECK(m_material != INVALID);
@@ -42,8 +42,6 @@ gfx::Rect DrawQuad::opaqueRect() const
{
if (opacity() != 1)
return gfx::Rect();
- if (m_sharedQuadState->opaque && m_quadOpaque)
- return m_quadRect;
return m_opaqueRect;
}
diff --git a/cc/draw_quad.h b/cc/draw_quad.h
index dd3c8f2..b6481d8 100644
--- a/cc/draw_quad.h
+++ b/cc/draw_quad.h
@@ -53,7 +53,7 @@ public:
void setSharedQuadState(const SharedQuadState*);
protected:
- DrawQuad(const SharedQuadState*, Material, const gfx::Rect&);
+ DrawQuad(const SharedQuadState*, Material, const gfx::Rect&, const gfx::Rect& opaqueRect);
// Stores state common to a large bundle of quads; kept separate for memory
// efficiency. There is special treatment to reconstruct these pointers
@@ -65,10 +65,9 @@ protected:
gfx::Rect m_quadRect;
gfx::Rect m_quadVisibleRect;
- // By default, the shared quad state determines whether or not this quad is
- // opaque or needs blending. Derived classes can override with these
- // variables.
- bool m_quadOpaque;
+ // By default blending is used when some part of the quad is not opaque. With
+ // this setting, it is possible to force blending on regardless of the opaque
+ // area.
bool m_needsBlending;
// Be default, this rect is empty. It is used when the shared quad state and above
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);
diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc
index cf5dc0c..7ede4b1 100644
--- a/cc/heads_up_display_layer_impl.cc
+++ b/cc/heads_up_display_layer_impl.cc
@@ -91,10 +91,11 @@ void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
gfx::Rect quadRect(gfx::Point(), bounds());
+ gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect());
bool premultipliedAlpha = true;
gfx::RectF uvRect(0, 0, 1, 1);
bool flipped = false;
- quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
}
void HeadsUpDisplayLayerImpl::updateHudTexture(ResourceProvider* resourceProvider)
diff --git a/cc/io_surface_draw_quad.cc b/cc/io_surface_draw_quad.cc
index 9426a4b..5c465f2 100644
--- a/cc/io_surface_draw_quad.cc
+++ b/cc/io_surface_draw_quad.cc
@@ -8,13 +8,13 @@
namespace cc {
-scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation)
+scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation)
{
- return make_scoped_ptr(new IOSurfaceDrawQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId, orientation));
+ return make_scoped_ptr(new IOSurfaceDrawQuad(sharedQuadState, quadRect, opaqueRect, ioSurfaceSize, ioSurfaceTextureId, orientation));
}
-IOSurfaceDrawQuad::IOSurfaceDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation)
- : DrawQuad(sharedQuadState, DrawQuad::IO_SURFACE_CONTENT, quadRect)
+IOSurfaceDrawQuad::IOSurfaceDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation orientation)
+ : DrawQuad(sharedQuadState, DrawQuad::IO_SURFACE_CONTENT, quadRect, opaqueRect)
, m_ioSurfaceSize(ioSurfaceSize)
, m_ioSurfaceTextureId(ioSurfaceTextureId)
, m_orientation(orientation)
diff --git a/cc/io_surface_draw_quad.h b/cc/io_surface_draw_quad.h
index c6ce29b..432960c 100644
--- a/cc/io_surface_draw_quad.h
+++ b/cc/io_surface_draw_quad.h
@@ -19,7 +19,7 @@ public:
Unflipped
};
- static scoped_ptr<IOSurfaceDrawQuad> create(const SharedQuadState*, const gfx::Rect&, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
+ static scoped_ptr<IOSurfaceDrawQuad> create(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
gfx::Size ioSurfaceSize() const { return m_ioSurfaceSize; }
unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; }
@@ -27,7 +27,7 @@ public:
static const IOSurfaceDrawQuad* materialCast(const DrawQuad*);
private:
- IOSurfaceDrawQuad(const SharedQuadState*, const gfx::Rect&, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
+ IOSurfaceDrawQuad(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, const gfx::Size& ioSurfaceSize, unsigned ioSurfaceTextureId, Orientation);
gfx::Size m_ioSurfaceSize;
unsigned m_ioSurfaceTextureId;
diff --git a/cc/io_surface_layer_impl.cc b/cc/io_surface_layer_impl.cc
index 2e1ac61..6d3abcb 100644
--- a/cc/io_surface_layer_impl.cc
+++ b/cc/io_surface_layer_impl.cc
@@ -78,7 +78,8 @@ void IOSurfaceLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
gfx::Rect quadRect(gfx::Point(), contentBounds());
- quadSink.append(IOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>(), appendQuadsData);
+ gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect());
+ quadSink.append(IOSurfaceDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_ioSurfaceSize, m_ioSurfaceTextureId, IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>(), appendQuadsData);
}
void IOSurfaceLayerImpl::dumpLayerProperties(std::string* str, int indent) const
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 82df351..68e78d9 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -125,7 +125,7 @@ bool LayerImpl::descendantDrawsContent()
scoped_ptr<SharedQuadState> LayerImpl::createSharedQuadState() const
{
- return SharedQuadState::create(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity, m_contentsOpaque);
+ return SharedQuadState::create(m_drawTransform, m_visibleContentRect, m_drawableContentRect, m_drawOpacity);
}
void LayerImpl::willDraw(ResourceProvider*)
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index e0d5a9a..1814221 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -2693,8 +2693,8 @@ static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvid
ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::Size(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny);
scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), WebTransformationMatrix());
- scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), 1, false);
- scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedState.get(), gfx::Rect(0, 0, 1, 1), resourceId, false, gfx::RectF(0, 0, 1, 1), false);
+ scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), 1);
+ scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedState.get(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), resourceId, false, gfx::RectF(0, 0, 1, 1), false);
pass->appendSharedQuadState(sharedState.Pass());
pass->appendQuad(quad.PassAs<DrawQuad>());
@@ -4166,7 +4166,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
renderer->clearCachedTextures();
// One shared state for all quads - we don't need the correct details
- testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(), gfx::Rect(), 1.0, true);
+ testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(), gfx::Rect(), 1.0);
const char* currentChar = testScript;
diff --git a/cc/nine_patch_layer_impl.cc b/cc/nine_patch_layer_impl.cc
index 6a5a116..5da260d 100644
--- a/cc/nine_patch_layer_impl.cc
+++ b/cc/nine_patch_layer_impl.cc
@@ -83,14 +83,18 @@ void NinePatchLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
gfx::RectF uvRight(uvTopRight.x(), uvTopRight.bottom(), rightWidth / imgWidth, uvLeft.height());
gfx::RectF uvBottom(uvTop.x(), uvBottomLeft.y(), uvTop.width(), bottomHeight / imgHeight);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, topLeft, m_resourceId, premultipliedAlpha, uvTopLeft, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, topRight, m_resourceId, premultipliedAlpha, uvTopRight, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, bottomLeft, m_resourceId, premultipliedAlpha, uvBottomLeft, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, bottomRight, m_resourceId, premultipliedAlpha, uvBottomRight, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, top, m_resourceId, premultipliedAlpha, uvTop, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, left, m_resourceId, premultipliedAlpha, uvLeft, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, right, m_resourceId, premultipliedAlpha, uvRight, flipped).PassAs<DrawQuad>(), appendQuadsData);
- quadSink.append(TextureDrawQuad::create(sharedQuadState, bottom, m_resourceId, premultipliedAlpha, uvBottom, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ // Nothing is opaque here.
+ // TODO(danakj): Should we look at the SkBitmaps to determine opaqueness?
+ gfx::Rect opaqueRect;
+
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, topLeft, opaqueRect, m_resourceId, premultipliedAlpha, uvTopLeft, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, topRight, opaqueRect, m_resourceId, premultipliedAlpha, uvTopRight, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, bottomLeft, opaqueRect, m_resourceId, premultipliedAlpha, uvBottomLeft, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, bottomRight, opaqueRect, m_resourceId, premultipliedAlpha, uvBottomRight, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, top, opaqueRect, m_resourceId, premultipliedAlpha, uvTop, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, left, opaqueRect, m_resourceId, premultipliedAlpha, uvLeft, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, right, opaqueRect, m_resourceId, premultipliedAlpha, uvRight, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, bottom, opaqueRect, m_resourceId, premultipliedAlpha, uvBottom, flipped).PassAs<DrawQuad>(), appendQuadsData);
}
void NinePatchLayerImpl::didDraw(ResourceProvider* resourceProvider)
diff --git a/cc/render_pass.cc b/cc/render_pass.cc
index 3d26bcc..01d7877 100644
--- a/cc/render_pass.cc
+++ b/cc/render_pass.cc
@@ -92,8 +92,7 @@ void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
// FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect();
float opacity = 1;
- bool opaque = true;
- SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque));
+ SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity));
DCHECK(rootLayer->screenSpaceTransform().isInvertible());
WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransform().inverse();
for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects.next()) {
diff --git a/cc/render_pass_draw_quad.cc b/cc/render_pass_draw_quad.cc
index 4830b42..ddd4dc6 100644
--- a/cc/render_pass_draw_quad.cc
+++ b/cc/render_pass_draw_quad.cc
@@ -12,7 +12,7 @@ scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::create(const SharedQuadState*
}
RenderPassDrawQuad::RenderPassDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, RenderPass::Id renderPassId, bool isReplica, ResourceProvider::ResourceId maskResourceId, const gfx::Rect& contentsChangedSinceLastFrame, float maskTexCoordScaleX, float maskTexCoordScaleY, float maskTexCoordOffsetX, float maskTexCoordOffsetY)
- : DrawQuad(sharedQuadState, DrawQuad::RENDER_PASS, quadRect)
+ : DrawQuad(sharedQuadState, DrawQuad::RENDER_PASS, quadRect, gfx::Rect())
, m_renderPassId(renderPassId)
, m_isReplica(isReplica)
, m_maskResourceId(maskResourceId)
diff --git a/cc/render_pass_unittest.cc b/cc/render_pass_unittest.cc
index 2761170..2ba9624 100644
--- a/cc/render_pass_unittest.cc
+++ b/cc/render_pass_unittest.cc
@@ -61,7 +61,7 @@ TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads)
pass->setFilter(filter);
// Stick a quad in the pass, this should not get copied.
- pass->sharedQuadStateList().append(SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(), gfx::Rect(), 1, false));
+ pass->sharedQuadStateList().append(SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(), gfx::Rect(), 1));
pass->quadList().append(CheckerboardDrawQuad::create(pass->sharedQuadStateList().last(), gfx::Rect(), SkColor()).PassAs<DrawQuad>());
RenderPass::Id newId(63, 4);
diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc
index 85ee97b..3f3d3d1 100644
--- a/cc/render_surface_impl.cc
+++ b/cc/render_surface_impl.cc
@@ -197,9 +197,8 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
DCHECK(!forReplica || m_owningLayer->hasReplica());
gfx::Rect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
- bool isOpaque = false;
const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
- SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque).Pass());
+ SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity).Pass());
if (m_owningLayer->showDebugBorders()) {
SkColor color = forReplica ? DebugColors::SurfaceReplicaBorderColor() : DebugColors::SurfaceBorderColor();
@@ -238,7 +237,7 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect();
quadSink.append(RenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame,
- maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<DrawQuad>(), appendQuadsData);
+ maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<DrawQuad>(), appendQuadsData);
}
} // namespace cc
diff --git a/cc/render_surface_unittest.cc b/cc/render_surface_unittest.cc
index e08df85a..14d8e59 100644
--- a/cc/render_surface_unittest.cc
+++ b/cc/render_surface_unittest.cc
@@ -107,7 +107,6 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
EXPECT_EQ(40, sharedQuadState->quadTransform.m42());
EXPECT_RECT_EQ(contentRect, gfx::Rect(sharedQuadState->visibleContentRect));
EXPECT_EQ(1, sharedQuadState->opacity);
- EXPECT_FALSE(sharedQuadState->opaque);
}
class TestRenderPassSink : public RenderPassSink {
diff --git a/cc/scrollbar_layer_impl.cc b/cc/scrollbar_layer_impl.cc
index 02468a6..2b82529 100644
--- a/cc/scrollbar_layer_impl.cc
+++ b/cc/scrollbar_layer_impl.cc
@@ -95,8 +95,9 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
thumbRect = WebRect();
if (m_thumbResourceId && !thumbRect.isEmpty()) {
- scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedQuadState, scrollbarLayerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvRect, flipped);
- quad->setNeedsBlending();
+ gfx::Rect quadRect(scrollbarLayerRectToContentRect(thumbRect));
+ gfx::Rect opaqueRect;
+ scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_thumbResourceId, premultipledAlpha, uvRect, flipped);
quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
}
@@ -104,13 +105,19 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
return;
// We only paint the track in two parts if we were given a texture for the forward track part.
- if (m_foreTrackResourceId && !foreTrackRect.isEmpty())
- quadSink.append(TextureDrawQuad::create(sharedQuadState, scrollbarLayerRectToContentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped).PassAs<DrawQuad>(), appendQuadsData);
+ if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) {
+ gfx::Rect quadRect(scrollbarLayerRectToContentRect(foreTrackRect));
+ gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect());
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_foreTrackResourceId, premultipledAlpha, toUVRect(foreTrackRect, boundsRect), flipped).PassAs<DrawQuad>(), appendQuadsData);
+ }
// Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and
// fore track quads. The back track texture contains (and displays) the buttons.
- if (!contentBoundsRect.IsEmpty())
- quadSink.append(TextureDrawQuad::create(sharedQuadState, gfx::Rect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ if (!contentBoundsRect.IsEmpty()) {
+ gfx::Rect quadRect(contentBoundsRect);
+ gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect());
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ }
}
void ScrollbarLayerImpl::didLoseContext()
diff --git a/cc/shared_quad_state.cc b/cc/shared_quad_state.cc
index 914cbc2..94505bc 100644
--- a/cc/shared_quad_state.cc
+++ b/cc/shared_quad_state.cc
@@ -6,24 +6,23 @@
namespace cc {
-scoped_ptr<SharedQuadState> SharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity, bool opaque)
+scoped_ptr<SharedQuadState> SharedQuadState::create(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity)
{
- return make_scoped_ptr(new SharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque));
+ return make_scoped_ptr(new SharedQuadState(quadTransform, visibleContentRect, clippedRectInTarget, opacity));
}
-SharedQuadState::SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity, bool opaque)
+SharedQuadState::SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity)
: id(-1)
, quadTransform(quadTransform)
, visibleContentRect(visibleContentRect)
, clippedRectInTarget(clippedRectInTarget)
, opacity(opacity)
- , opaque(opaque)
{
}
scoped_ptr<SharedQuadState> SharedQuadState::copy() const
{
- scoped_ptr<SharedQuadState> copiedState(create(quadTransform, visibleContentRect, clippedRectInTarget, opacity, opaque));
+ scoped_ptr<SharedQuadState> copiedState(create(quadTransform, visibleContentRect, clippedRectInTarget, opacity));
copiedState->id = id;
return copiedState.Pass();
}
diff --git a/cc/shared_quad_state.h b/cc/shared_quad_state.h
index 3d364c3..743d671 100644
--- a/cc/shared_quad_state.h
+++ b/cc/shared_quad_state.h
@@ -21,10 +21,9 @@ struct CC_EXPORT SharedQuadState {
gfx::Rect visibleContentRect;
gfx::Rect clippedRectInTarget;
float opacity;
- bool opaque;
- static scoped_ptr<SharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity, bool opaque);
- SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity, bool opaque);
+ static scoped_ptr<SharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity);
+ SharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect& visibleContentRect, const gfx::Rect& clippedRectInTarget, float opacity);
scoped_ptr<SharedQuadState> copy() const;
};
diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc
index bc61b75..bd89388 100644
--- a/cc/software_renderer_unittest.cc
+++ b/cc/software_renderer_unittest.cc
@@ -66,7 +66,7 @@ TEST_F(SoftwareRendererTest, solidColorQuad)
initializeRenderer();
- scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true);
+ scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0);
RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, outerRect, WebTransformationMatrix());
scoped_ptr<DrawQuad> outerQuad = SolidColorDrawQuad::create(sharedQuadState.get(), outerRect, SK_ColorYELLOW).PassAs<DrawQuad>();
@@ -123,7 +123,7 @@ TEST_F(SoftwareRendererTest, tileQuad)
gfx::Rect rect = gfx::Rect(gfx::Point(), deviceViewportSize());
- scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true);
+ scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0);
RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, gfx::Rect(gfx::Point(), deviceViewportSize()), WebTransformationMatrix());
scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, gfx::Vector2d(), outerSize, false, false, false, false, false).PassAs<DrawQuad>();
diff --git a/cc/solid_color_draw_quad.cc b/cc/solid_color_draw_quad.cc
index c4a4bad..0cfdd0e2 100644
--- a/cc/solid_color_draw_quad.cc
+++ b/cc/solid_color_draw_quad.cc
@@ -14,13 +14,11 @@ scoped_ptr<SolidColorDrawQuad> SolidColorDrawQuad::create(const SharedQuadState*
}
SolidColorDrawQuad::SolidColorDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, SkColor color)
- : DrawQuad(sharedQuadState, DrawQuad::SOLID_COLOR, quadRect)
+ : DrawQuad(sharedQuadState, DrawQuad::SOLID_COLOR, quadRect, quadRect)
, m_color(color)
{
if (SkColorGetA(m_color) < 255)
- m_quadOpaque = false;
- else
- m_opaqueRect = quadRect;
+ m_opaqueRect = gfx::Rect();
}
const SolidColorDrawQuad* SolidColorDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/stream_video_draw_quad.cc b/cc/stream_video_draw_quad.cc
index b5c33e2..5ab4134 100644
--- a/cc/stream_video_draw_quad.cc
+++ b/cc/stream_video_draw_quad.cc
@@ -8,13 +8,13 @@
namespace cc {
-scoped_ptr<StreamVideoDrawQuad> StreamVideoDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix)
+scoped_ptr<StreamVideoDrawQuad> StreamVideoDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix)
{
- return make_scoped_ptr(new StreamVideoDrawQuad(sharedQuadState, quadRect, textureId, matrix));
+ return make_scoped_ptr(new StreamVideoDrawQuad(sharedQuadState, quadRect, opaqueRect, textureId, matrix));
}
-StreamVideoDrawQuad::StreamVideoDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix)
- : DrawQuad(sharedQuadState, DrawQuad::STREAM_VIDEO_CONTENT, quadRect)
+StreamVideoDrawQuad::StreamVideoDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix)
+ : DrawQuad(sharedQuadState, DrawQuad::STREAM_VIDEO_CONTENT, quadRect, opaqueRect)
, m_textureId(textureId)
, m_matrix(matrix)
{
diff --git a/cc/stream_video_draw_quad.h b/cc/stream_video_draw_quad.h
index 301f5833..508a001 100644
--- a/cc/stream_video_draw_quad.h
+++ b/cc/stream_video_draw_quad.h
@@ -14,14 +14,14 @@ namespace cc {
class CC_EXPORT StreamVideoDrawQuad : public DrawQuad {
public:
- static scoped_ptr<StreamVideoDrawQuad> create(const SharedQuadState*, const gfx::Rect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
+ static scoped_ptr<StreamVideoDrawQuad> create(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, unsigned textureId, const WebKit::WebTransformationMatrix&);
unsigned textureId() const { return m_textureId; }
const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; }
static const StreamVideoDrawQuad* materialCast(const DrawQuad*);
private:
- StreamVideoDrawQuad(const SharedQuadState*, const gfx::Rect&, unsigned textureId, const WebKit::WebTransformationMatrix&);
+ StreamVideoDrawQuad(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, unsigned textureId, const WebKit::WebTransformationMatrix&);
unsigned m_textureId;
WebKit::WebTransformationMatrix m_matrix;
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index 5c24596..5d6b729 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -25,21 +25,22 @@ using WebKit::WebTransformationMatrix;
void TestRenderPass::appendOneOfEveryQuadType(cc::ResourceProvider* resourceProvider)
{
gfx::Rect rect(0, 0, 100, 100);
+ gfx::Rect opaqueRect(10, 10, 80, 80);
cc::ResourceProvider::ResourceId textureResource = resourceProvider->createResourceFromExternalTexture(1);
- scoped_ptr<cc::SharedQuadState> sharedState = cc::SharedQuadState::create(WebTransformationMatrix(), rect, rect, 1, false);
+ scoped_ptr<cc::SharedQuadState> sharedState = cc::SharedQuadState::create(WebTransformationMatrix(), rect, rect, 1);
appendQuad(cc::CheckerboardDrawQuad::create(sharedState.get(), rect, SK_ColorRED).PassAs<DrawQuad>());
appendQuad(cc::DebugBorderDrawQuad::create(sharedState.get(), rect, SK_ColorRED, 1).Pass().PassAs<DrawQuad>());
- appendQuad(cc::IOSurfaceDrawQuad::create(sharedState.get(), rect, gfx::Size(50, 50), 1, cc::IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>());
+ appendQuad(cc::IOSurfaceDrawQuad::create(sharedState.get(), rect, opaqueRect, gfx::Size(50, 50), 1, cc::IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>());
cc::RenderPass::Id passId(1, 1);
appendQuad(cc::RenderPassDrawQuad::create(sharedState.get(), rect, passId, false, 0, rect, 0, 0, 0, 0).PassAs<DrawQuad>());
appendQuad(cc::SolidColorDrawQuad::create(sharedState.get(), rect, SK_ColorRED).PassAs<DrawQuad>());
- appendQuad(cc::StreamVideoDrawQuad::create(sharedState.get(), rect, 1, WebKit::WebTransformationMatrix()).PassAs<DrawQuad>());
- appendQuad(cc::TextureDrawQuad::create(sharedState.get(), rect, textureResource, false, rect, false).PassAs<DrawQuad>());
+ appendQuad(cc::StreamVideoDrawQuad::create(sharedState.get(), rect, opaqueRect, 1, WebKit::WebTransformationMatrix()).PassAs<DrawQuad>());
+ appendQuad(cc::TextureDrawQuad::create(sharedState.get(), rect, opaqueRect, textureResource, false, rect, false).PassAs<DrawQuad>());
- appendQuad(cc::TileDrawQuad::create(sharedState.get(), rect, rect, textureResource, gfx::Vector2d(), gfx::Size(100, 100), false, false, false, false, false).PassAs<DrawQuad>());
+ appendQuad(cc::TileDrawQuad::create(sharedState.get(), rect, opaqueRect, textureResource, gfx::Vector2d(), gfx::Size(100, 100), false, false, false, false, false).PassAs<DrawQuad>());
cc::VideoLayerImpl::FramePlane planes[3];
for (int i = 0; i < 3; ++i) {
@@ -47,7 +48,7 @@ void TestRenderPass::appendOneOfEveryQuadType(cc::ResourceProvider* resourceProv
planes[i].size = gfx::Size(100, 100);
planes[i].format = GL_LUMINANCE;
}
- appendQuad(cc::YUVVideoDrawQuad::create(sharedState.get(), rect, gfx::Size(100, 100), planes[0], planes[1], planes[2]).PassAs<DrawQuad>());
+ appendQuad(cc::YUVVideoDrawQuad::create(sharedState.get(), rect, opaqueRect, gfx::Size(100, 100), planes[0], planes[1], planes[2]).PassAs<DrawQuad>());
appendSharedQuadState(sharedState.Pass());
}
diff --git a/cc/texture_draw_quad.cc b/cc/texture_draw_quad.cc
index 80a9538..e720cd1 100644
--- a/cc/texture_draw_quad.cc
+++ b/cc/texture_draw_quad.cc
@@ -8,13 +8,13 @@
namespace cc {
-scoped_ptr<TextureDrawQuad> TextureDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped)
+scoped_ptr<TextureDrawQuad> TextureDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped)
{
- return make_scoped_ptr(new TextureDrawQuad(sharedQuadState, quadRect, resourceId, premultipliedAlpha, uvRect, flipped));
+ return make_scoped_ptr(new TextureDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, premultipliedAlpha, uvRect, flipped));
}
-TextureDrawQuad::TextureDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped)
- : DrawQuad(sharedQuadState, DrawQuad::TEXTURE_CONTENT, quadRect)
+TextureDrawQuad::TextureDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped)
+ : DrawQuad(sharedQuadState, DrawQuad::TEXTURE_CONTENT, quadRect, opaqueRect)
, m_resourceId(resourceId)
, m_premultipliedAlpha(premultipliedAlpha)
, m_uvRect(uvRect)
diff --git a/cc/texture_draw_quad.h b/cc/texture_draw_quad.h
index cd87c4d..ceccb1e 100644
--- a/cc/texture_draw_quad.h
+++ b/cc/texture_draw_quad.h
@@ -14,7 +14,7 @@ namespace cc {
class CC_EXPORT TextureDrawQuad : public DrawQuad {
public:
- static scoped_ptr<TextureDrawQuad> create(const SharedQuadState*, const gfx::Rect&, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped);
+ static scoped_ptr<TextureDrawQuad> create(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped);
gfx::RectF uvRect() const { return m_uvRect; }
unsigned resourceId() const { return m_resourceId; }
@@ -25,7 +25,7 @@ public:
static const TextureDrawQuad* materialCast(const DrawQuad*);
private:
- TextureDrawQuad(const SharedQuadState*, const gfx::Rect&, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped);
+ TextureDrawQuad(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped);
unsigned m_resourceId;
bool m_premultipliedAlpha;
diff --git a/cc/texture_layer_impl.cc b/cc/texture_layer_impl.cc
index 291ea46..81c58cc 100644
--- a/cc/texture_layer_impl.cc
+++ b/cc/texture_layer_impl.cc
@@ -42,7 +42,8 @@ void TextureLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQu
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
gfx::Rect quadRect(gfx::Point(), contentBounds());
- quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<DrawQuad>(), appendQuadsData);
+ gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect());
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<DrawQuad>(), appendQuadsData);
}
void TextureLayerImpl::didDraw(ResourceProvider* resourceProvider)
diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc
index 7a4da2e..b2e2b67 100644
--- a/cc/tile_draw_quad.cc
+++ b/cc/tile_draw_quad.cc
@@ -15,7 +15,7 @@ scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadS
}
TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
- : DrawQuad(sharedQuadState, DrawQuad::TILED_CONTENT, quadRect)
+ : DrawQuad(sharedQuadState, DrawQuad::TILED_CONTENT, quadRect, opaqueRect)
, m_resourceId(resourceId)
, m_textureOffset(textureOffset)
, m_textureSize(textureSize)
@@ -27,7 +27,6 @@ TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Re
{
if (isAntialiased())
m_needsBlending = true;
- m_opaqueRect = opaqueRect;
}
const TileDrawQuad* TileDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc
index 0f90a36..09b4b9f 100644
--- a/cc/tiled_layer_impl.cc
+++ b/cc/tiled_layer_impl.cc
@@ -166,8 +166,7 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
continue;
}
- gfx::Rect tileOpaqueRect = tile->opaqueRect();
- tileOpaqueRect.Intersect(contentRect);
+ gfx::Rect tileOpaqueRect = contentsOpaque() ? tileRect : gfx::IntersectRects(tile->opaqueRect(), contentRect);
// Keep track of how the top left has moved, so the texture can be
// offset the same amount.
diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc
index 9930a0c..68a424c 100644
--- a/cc/video_layer_impl.cc
+++ b/cc/video_layer_impl.cc
@@ -200,6 +200,7 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
// otherwise synchonize use of all textures in the quad.
gfx::Rect quadRect(gfx::Point(), contentBounds());
+ gfx::Rect opaqueRect(contentsOpaque() ? quadRect : gfx::Rect());
gfx::Rect visibleRect = m_frame->visible_rect();
gfx::Size codedSize = m_frame->coded_size();
@@ -217,7 +218,7 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
const FramePlane& vPlane = m_framePlanes[media::VideoFrame::kVPlane];
gfx::SizeF texScale(texWidthScale, texHeightScale);
scoped_ptr<YUVVideoDrawQuad> yuvVideoQuad = YUVVideoDrawQuad::create(
- sharedQuadState, quadRect, texScale, yPlane, uPlane, vPlane);
+ sharedQuadState, quadRect, opaqueRect, texScale, yPlane, uPlane, vPlane);
quadSink.append(yuvVideoQuad.PassAs<DrawQuad>(), appendQuadsData);
break;
}
@@ -227,7 +228,7 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
bool premultipliedAlpha = true;
gfx::RectF uvRect(0, 0, texWidthScale, texHeightScale);
bool flipped = false;
- scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::create(sharedQuadState, quadRect, plane.resourceId, premultipliedAlpha, uvRect, flipped);
+ scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, plane.resourceId, premultipliedAlpha, uvRect, flipped);
quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData);
break;
}
@@ -236,13 +237,13 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
bool premultipliedAlpha = true;
gfx::RectF uvRect(0, 0, texWidthScale, texHeightScale);
bool flipped = false;
- scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped);
+ scoped_ptr<TextureDrawQuad> textureQuad = TextureDrawQuad::create(sharedQuadState, quadRect, opaqueRect, m_externalTextureResource, premultipliedAlpha, uvRect, flipped);
quadSink.append(textureQuad.PassAs<DrawQuad>(), appendQuadsData);
break;
}
case GL_TEXTURE_RECTANGLE_ARB: {
gfx::Size visibleSize(visibleRect.width(), visibleRect.height());
- scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::create(sharedQuadState, quadRect, visibleSize, m_frame->texture_id(), IOSurfaceDrawQuad::Unflipped);
+ scoped_ptr<IOSurfaceDrawQuad> ioSurfaceQuad = IOSurfaceDrawQuad::create(sharedQuadState, quadRect, opaqueRect, visibleSize, m_frame->texture_id(), IOSurfaceDrawQuad::Unflipped);
quadSink.append(ioSurfaceQuad.PassAs<DrawQuad>(), appendQuadsData);
break;
}
@@ -251,7 +252,7 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
WebKit::WebTransformationMatrix transform(m_streamTextureMatrix);
transform.scaleNonUniform(texWidthScale, texHeightScale);
scoped_ptr<StreamVideoDrawQuad> streamVideoQuad =
- StreamVideoDrawQuad::create(sharedQuadState, quadRect,
+ StreamVideoDrawQuad::create(sharedQuadState, quadRect, opaqueRect,
m_frame->texture_id(),
transform);
quadSink.append(streamVideoQuad.PassAs<DrawQuad>(), appendQuadsData);
diff --git a/cc/yuv_video_draw_quad.cc b/cc/yuv_video_draw_quad.cc
index 5efebfc..2bff6c2 100644
--- a/cc/yuv_video_draw_quad.cc
+++ b/cc/yuv_video_draw_quad.cc
@@ -11,24 +11,26 @@ namespace cc {
scoped_ptr<YUVVideoDrawQuad> YUVVideoDrawQuad::create(
const SharedQuadState* sharedQuadState,
const gfx::Rect& quadRect,
+ const gfx::Rect& opaqueRect,
const gfx::SizeF& texScale,
const VideoLayerImpl::FramePlane& yPlane,
const VideoLayerImpl::FramePlane& uPlane,
const VideoLayerImpl::FramePlane& vPlane)
{
return make_scoped_ptr(new YUVVideoDrawQuad(sharedQuadState,
- quadRect, texScale,
+ quadRect, opaqueRect, texScale,
yPlane, uPlane, vPlane));
}
YUVVideoDrawQuad::YUVVideoDrawQuad(
const SharedQuadState* sharedQuadState,
const gfx::Rect& quadRect,
+ const gfx::Rect& opaqueRect,
const gfx::SizeF& texScale,
const VideoLayerImpl::FramePlane& yPlane,
const VideoLayerImpl::FramePlane& uPlane,
const VideoLayerImpl::FramePlane& vPlane)
- : DrawQuad(sharedQuadState, DrawQuad::YUV_VIDEO_CONTENT, quadRect)
+ : DrawQuad(sharedQuadState, DrawQuad::YUV_VIDEO_CONTENT, quadRect, opaqueRect)
, m_texScale(texScale)
, m_yPlane(yPlane)
, m_uPlane(uPlane)
diff --git a/cc/yuv_video_draw_quad.h b/cc/yuv_video_draw_quad.h
index 8b1ac63..21b88f4 100644
--- a/cc/yuv_video_draw_quad.h
+++ b/cc/yuv_video_draw_quad.h
@@ -18,6 +18,7 @@ public:
static scoped_ptr<YUVVideoDrawQuad> create(
const SharedQuadState* sharedQuadState,
const gfx::Rect& quadRect,
+ const gfx::Rect& opaqueRect,
const gfx::SizeF& texScale,
const VideoLayerImpl::FramePlane& yPlane,
const VideoLayerImpl::FramePlane& uPlane,
@@ -36,6 +37,7 @@ private:
YUVVideoDrawQuad(
const SharedQuadState* sharedQuadState,
const gfx::Rect& quadRect,
+ const gfx::Rect& opaqueRect,
const gfx::SizeF& texScale,
const VideoLayerImpl::FramePlane& yPlane,
const VideoLayerImpl::FramePlane& uPlane,