summaryrefslogtreecommitdiffstats
path: root/cc/output
diff options
context:
space:
mode:
authorjackhou <jackhou@chromium.org>2014-12-03 21:24:44 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-04 05:25:03 +0000
commit10c9af41a73ac7db787d64344630f8200925cfe5 (patch)
treec2fe05f5439b39c9d9409b362a29577863469609 /cc/output
parentedbe9193bddce5f58e9070e219735363cdc27191 (diff)
downloadchromium_src-10c9af41a73ac7db787d64344630f8200925cfe5.zip
chromium_src-10c9af41a73ac7db787d64344630f8200925cfe5.tar.gz
chromium_src-10c9af41a73ac7db787d64344630f8200925cfe5.tar.bz2
[cc] Add nearest neighbor filtering for TextureLayer.
Blink side is here (depends on this CL): https://codereview.chromium.org/562583002/ This CL also depends on another blink side change here: https://codereview.chromium.org/699103002/ BUG=134040 Review URL: https://codereview.chromium.org/558083002 Cr-Commit-Position: refs/heads/master@{#306768}
Diffstat (limited to 'cc/output')
-rw-r--r--cc/output/gl_renderer.cc8
-rw-r--r--cc/output/gl_renderer_draw_cache.cc1
-rw-r--r--cc/output/gl_renderer_draw_cache.h1
-rw-r--r--cc/output/overlay_unittest.cc4
-rw-r--r--cc/output/renderer_pixeltest.cc6
5 files changed, 15 insertions, 5 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 27f40eb..a32778a 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -2054,8 +2054,10 @@ 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 ? GL_NEAREST : GL_LINEAR);
DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_));
GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id()));
@@ -2133,12 +2135,14 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame,
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;
diff --git a/cc/output/gl_renderer_draw_cache.cc b/cc/output/gl_renderer_draw_cache.cc
index a0004f2..91581f4 100644
--- a/cc/output/gl_renderer_draw_cache.cc
+++ b/cc/output/gl_renderer_draw_cache.cc
@@ -10,6 +10,7 @@ TexturedQuadDrawCache::TexturedQuadDrawCache()
: program_id(-1),
resource_id(-1),
needs_blending(false),
+ nearest_neighbor(false),
background_color(0),
uv_xform_location(-1),
background_color_location(-1),
diff --git a/cc/output/gl_renderer_draw_cache.h b/cc/output/gl_renderer_draw_cache.h
index f828418..a16c8a5 100644
--- a/cc/output/gl_renderer_draw_cache.h
+++ b/cc/output/gl_renderer_draw_cache.h
@@ -33,6 +33,7 @@ struct TexturedQuadDrawCache {
int program_id;
int resource_id;
bool needs_blending;
+ bool nearest_neighbor;
SkColor background_color;
// Information about the program binding that is required to draw.
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc
index 33c6f4a..bb7451d 100644
--- a/cc/output/overlay_unittest.cc
+++ b/cc/output/overlay_unittest.cc
@@ -152,6 +152,7 @@ TextureDrawQuad* CreateCandidateQuadAt(ResourceProvider* resource_provider,
ResourceProvider::ResourceId resource_id = CreateResource(resource_provider);
bool premultiplied_alpha = false;
bool flipped = false;
+ bool nearest_neighbor = false;
float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f};
TextureDrawQuad* overlay_quad =
@@ -166,7 +167,8 @@ TextureDrawQuad* CreateCandidateQuadAt(ResourceProvider* resource_provider,
kUVBottomRight,
SK_ColorTRANSPARENT,
vertex_opacity,
- flipped);
+ flipped,
+ nearest_neighbor);
return overlay_quad;
}
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index 0c2bc3d..53b5b98 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -152,7 +152,8 @@ void CreateTestTextureDrawQuad(const gfx::Rect& rect,
gfx::PointF(1.0f, 1.0f), // uv_bottom_right
background_color,
vertex_opacity,
- false); // flipped
+ false, // flipped
+ false); // nearest_neighbor
}
typedef ::testing::Types<GLRenderer,
@@ -2296,7 +2297,8 @@ TYPED_TEST(RendererPixelTest, WrapModeRepeat) {
this->device_viewport_size_.height() / texture_rect.height()),
SK_ColorWHITE,
vertex_opacity,
- false); // flipped
+ false, // flipped
+ false); // nearest_neighbor
RenderPassList pass_list;
pass_list.push_back(pass.Pass());