Commit f2fef567 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Fix SkiaRenderer WebGL content not show problem

The WebGL content is a flipped TextureQuad. SkiaRenderer only flips the
Y coordinate for drawImageRect(with canvas->scale(1, -1)). It will draw
the image outside of the Window (y < 0). To fix this problem, we use
canvas->translate(0, quad_rect.bottom()) to move it back into the
window.

Bug: 901822
Change-Id: I6b98f82fba896021e1c2878632b26a3bd8029845
Reviewed-on: https://chromium-review.googlesource.com/c/1324137
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606892}
parent 346d1aac
......@@ -2379,9 +2379,7 @@ void GLRenderer::EnqueueTextureQuad(const TextureDrawQuad* quad,
}
// Generate the uv-transform
Float4 uv_transform = {{0.0f, 0.0f, 1.0f, 1.0f}};
if (!clip_region)
uv_transform = UVTransform(quad);
auto uv_transform = UVTransform(quad);
if (sampler == SAMPLER_TYPE_2D_RECT) {
// Un-normalize the texture coordiantes for rectangle targets.
uv_transform.data[0] *= texture_size.width();
......
......@@ -739,8 +739,10 @@ void SkiaRenderer::DrawTextureQuad(const TextureDrawQuad* quad) {
SkRect sk_uv_rect = gfx::RectFToSkRect(visible_uv_rect);
SkRect quad_rect = gfx::RectToSkRect(quad->visible_rect);
if (quad->y_flipped)
if (quad->y_flipped) {
current_canvas_->translate(0, quad_rect.bottom());
current_canvas_->scale(1, -1);
}
bool blend_background =
quad->background_color != SK_ColorTRANSPARENT && !image->isOpaque();
......
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