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

Unified Diff: cc/output/gl_renderer.cc

Issue 558083002: [cc] Add nearest neighbor filtering for TextureLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add nearest_neighbor field to TextureMailbox. 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 78e2a2a3aa9b68e2ddc20a642926becb344034c0..882564926903a25d20874b7f8ca91532ccc2b062 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -2110,8 +2110,9 @@ void GLRenderer::FlushTextureQuadCache() {
GLC(gl_, gl_->Uniform1i(draw_cache_.sampler_location, 0));
// Assume the current active textures is 0.
- ResourceProvider::ScopedReadLockGL locked_quad(resource_provider_,
- draw_cache_.resource_id);
+ ResourceProvider::ScopedSamplerGL locked_quad(resource_provider_,
+ draw_cache_.resource_id,
+ draw_cache_.nearest_neighbor);
piman 2014/10/28 05:09:50 You need an enum here (GL_LINEAR or GL_NEAREST), n
jackhou1 2014/10/29 00:12:25 Done.
DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id()));
@@ -2119,6 +2120,8 @@ void GLRenderer::FlushTextureQuadCache() {
COMPILE_ASSERT(sizeof(Float16) == 16 * sizeof(float),
struct_is_densely_packed);
+ //printf("GLRenderer::FlushTextureQuadCache %d %d\n", draw_cache_.nearest_neighbor, draw_cache_.resource_id);
+
// Upload the tranforms for both points and uvs.
GLC(gl_,
gl_->UniformMatrix4fv(
@@ -2186,15 +2189,19 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame,
int resource_id = quad->resource_id;
+ //printf("GLRenderer::EnqueueTextureQuad %d %d\n", quad->nearest_neighbor, resource_id);
+
if (draw_cache_.program_id != binding.program_id ||
draw_cache_.resource_id != resource_id ||
draw_cache_.needs_blending != quad->ShouldDrawWithBlending() ||
+ draw_cache_.nearest_neighbor != quad->nearest_neighbor ||
draw_cache_.background_color != quad->background_color ||
draw_cache_.matrix_data.size() >= 8) {
FlushTextureQuadCache();
draw_cache_.program_id = binding.program_id;
draw_cache_.resource_id = resource_id;
draw_cache_.needs_blending = quad->ShouldDrawWithBlending();
+ draw_cache_.nearest_neighbor = quad->nearest_neighbor;
draw_cache_.background_color = quad->background_color;
draw_cache_.uv_xform_location = binding.tex_transform_location;

Powered by Google App Engine
This is Rietveld 408576698