summaryrefslogtreecommitdiffstats
path: root/cc/output/gl_renderer.cc
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-25 17:32:20 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-25 17:32:20 +0000
commitf088145ace0e944476074c58114aba217f9438e3 (patch)
treeceb320ec1f4f7b682743ac13fd5bbd850b5b28a8 /cc/output/gl_renderer.cc
parent51a5a9dfd1dc14e4bbccbb2cb661f84df495b2fe (diff)
downloadchromium_src-f088145ace0e944476074c58114aba217f9438e3.zip
chromium_src-f088145ace0e944476074c58114aba217f9438e3.tar.gz
chromium_src-f088145ace0e944476074c58114aba217f9438e3.tar.bz2
Revert 196423 "cc: Fix anti-aliasing of axis-aligned quads."
[Reason for revert: AxisAligned unit test is failing on some of the Mac bots.] > cc: Fix anti-aliasing of axis-aligned quads. > > Axis-aligned quads with edges not aligned to pixel boundaries > are rendered incorrectly. These quads need anti-aliasing but > current code that determines if anti-aliasing is needed thinks > that no axis-aligned quads need it. > > This fixes the problem by adding alignment to pixel boundaries > as an additional requirement to avoid anti-aliasing. > > BUG=169374 > TEST=GLRendererPixelTest.AxisAligned,GLRendererShaderTest.DrawSolidColorShad > > Review URL: https://chromiumcodereview.appspot.com/12538005 TBR=reveman@chromium.org Review URL: https://codereview.chromium.org/14465006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196427 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/gl_renderer.cc')
-rw-r--r--cc/output/gl_renderer.cc32
1 files changed, 12 insertions, 20 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 19b215b..cf7b64b 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -81,10 +81,6 @@ bool NeedsIOSurfaceReadbackWorkaround() {
#endif
}
-// Smallest unit that impact anti-aliasing output. We use this to
-// determine when anti-aliasing is unnecessary.
-const float kAntiAliasingEpsilon = 1.0f / 1024.0f;
-
} // anonymous namespace
scoped_ptr<GLRenderer> GLRenderer::Create(RendererClient* client,
@@ -719,8 +715,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
// Use anti-aliasing programs only when necessary.
bool use_aa = (!device_quad.IsRectilinear() ||
- !gfx::IsNearestRectWithinDistance(device_quad.BoundingBox(),
- kAntiAliasingEpsilon));
+ !device_quad.BoundingBox().IsExpressibleAsRect());
if (use_aa) {
device_layer_bounds.InflateAntiAliasingDistance();
device_layer_edges.InflateAntiAliasingDistance();
@@ -1016,11 +1011,11 @@ bool GLRenderer::SetupQuadForAntialiasing(
device_transform, gfx::QuadF(quad->visibleContentRect()), &clipped);
DCHECK(!clipped);
+ // TODO(reveman): Axis-aligned is not enough to avoid anti-aliasing.
+ // Bounding rectangle for quad also needs to be expressible as an integer
+ // rectangle. crbug.com/169374
bool is_axis_aligned_in_target = device_layer_quad.IsRectilinear();
- bool is_nearest_rect_within_epsilon = is_axis_aligned_in_target &&
- gfx::IsNearestRectWithinDistance(device_layer_quad.BoundingBox(),
- kAntiAliasingEpsilon);
- bool use_aa = !clipped && !is_nearest_rect_within_epsilon && quad->IsEdge();
+ bool use_aa = !clipped && !is_axis_aligned_in_target && quad->IsEdge();
if (!use_aa)
return false;
@@ -1205,16 +1200,13 @@ void GLRenderer::DrawContentQuad(const DrawingFrame* frame,
// is mapped to the unit square by the vertex shader and mapped
// back to normalized texture coordinates by the fragment shader
// after being clamped to 0-1 range.
- float tex_clamp_x = std::min(
- 0.5f, 0.5f * clamp_tex_rect.width() - kAntiAliasingEpsilon);
- float tex_clamp_y = std::min(
- 0.5f, 0.5f * clamp_tex_rect.height() - kAntiAliasingEpsilon);
- float geom_clamp_x = std::min(
- tex_clamp_x * tex_to_geom_scale_x,
- 0.5f * clamp_geom_rect.width() - kAntiAliasingEpsilon);
- float geom_clamp_y = std::min(
- tex_clamp_y * tex_to_geom_scale_y,
- 0.5f * clamp_geom_rect.height() - kAntiAliasingEpsilon);
+ const float epsilon = 1.0f / 1024.0f;
+ float tex_clamp_x = std::min(0.5f, 0.5f * clamp_tex_rect.width() - epsilon);
+ float tex_clamp_y = std::min(0.5f, 0.5f * clamp_tex_rect.height() - epsilon);
+ float geom_clamp_x = std::min(tex_clamp_x * tex_to_geom_scale_x,
+ 0.5f * clamp_geom_rect.width() - epsilon);
+ float geom_clamp_y = std::min(tex_clamp_y * tex_to_geom_scale_y,
+ 0.5f * clamp_geom_rect.height() - epsilon);
clamp_geom_rect.Inset(geom_clamp_x, geom_clamp_y, geom_clamp_x, geom_clamp_y);
clamp_tex_rect.Inset(tex_clamp_x, tex_clamp_y, tex_clamp_x, tex_clamp_y);