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

Unified Diff: cc/CCLayerTreeHostCommon.cpp

Issue 11027045: Mark layers whether they can use LCD text depending on content-opacity, draw-opacity, and draw-tran… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed useLCDText to canUseLCDText Created 8 years, 2 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
« no previous file with comments | « cc/CCLayerImplTest.cpp ('k') | cc/CCLayerTreeHostImplTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCLayerTreeHostCommon.cpp
diff --git a/cc/CCLayerTreeHostCommon.cpp b/cc/CCLayerTreeHostCommon.cpp
index 24274a6f6f59f4213fdfc1fe73a6070a74b84329..d10002461cd33209656c3bf4d62a9c396fc48c8d 100644
--- a/cc/CCLayerTreeHostCommon.cpp
+++ b/cc/CCLayerTreeHostCommon.cpp
@@ -363,7 +363,7 @@ void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende
template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter>
static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLayer, const WebTransformationMatrix& parentMatrix,
const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix,
- const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree,
+ const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree, bool canUseLCDText,
RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList,
LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, IntRect& drawableContentRectOfSubtree)
{
@@ -512,6 +512,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
}
+ bool shouldAdjustTextAA = !(drawOpacityIsAnimating || animatingTransformToScreen);
+ bool layerCanUseLCDText = shouldAdjustTextAA ? canUseLCDText && (drawOpacity == 1.0) && drawTransform.isIntegerTranslation() : false;
+
FloatRect contentRect(FloatPoint(), layer->contentBounds());
// fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurface's space.
@@ -567,6 +570,10 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// current target surface space that could cause more w < 0 headaches.
subtreeShouldBeClipped = false;
+ // If the new renderSurface is drawn translucent or with a non-integral translation
+ // then the subtree that gets drawn on this renderSurface cannot use LCD text.
+ canUseLCDText = layerCanUseLCDText;
+
if (layer->maskLayer()) {
layer->maskLayer()->setRenderTarget(layer);
layer->maskLayer()->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
@@ -619,6 +626,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
}
}
+ if (shouldAdjustTextAA)
+ layer->setCanUseLCDText(layerCanUseLCDText);
+
IntRect rectInTargetSpace = enclosingIntRect(CCMathUtil::mapClippedRect(layer->drawTransform(), contentRect));
if (layerClipsSubtree(layer)) {
@@ -654,7 +664,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
LayerType* child = CCLayerTreeHostCommon::getChildAsRawPtr(layer->children(), i);
IntRect drawableContentRectOfChildSubtree;
calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
- clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels,
+ clipRectForSubtree, subtreeShouldBeClipped, canUseLCDText, nearestAncestorThatMovesPixels,
renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, drawableContentRectOfChildSubtree);
if (!drawableContentRectOfChildSubtree.isEmpty()) {
accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree);
@@ -773,7 +783,7 @@ void CCLayerTreeHostCommon::calculateDrawTransforms(LayerChromium* rootLayer, co
setupRootLayerAndSurfaceForRecursion<LayerChromium, std::vector<scoped_refptr<LayerChromium> > >(rootLayer, renderSurfaceLayerList, deviceViewportSize);
cc::calculateDrawTransformsInternal<LayerChromium, std::vector<scoped_refptr<LayerChromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
- rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList,
+ rootLayer->renderSurface()->contentRect(), true, true, 0, renderSurfaceLayerList,
rootLayer->renderSurface()->layerList(), 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect);
}
@@ -787,7 +797,7 @@ void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, cons
setupRootLayerAndSurfaceForRecursion<CCLayerImpl, std::vector<CCLayerImpl*> >(rootLayer, renderSurfaceLayerList, deviceViewportSize);
cc::calculateDrawTransformsInternal<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
- rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList,
+ rootLayer->renderSurface()->contentRect(), true, true, 0, renderSurfaceLayerList,
rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect);
}
« no previous file with comments | « cc/CCLayerImplTest.cpp ('k') | cc/CCLayerTreeHostImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698