OLD | NEW |
---|---|
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 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1621 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); | 1621 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); |
1622 | 1622 |
1623 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1623 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
1624 gl_, &highp_threshold_cache_, highp_threshold_min_, quad->texture_size); | 1624 gl_, &highp_threshold_cache_, highp_threshold_min_, quad->texture_size); |
1625 | 1625 |
1626 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); | 1626 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); |
1627 float edge[24]; | 1627 float edge[24]; |
1628 SetupQuadForAntialiasing(device_transform, quad, &local_quad, edge); | 1628 SetupQuadForAntialiasing(device_transform, quad, &local_quad, edge); |
1629 | 1629 |
1630 ResourceProvider::ScopedSamplerGL quad_resource_lock( | 1630 ResourceProvider::ScopedSamplerGL quad_resource_lock( |
1631 resource_provider_, resource_id, GL_LINEAR); | 1631 resource_provider_, resource_id, |
1632 quad->nearest_neighbor ? GL_NEAREST : GL_LINEAR); | |
1632 SamplerType sampler = | 1633 SamplerType sampler = |
1633 SamplerTypeFromTextureTarget(quad_resource_lock.target()); | 1634 SamplerTypeFromTextureTarget(quad_resource_lock.target()); |
1634 | 1635 |
1635 float fragment_tex_translate_x = clamp_tex_rect.x(); | 1636 float fragment_tex_translate_x = clamp_tex_rect.x(); |
1636 float fragment_tex_translate_y = clamp_tex_rect.y(); | 1637 float fragment_tex_translate_y = clamp_tex_rect.y(); |
1637 float fragment_tex_scale_x = clamp_tex_rect.width(); | 1638 float fragment_tex_scale_x = clamp_tex_rect.width(); |
1638 float fragment_tex_scale_y = clamp_tex_rect.height(); | 1639 float fragment_tex_scale_y = clamp_tex_rect.height(); |
1639 | 1640 |
1640 // Map to normalized texture coordinates. | 1641 // Map to normalized texture coordinates. |
1641 if (sampler != SamplerType2DRect) { | 1642 if (sampler != SamplerType2DRect) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1705 const ContentDrawQuadBase* quad, | 1706 const ContentDrawQuadBase* quad, |
1706 ResourceProvider::ResourceId resource_id) { | 1707 ResourceProvider::ResourceId resource_id) { |
1707 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( | 1708 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( |
1708 quad->tex_coord_rect, quad->rect, quad->visible_rect); | 1709 quad->tex_coord_rect, quad->rect, quad->visible_rect); |
1709 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); | 1710 float tex_to_geom_scale_x = quad->rect.width() / quad->tex_coord_rect.width(); |
1710 float tex_to_geom_scale_y = | 1711 float tex_to_geom_scale_y = |
1711 quad->rect.height() / quad->tex_coord_rect.height(); | 1712 quad->rect.height() / quad->tex_coord_rect.height(); |
1712 | 1713 |
1713 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f); | 1714 bool scaled = (tex_to_geom_scale_x != 1.f || tex_to_geom_scale_y != 1.f); |
1714 GLenum filter = | 1715 GLenum filter = |
1715 (scaled || !quad->quadTransform().IsIdentityOrIntegerTranslation()) | 1716 (scaled || !quad->quadTransform().IsIdentityOrIntegerTranslation()) && |
1717 !quad->nearest_neighbor | |
danakj
2014/12/09 19:44:45
is this what git cl format does for formatting?
jackhou1
2014/12/10 01:04:15
Yup.
| |
1716 ? GL_LINEAR | 1718 ? GL_LINEAR |
1717 : GL_NEAREST; | 1719 : GL_NEAREST; |
1718 | 1720 |
1719 ResourceProvider::ScopedSamplerGL quad_resource_lock( | 1721 ResourceProvider::ScopedSamplerGL quad_resource_lock( |
1720 resource_provider_, resource_id, filter); | 1722 resource_provider_, resource_id, filter); |
1721 SamplerType sampler = | 1723 SamplerType sampler = |
1722 SamplerTypeFromTextureTarget(quad_resource_lock.target()); | 1724 SamplerTypeFromTextureTarget(quad_resource_lock.target()); |
1723 | 1725 |
1724 float vertex_tex_translate_x = tex_coord_rect.x(); | 1726 float vertex_tex_translate_x = tex_coord_rect.x(); |
1725 float vertex_tex_translate_y = tex_coord_rect.y(); | 1727 float vertex_tex_translate_y = tex_coord_rect.y(); |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3288 context_support_->ScheduleOverlayPlane( | 3290 context_support_->ScheduleOverlayPlane( |
3289 overlay.plane_z_order, | 3291 overlay.plane_z_order, |
3290 overlay.transform, | 3292 overlay.transform, |
3291 pending_overlay_resources_.back()->texture_id(), | 3293 pending_overlay_resources_.back()->texture_id(), |
3292 overlay.display_rect, | 3294 overlay.display_rect, |
3293 overlay.uv_rect); | 3295 overlay.uv_rect); |
3294 } | 3296 } |
3295 } | 3297 } |
3296 | 3298 |
3297 } // namespace cc | 3299 } // namespace cc |
OLD | NEW |