Commit a6231763 authored by Mario Bianucci's avatar Mario Bianucci Committed by Commit Bot

Draw delegated ink trails on the root render pass only

Delegated ink trails should only ever been drawn on the root render
pass as all of their points are transformed to be in the root
coordinate space and they are drawn on top of everything. Therefore,
make sure that they are only drawn on the root render pass.

Bug: 1144354
Change-Id: Ic954e7d9b93895b493c03a89d4fab4e3711b1ca1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2511757Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Reviewed-by: default avatarDaniel Libby <dlibby@microsoft.com>
Commit-Queue: Mario Bianucci <mabian@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#823572}
parent 81898928
......@@ -5346,6 +5346,50 @@ TEST_P(DelegatedInkTest, DelegatedInkTrailAfterBatchedQuads) {
FILE_PATH_LITERAL("delegated_ink_trail_on_batched_quads.png")),
cc::FuzzyPixelOffByOneComparator(true)));
}
// Confirm that delegated ink trails are not drawn on non-root render passes.
TEST_P(DelegatedInkTest, SimpleTrailNonRootRenderPass) {
gfx::Rect rect(this->device_viewport_size_);
AggregatedRenderPassId child_id{2};
auto child_pass = CreateTestRenderPass(child_id, rect, gfx::Transform());
SharedQuadState* child_shared_state = CreateTestSharedQuadState(
gfx::Transform(), rect, child_pass.get(), gfx::RRectF());
auto* color_quad = child_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
color_quad->SetNew(child_shared_state, rect, rect, SK_ColorGREEN, false);
AggregatedRenderPassId root_id{1};
auto root_pass = CreateTestRootRenderPass(root_id, rect, rect);
SharedQuadState* root_shared_state = CreateTestSharedQuadState(
gfx::Transform(), rect, root_pass.get(), gfx::RRectF());
CreateTestRenderPassDrawQuad(root_shared_state, rect, child_id,
root_pass.get());
auto* child_pass_ptr = child_pass.get();
AggregatedRenderPassList pass_list;
pass_list.push_back(std::move(child_pass));
pass_list.push_back(std::move(root_pass));
// Values for a simple delegated ink trail, numbers chosen arbitrarily.
const gfx::RectF kPresentationArea(0, 0, 200, 200);
CreateAndSendMetadata(gfx::PointF(156.f, 111.f), 19.177f, SK_ColorRED,
kPresentationArea);
CreateAndSendPointFromMetadata();
CreateAndSendPointFromLastPoint(gfx::PointF(119, 87.23f));
CreateAndSendPointFromLastPoint(gfx::PointF(74.222f, 95.4f));
// This will only check what was drawn in the child pass, which should never
// contain a delegated ink trail, so it should be solid green.
EXPECT_TRUE(this->RunPixelTestWithReadbackTarget(
&pass_list, child_pass_ptr,
base::FilePath(FILE_PATH_LITERAL("green.png")),
cc::ExactPixelComparator(true)));
}
#endif // !defined(OS_ANDROID)
} // namespace
......
......@@ -2501,15 +2501,16 @@ void SkiaRenderer::FinishDrawingQuadList() {
if (!batched_quads_.empty())
FlushBatchedQuads();
bool is_root_render_pass =
current_frame()->current_render_pass == current_frame()->root_render_pass;
// Drawing the delegated ink trail must happen after the final
// FlushBatchedQuads() call so that the trail can always be on top of
// everything else that has already been drawn on the page.
if (delegated_ink_point_renderer_)
// everything else that has already been drawn on the page. For the same
// reason, it should only happen on the root render pass.
if (is_root_render_pass && delegated_ink_point_renderer_)
DrawDelegatedInkTrail();
bool is_root_render_pass =
current_frame()->current_render_pass == current_frame()->root_render_pass;
base::OnceClosure on_finished_callback;
// Signal |current_frame_resource_fence_| when the root render pass is
// finished.
......
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