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

Unified Diff: cc/tiled_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/tiled_layer_impl.cc
diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc
index f76faad5fe5c042524ecd5e97ef2147a1698611e..2eb3dffcdfeed89b47131df8661d2d1e499b3cb9 100644
--- a/cc/tiled_layer_impl.cc
+++ b/cc/tiled_layer_impl.cc
@@ -162,6 +162,16 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
if (tileRect.IsEmpty())
continue;
+ bool clipped = false;
+ gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), gfx::QuadF(visibleContentRect()), clipped);
+ bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.IsRectilinear();
+ bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget;
+
+ bool leftEdgeAA = !i && useAA;
+ bool topEdgeAA = !j && useAA;
+ bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA;
+ bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA;
+
if (!tile || !tile->resourceId()) {
if (drawCheckerboardForMissingTiles()) {
SkColor checkerColor;
@@ -176,7 +186,7 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
appendQuadsData.numMissingTiles++;
} else {
scoped_ptr<SolidColorDrawQuad> solidColorQuad = SolidColorDrawQuad::Create();
- solidColorQuad->SetNew(sharedQuadState, tileRect, backgroundColor());
+ solidColorQuad->SetNew(sharedQuadState, tileRect, DrawQuad::AntiAliasing(leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA), backgroundColor());
if (quadSink.append(solidColorQuad.PassAs<DrawQuad>(), appendQuadsData))
appendQuadsData.numMissingTiles++;
}
@@ -195,18 +205,8 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
float tileHeight = static_cast<float>(m_tiler->tileSize().height());
gfx::Size textureSize(tileWidth, tileHeight);
- bool clipped = false;
- gfx::QuadF visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), gfx::QuadF(visibleContentRect()), clipped);
- bool isAxisAlignedInTarget = !clipped && visibleContentInTargetQuad.IsRectilinear();
- bool useAA = m_tiler->hasBorderTexels() && !isAxisAlignedInTarget;
-
- bool leftEdgeAA = !i && useAA;
- bool topEdgeAA = !j && useAA;
- bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA;
- bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA;
-
scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create();
- quad->SetNew(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), texCoordRect, textureSize, tile->contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA);
+ quad->SetNew(sharedQuadState, tileRect, tileOpaqueRect, DrawQuad::AntiAliasing(leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA), tile->resourceId(), texCoordRect, textureSize, tile->contentsSwizzled());
quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
}
}

Powered by Google App Engine
This is Rietveld 408576698