Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1642)

Unified Diff: cc/output/gl_renderer.cc

Issue 659683002: Include mask texture size in RenderPassDrawQuad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_mask_draw_quad_test
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index ac449a46f5df84bc66ffe091b6470f8c6a394cb9..7584cb3d656a1198b55e05e76f4ecd69a9c2d2c5 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -1170,12 +1170,14 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
device_layer_edges.InflateAntiAliasingDistance();
}
- scoped_ptr<ResourceProvider::ScopedReadLockGL> mask_resource_lock;
+ scoped_ptr<ResourceProvider::ScopedSamplerGL> mask_resource_lock;
unsigned mask_texture_id = 0;
+ SamplerType mask_sampler = SamplerTypeNA;
if (quad->mask_resource_id) {
- mask_resource_lock.reset(new ResourceProvider::ScopedReadLockGL(
- resource_provider_, quad->mask_resource_id));
+ mask_resource_lock.reset(new ResourceProvider::ScopedSamplerGL(
+ resource_provider_, quad->mask_resource_id, GL_TEXTURE1, GL_LINEAR));
mask_texture_id = mask_resource_lock->texture_id();
+ mask_sampler = SamplerTypeFromTextureTarget(mask_resource_lock->target());
danakj 2014/10/15 15:33:35 this variable exists only for DCHECK? do the looku
enne (OOO) 2014/10/15 19:10:54 Sure, for now. In the next patch for adding suppo
}
// TODO(danakj): use the background_texture and blend the background in with
@@ -1370,29 +1372,21 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
if (shader_mask_sampler_location != -1) {
DCHECK_NE(shader_mask_tex_coord_scale_location, 1);
DCHECK_NE(shader_mask_tex_coord_offset_location, 1);
+ DCHECK_EQ(SamplerType2D, mask_sampler);
GLC(gl_, gl_->Uniform1i(shader_mask_sampler_location, 1));
- float mask_tex_scale_x = quad->mask_uv_rect.width() / tex_scale_x;
- float mask_tex_scale_y = quad->mask_uv_rect.height() / tex_scale_y;
+ gfx::RectF mask_uv_rect = quad->mask_uv_rect();
- // Mask textures are oriented vertically flipped relative to the framebuffer
danakj 2014/10/15 15:33:35 what happened to this?
enne (OOO) 2014/10/15 19:10:54 OOPS
// and the RenderPass contents texture, so we flip the tex coords from the
// RenderPass texture to find the mask texture coords.
GLC(gl_,
gl_->Uniform2f(shader_mask_tex_coord_offset_location,
- quad->mask_uv_rect.x(),
- quad->mask_uv_rect.y() + quad->mask_uv_rect.height()));
+ mask_uv_rect.x(),
+ mask_uv_rect.bottom()));
GLC(gl_,
gl_->Uniform2f(shader_mask_tex_coord_scale_location,
- mask_tex_scale_x,
- -mask_tex_scale_y));
- shader_mask_sampler_lock = make_scoped_ptr(
- new ResourceProvider::ScopedSamplerGL(resource_provider_,
- quad->mask_resource_id,
- GL_TEXTURE1,
- GL_LINEAR));
- DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D),
- shader_mask_sampler_lock->target());
+ mask_uv_rect.width() / tex_scale_x,
+ -mask_uv_rect.height() / tex_scale_y));
}
if (shader_edge_location != -1) {

Powered by Google App Engine
This is Rietveld 408576698