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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 789433003: [cc] Add nearest neighbor filtering for PictureLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase Created 6 years 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 unified diff | Download patch
« no previous file with comments | « cc/layers/tiled_layer_impl.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); 1619 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height();
1620 1620
1621 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( 1621 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired(
1622 gl_, &highp_threshold_cache_, highp_threshold_min_, quad->texture_size); 1622 gl_, &highp_threshold_cache_, highp_threshold_min_, quad->texture_size);
1623 1623
1624 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); 1624 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect));
1625 float edge[24]; 1625 float edge[24];
1626 SetupQuadForAntialiasing(device_transform, quad, &local_quad, edge); 1626 SetupQuadForAntialiasing(device_transform, quad, &local_quad, edge);
1627 1627
1628 ResourceProvider::ScopedSamplerGL quad_resource_lock( 1628 ResourceProvider::ScopedSamplerGL quad_resource_lock(
1629 resource_provider_, resource_id, GL_LINEAR); 1629 resource_provider_, resource_id,
1630 quad->nearest_neighbor ? GL_NEAREST : GL_LINEAR);
1630 SamplerType sampler = 1631 SamplerType sampler =
1631 SamplerTypeFromTextureTarget(quad_resource_lock.target()); 1632 SamplerTypeFromTextureTarget(quad_resource_lock.target());
1632 1633
1633 float fragment_tex_translate_x = clamp_tex_rect.x(); 1634 float fragment_tex_translate_x = clamp_tex_rect.x();
1634 float fragment_tex_translate_y = clamp_tex_rect.y(); 1635 float fragment_tex_translate_y = clamp_tex_rect.y();
1635 float fragment_tex_scale_x = clamp_tex_rect.width(); 1636 float fragment_tex_scale_x = clamp_tex_rect.width();
1636 float fragment_tex_scale_y = clamp_tex_rect.height(); 1637 float fragment_tex_scale_y = clamp_tex_rect.height();
1637 1638
1638 // Map to normalized texture coordinates. 1639 // Map to normalized texture coordinates.
1639 if (sampler != SamplerType2DRect) { 1640 if (sampler != SamplerType2DRect) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 const ContentDrawQuadBase* quad, 1704 const ContentDrawQuadBase* quad,
1704 ResourceProvider::ResourceId resource_id) { 1705 ResourceProvider::ResourceId resource_id) {
1705 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( 1706 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional(
1706 quad->tex_coord_rect, quad->rect, quad->visible_rect); 1707 quad->tex_coord_rect, quad->rect, quad->visible_rect);
1707 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); 1708 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width();
1708 float tex_to_geom_scale_y = 1709 float tex_to_geom_scale_y =
1709 quad->rect.height() / quad->tex_coord_rect.height(); 1710 quad->rect.height() / quad->tex_coord_rect.height();
1710 1711
1711 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f); 1712 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f);
1712 GLenum filter = 1713 GLenum filter =
1713 (scaled || !quad->quadTransform().IsIdentityOrIntegerTranslation()) 1714 (scaled || !quad->quadTransform().IsIdentityOrIntegerTranslation()) &&
1715 !quad->nearest_neighbor
1714 ? GL_LINEAR 1716 ? GL_LINEAR
1715 : GL_NEAREST; 1717 : GL_NEAREST;
1716 1718
1717 ResourceProvider::ScopedSamplerGL quad_resource_lock( 1719 ResourceProvider::ScopedSamplerGL quad_resource_lock(
1718 resource_provider_, resource_id, filter); 1720 resource_provider_, resource_id, filter);
1719 SamplerType sampler = 1721 SamplerType sampler =
1720 SamplerTypeFromTextureTarget(quad_resource_lock.target()); 1722 SamplerTypeFromTextureTarget(quad_resource_lock.target());
1721 1723
1722 float vertex_tex_translate_x = tex_coord_rect.x(); 1724 float vertex_tex_translate_x = tex_coord_rect.x();
1723 float vertex_tex_translate_y = tex_coord_rect.y(); 1725 float vertex_tex_translate_y = tex_coord_rect.y();
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 context_support_->ScheduleOverlayPlane( 3288 context_support_->ScheduleOverlayPlane(
3287 overlay.plane_z_order, 3289 overlay.plane_z_order,
3288 overlay.transform, 3290 overlay.transform,
3289 pending_overlay_resources_.back()->texture_id(), 3291 pending_overlay_resources_.back()->texture_id(),
3290 overlay.display_rect, 3292 overlay.display_rect,
3291 overlay.uv_rect); 3293 overlay.uv_rect);
3292 } 3294 }
3293 } 3295 }
3294 3296
3295 } // namespace cc 3297 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer_impl.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698