summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/output/gl_renderer.cc18
-rw-r--r--cc/resources/resource_provider.h1
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_;