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

Unified Diff: cc/solid_color_layer_impl.cc

Issue 11649005: cc: Support anti-aliasing for solid color layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add DrawQuad::AntiAliasing struct. Created 7 years, 11 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/solid_color_layer_impl.cc
diff --git a/cc/solid_color_layer_impl.cc b/cc/solid_color_layer_impl.cc
index 1d5ed516fdbc52946389423d46a1eb75d9121085..70b7b3ea2ff0eb0b42c8073fe8d0f6ffcc44da57 100644
--- a/cc/solid_color_layer_impl.cc
+++ b/cc/solid_color_layer_impl.cc
@@ -4,8 +4,10 @@
#include "cc/solid_color_layer_impl.h"
+#include "cc/math_util.h"
#include "cc/quad_sink.h"
#include "cc/solid_color_draw_quad.h"
+#include "ui/gfx/quad_f.h"
namespace cc {
@@ -31,8 +33,19 @@ void SolidColorLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appen
for (int x = 0; x < width; x += m_tileSize) {
for (int y = 0; y < height; y += m_tileSize) {
gfx::Rect solidTileRect(x, y, std::min(width - x, m_tileSize), std::min(height - y, m_tileSize));
+
+ bool clipped = false;
+ gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), gfx::QuadF(visibleContentRect()), clipped);
+ bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.IsRectilinear();
+ bool useAA = !isAxisAlignedInTarget;
+
+ bool leftEdgeAA = !x && useAA;
+ bool topEdgeAA = !y && useAA;
+ bool rightEdgeAA = x >= width - m_tileSize && useAA;
+ bool bottomEdgeAA = y >= height - m_tileSize && useAA;
+
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
- quad->SetNew(sharedQuadState, solidTileRect, backgroundColor());
+ quad->SetNew(sharedQuadState, solidTileRect, DrawQuad::AntiAliasing(leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA), backgroundColor());
quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
}
}

Powered by Google App Engine
This is Rietveld 408576698