diff options
author | ccameron <ccameron@chromium.org> | 2015-10-19 21:05:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-20 04:05:53 +0000 |
commit | c2572edcdfea2fee18e91789f594b0ebacaa24fc (patch) | |
tree | 6c98b66a7ac88cbdb1efa550e157eefb72e029b4 /cc | |
parent | 779bd9550a06358ff068edc7458fc8b7b0a69147 (diff) | |
download | chromium_src-c2572edcdfea2fee18e91789f594b0ebacaa24fc.zip chromium_src-c2572edcdfea2fee18e91789f594b0ebacaa24fc.tar.gz chromium_src-c2572edcdfea2fee18e91789f594b0ebacaa24fc.tar.bz2 |
cc: Fix texture coordinates for rectangle targets
Add a texture size argument to the GL texture lock. We can later use
this property to remove the texture size from TextureDrawQuad, and
switch that over to use normalized coordiantes.
BUG=533677
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1411383003
Cr-Commit-Position: refs/heads/master@{#354973}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/gl_renderer.cc | 18 | ||||
-rw-r--r-- | cc/resources/resource_provider.h | 1 |
2 files changed, 13 insertions, 6 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index f13d0cf..215ef2e 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -2336,12 +2336,18 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, } // Generate the uv-transform - if (!clip_region) { - draw_cache_.uv_xform_data.push_back(UVTransform(quad)); - } else { - Float4 uv_transform = {{0.0f, 0.0f, 1.0f, 1.0f}}; - draw_cache_.uv_xform_data.push_back(uv_transform); - } + Float4 uv_transform = {{0.0f, 0.0f, 1.0f, 1.0f}}; + if (!clip_region) + uv_transform = UVTransform(quad); + if (sampler == SAMPLER_TYPE_2D_RECT) { + // Un-normalize the texture coordiantes for rectangle targets. + gfx::Size texture_size = lock.texture_size(); + uv_transform.data[0] *= texture_size.width(); + uv_transform.data[2] *= texture_size.width(); + uv_transform.data[1] *= texture_size.height(); + uv_transform.data[3] *= texture_size.height(); + } + draw_cache_.uv_xform_data.push_back(uv_transform); // Generate the vertex opacity const float opacity = quad->shared_quad_state->opacity; diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h index a8d579d..df66372 100644 --- a/cc/resources/resource_provider.h +++ b/cc/resources/resource_provider.h @@ -219,6 +219,7 @@ class CC_EXPORT ResourceProvider unsigned texture_id() const { return resource_->gl_id; } GLenum target() const { return resource_->target; } + const gfx::Size& texture_size() const { return resource_->size; } protected: ResourceProvider* resource_provider_; |