Commit 86d4fd13 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

CanvasResourceDispatcher: correct viz::TextureDrawQuad size

This CL fixes the Size we SetAll() in the viz::TextureDrawQuad
from an empty one to the appropriate CanvasResource Size -- this
is needed to indicate to e.g. Ozone the |resource_size_in_pixels|
of the overlay candidate, but it's also more correct in general.

Also removes an unused variable and adds {} in a few needed places.

Bug: 869161
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ice28fb8c9d7f9a4eee29a22f8634b08c9dfb2e36
Reviewed-on: https://chromium-review.googlesource.com/1157232
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579864}
parent addbe492
......@@ -132,8 +132,9 @@ void CanvasResourceDispatcher::DispatchFrameSync(
const SkIRect& damage_rect) {
viz::CompositorFrame frame;
if (!PrepareFrame(std::move(canvas_resource), commit_start_time, damage_rect,
&frame))
&frame)) {
return;
}
pending_compositor_frames_++;
WTF::Vector<viz::ReturnedResource> resources;
......@@ -149,8 +150,9 @@ void CanvasResourceDispatcher::DispatchFrame(
const SkIRect& damage_rect) {
viz::CompositorFrame frame;
if (!PrepareFrame(std::move(canvas_resource), commit_start_time, damage_rect,
&frame))
&frame)) {
return;
}
pending_compositor_frames_++;
sink_->SubmitCompositorFrame(
......@@ -236,6 +238,8 @@ bool CanvasResourceDispatcher::PrepareFrame(
offscreen_canvas_resource_provider_->SetTransferableResource(&resource,
canvas_resource);
// TODO(crbug.com/869913): add unit testing for this.
const gfx::Size canvas_resource_size(canvas_resource->Size());
commit_type_histogram.Count(commit_type);
......@@ -247,7 +251,6 @@ bool CanvasResourceDispatcher::PrepareFrame(
viz::TextureDrawQuad* quad =
pass->CreateAndAppendDrawQuad<viz::TextureDrawQuad>();
gfx::Size rect_size(size_.Width(), size_.Height());
// TODO(crbug.com/705019): optimize for contexts that have {alpha: false}
const bool kNeedsBlending = true;
......@@ -257,16 +260,16 @@ bool CanvasResourceDispatcher::PrepareFrame(
const bool kPremultipliedAlpha = true;
const gfx::PointF uv_top_left(0.f, 0.f);
const gfx::PointF uv_bottom_right(1.f, 1.f);
float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f};
const float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f};
// TODO(crbug.com/645994): this should be true when using style
// "image-rendering: pixelated".
// TODO(crbug.com/645590): filter should respect the image-rendering CSS
// property of associated canvas element.
const bool kNearestNeighbor = false;
quad->SetAll(sqs, bounds, bounds, kNeedsBlending, resource.id, gfx::Size(),
kPremultipliedAlpha, uv_top_left, uv_bottom_right,
SK_ColorTRANSPARENT, vertex_opacity, yflipped, kNearestNeighbor,
false);
quad->SetAll(sqs, bounds, bounds, kNeedsBlending, resource.id,
canvas_resource_size, kPremultipliedAlpha, uv_top_left,
uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity, yflipped,
kNearestNeighbor, false);
frame->render_pass_list.push_back(std::move(pass));
......
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