Commit 644f0f57 authored by liberato@chromium.org's avatar liberato@chromium.org Committed by Commit Bot

Copy quad rect when replacing overlay quad.

Previously, RenderPass::Replace...Color() was taking a reference
to the quad's rectangle, then replacing the quad.  Unfortunately,
that destroys the original rect before it can be re-used a few
lines later.

This CL just makes a copy of the rect instead.

BUG=751746

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ice4a5e147000813a1e19c60ba33de5f36b2b11d7
Reviewed-on: https://chromium-review.googlesource.com/598489
Commit-Queue: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491764}
parent d4e766b8
......@@ -51,16 +51,15 @@ void QuadList::ReplaceExistingQuadWithOpaqueTransparentSolidColor(Iterator at) {
// solid color quad needs to set |needs_blending| to false, and set both
// |visible_rect| and |opaque_rect| to its quad rect so it is drawn and
// ShouldDrawWithBlending() returns false so it is drawn without blending.
const gfx::Rect& rect = at->rect;
const gfx::Rect& opaque_rect = at->rect;
const gfx::Rect& visible_rect = at->rect;
const gfx::Rect rect = at->rect;
bool needs_blending = false;
const SharedQuadState* shared_quad_state = at->shared_quad_state;
SolidColorDrawQuad* replacement =
QuadList::ReplaceExistingElement<SolidColorDrawQuad>(at);
replacement->SetAll(shared_quad_state, rect, opaque_rect, visible_rect,
needs_blending, SK_ColorTRANSPARENT, true);
replacement->SetAll(shared_quad_state, rect, rect /* opaque_rect */,
rect /* visible_rect */, needs_blending,
SK_ColorTRANSPARENT, true);
}
std::unique_ptr<RenderPass> RenderPass::Create() {
......
......@@ -288,5 +288,18 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) {
CompareRenderPassLists(pass_list, copy_list);
}
TEST(RenderPassTest, ReplacedQuadsShouldntMove) {
std::unique_ptr<SharedQuadState> quad_state =
base::MakeUnique<SharedQuadState>();
QuadList quad_list;
SolidColorDrawQuad* quad =
quad_list.AllocateAndConstruct<SolidColorDrawQuad>();
gfx::Rect quad_rect(1, 2, 3, 4);
quad->SetNew(quad_state.get(), quad_rect, quad_rect, SkColor(), false);
quad_list.ReplaceExistingQuadWithOpaqueTransparentSolidColor(
quad_list.begin());
EXPECT_EQ(quad_list.begin()->rect, quad_rect);
}
} // namespace
} // namespace cc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment