Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index 1eac5f85d19fd7268dc7b9c2d33a9288ab115f9b..d41b81f5373892169caee60c54313bf8ec27a1fa 100644 |
| --- a/cc/output/gl_renderer.cc |
| +++ b/cc/output/gl_renderer.cc |
| @@ -1317,9 +1317,14 @@ void GLRenderer::ChooseRPDQProgram(DrawRenderPassDrawQuadParams* params) { |
| } |
| void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) { |
| - gfx::RectF tex_rect(params->src_offset.x(), params->src_offset.y(), |
| - params->dst_rect.width(), params->dst_rect.height()); |
| + gfx::RectF tex_rect = params->quad->tex_coord_rect; |
| gfx::Size texture_size; |
|
trchen
2017/03/02 00:32:56
nits: move this down right before #1328
sunxd
2017/03/02 17:21:39
Done.
|
| + if (tex_rect.IsEmpty()) { |
| + // The tex_coord_rect is not produced in RenderSufaceImpl::AppendQuads. |
| + tex_rect = |
| + gfx::RectF(gfx::PointF(params->src_offset), params->dst_rect.size()); |
| + } |
| + |
| if (params->filter_image) { |
| texture_size.set_width(params->filter_image->width()); |
| texture_size.set_height(params->filter_image->height()); |
| @@ -1358,25 +1363,23 @@ void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) { |
| mask_uv_rect.Scale(params->quad->mask_texture_size.width(), |
| params->quad->mask_texture_size.height()); |
| } |
| + |
| + SkMatrix tex_to_mask = SkMatrix::MakeRectToRect(RectFToSkRect(tex_rect), |
| + RectFToSkRect(mask_uv_rect), |
| + SkMatrix::kFill_ScaleToFit); |
|
trchen
2017/03/02 00:32:56
Thanks for saving everyone's brain cells!
However
sunxd
2017/03/02 17:21:39
Yes I noticed that this didn't fix the bug in that
trchen
2017/03/04 02:59:39
Alright. I see why. As GLRenderer::UpdateRPDQWithS
|
| + |
| if (params->source_needs_flip) { |
| // Mask textures are oriented vertically flipped relative to the |
| // framebuffer and the RenderPass contents texture, so we flip the tex |
| // coords from the RenderPass texture to find the mask texture coords. |
| - gl_->Uniform2f( |
| - current_program_->mask_tex_coord_offset_location(), mask_uv_rect.x(), |
| - mask_uv_rect.height() / tex_rect.height() + mask_uv_rect.y()); |
| - gl_->Uniform2f(current_program_->mask_tex_coord_scale_location(), |
| - mask_uv_rect.width() / tex_rect.width(), |
| - -mask_uv_rect.height() / tex_rect.height()); |
| - } else { |
| - // Tile textures are oriented the same way as mask textures. |
| - gl_->Uniform2f(current_program_->mask_tex_coord_offset_location(), |
| - mask_uv_rect.x(), mask_uv_rect.y()); |
| - gl_->Uniform2f(current_program_->mask_tex_coord_scale_location(), |
| - mask_uv_rect.width() / tex_rect.width(), |
| - mask_uv_rect.height() / tex_rect.height()); |
| + tex_to_mask.preTranslate(0, 1); |
| + tex_to_mask.preScale(1, -1); |
| } |
| + gl_->Uniform2f(current_program_->mask_tex_coord_offset_location(), |
| + tex_to_mask.getTranslateX(), tex_to_mask.getTranslateY()); |
| + gl_->Uniform2f(current_program_->mask_tex_coord_scale_location(), |
| + tex_to_mask.getScaleX(), tex_to_mask.getScaleY()); |
| last_texture_unit = 1; |
| } |