summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-05-14 17:05:09 -0700
committerChris Craik <ccraik@google.com>2012-05-14 19:13:50 -0700
commitfd977d1127769acd8e0a441cf2ae17de6ab3b979 (patch)
treefbcc236e4044d3032ec6f4d4188fbf7536994bb1 /Source/WebCore/platform/graphics/android/rendering/Surface.cpp
parent4ef88beceb0e8d5b2df5bd4e30360ffcb8c2a65d (diff)
downloadexternal_webkit-fd977d1127769acd8e0a441cf2ae17de6ab3b979.zip
external_webkit-fd977d1127769acd8e0a441cf2ae17de6ab3b979.tar.gz
external_webkit-fd977d1127769acd8e0a441cf2ae17de6ab3b979.tar.bz2
calculate draw transforms before merging layers
bug:6331760 bug:6331909 bug:6470927 Change-Id: I558ba1aafb6f7e6800f3bcd22dab5f98e197ddeb
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/Surface.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
index 3b26ebc..2ec2659 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
@@ -106,8 +106,9 @@ bool Surface::tryUpdateSurface(Surface* oldSurface)
break;
} else if (!m_layers[i]->getInvalRegion()->isEmpty()) {
// merge layer inval - translate the layer's inval region into surface coordinates
- SkPoint pos = m_layers[i]->getPosition();
- m_layers[i]->getInvalRegion()->translate(pos.fX, pos.fY);
+ // TODO: handle scale/3d transform mapping
+ FloatRect layerPos = m_layers[i]->fullContentAreaMapped();
+ m_layers[i]->getInvalRegion()->translate(layerPos.x(), layerPos.y());
invalRegion.op(*(m_layers[i]->getInvalRegion()), SkRegion::kUnion_Op);
break;
}
@@ -130,29 +131,27 @@ void Surface::addLayer(LayerAndroid* layer, const TransformationMatrix& transfor
m_needsTexture |= layer->needsTexture();
m_hasText |= layer->hasText();
- // calculate area size for comparison later
- IntRect rect = layer->fullContentArea();
- SkPoint pos = layer->getPosition();
- rect.setLocation(IntPoint(pos.fX, pos.fY));
+ // add this layer's size to the surface's area
+ // TODO: handle scale/3d transform mapping
+ IntRect rect = enclosingIntRect(layer->fullContentAreaMapped());
if (layer->needsTexture()) {
if (m_fullContentArea.isEmpty()) {
m_drawTransform = transform;
- m_drawTransform.translate3d(-pos.fX, -pos.fY, 0);
+ m_drawTransform.translate3d(-rect.x(), -rect.y(), 0);
m_fullContentArea = rect;
} else
m_fullContentArea.unite(rect);
- ALOGV("Surf %p adding LA %p, size %d, %d %dx%d, now Surf size %d,%d %dx%d",
- this, layer, rect.x(), rect.y(), rect.width(), rect.height(),
- m_fullContentArea.x(), m_fullContentArea.y(),
- m_fullContentArea.width(), m_fullContentArea.height());
+ ALOGV("Surf %p adding LA %p, size " INT_RECT_FORMAT
+ " now fullContentArea " INT_RECT_FORMAT,
+ this, layer, INT_RECT_ARGS(rect), INT_RECT_ARGS(m_fullContentArea));
}
if (isBase())
m_background = static_cast<BaseLayerAndroid*>(layer)->getBackgroundColor();
}
-IntRect Surface::visibleContentArea(bool force3dContentVisible)
+IntRect Surface::visibleContentArea(bool force3dContentVisible) const
{
if (singleLayer())
return getFirstLayer()->visibleContentArea(force3dContentVisible);