diff options
author | Chris Craik <ccraik@google.com> | 2012-05-14 19:18:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-14 19:18:30 -0700 |
commit | 8001929cfbff025063aab7bd129277b24cf3a9ff (patch) | |
tree | 29203b182abbccfa95b2a88c339433319495089d /Source | |
parent | 55ff9f5ac537f2b11ae997f1029bdccb87008825 (diff) | |
parent | fd977d1127769acd8e0a441cf2ae17de6ab3b979 (diff) | |
download | external_webkit-8001929cfbff025063aab7bd129277b24cf3a9ff.zip external_webkit-8001929cfbff025063aab7bd129277b24cf3a9ff.tar.gz external_webkit-8001929cfbff025063aab7bd129277b24cf3a9ff.tar.bz2 |
Merge "calculate draw transforms before merging layers" into jb-dev
Diffstat (limited to 'Source')
3 files changed, 14 insertions, 16 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); diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h index bd1d21c..a79a286 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.h +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h @@ -71,9 +71,9 @@ public: private: IntRect computePrepareArea(); - IntRect visibleContentArea(bool force3dContentVisible = false); + IntRect visibleContentArea(bool force3dContentVisible = false) const; IntRect fullContentArea(); - bool singleLayer() { return m_layers.size() == 1; } + bool singleLayer() const { return m_layers.size() == 1; } bool useAggressiveRendering(); const TransformationMatrix* drawTransform(); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index 4badf8b..3b6b306 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -52,8 +52,7 @@ SurfaceCollection::SurfaceCollection(BaseLayerAndroid* layer) // calculate draw transforms and z values SkRect visibleRect = SkRect::MakeLTRB(0, 0, 1, 1); - m_compositedRoot->updateLayerPositions(visibleRect); - // TODO: updateGLPositionsAndScale? + m_compositedRoot->updatePositionsRecursive(visibleRect); // allocate surfaces for layers, merging where possible ALOGV("new tree, allocating surfaces for tree %p", m_baseLayer); |