diff options
author | Steve Block <steveblock@google.com> | 2011-06-10 16:52:27 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-14 01:14:02 +0100 |
commit | 54cdeeebc7adcbcd900e8b6a141a8cae27d9a631 (patch) | |
tree | 845b0d338b204a48560eca3b51b34cf92ed96840 /Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp | |
parent | d2c5226a647dc21d0c15267e09a3d19cf3e0d593 (diff) | |
download | external_webkit-54cdeeebc7adcbcd900e8b6a141a8cae27d9a631.zip external_webkit-54cdeeebc7adcbcd900e8b6a141a8cae27d9a631.tar.gz external_webkit-54cdeeebc7adcbcd900e8b6a141a8cae27d9a631.tar.bz2 |
Merge WebKit at branches/chromium/742 r88085: Initial merge by git.
Change-Id: I0501b484b9528e31b0026e5ad64416dd6541cdde
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp | 69 |
1 files changed, 46 insertions, 23 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 27a67e9..e62b674 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -171,7 +171,6 @@ void LayerRendererChromium::drawRootLayer() m_rootLayerContentTiler->uploadCanvas(); m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f); - m_rootLayerContentTiler->unreserveTextures(); } void LayerRendererChromium::setViewport(const IntRect& visibleRect, const IntRect& contentRect, const IntPoint& scrollPosition) @@ -235,6 +234,8 @@ void LayerRendererChromium::updateAndDrawLayers() drawLayers(renderSurfaceLayerList); + m_textureManager->unprotectAllTextures(); + // After drawLayers: if (hardwareCompositing() && m_contextSupportsLatch) { Extensions3DChromium* parentExt = static_cast<Extensions3DChromium*>(m_context->getExtensions()); @@ -282,7 +283,7 @@ void LayerRendererChromium::updateLayers(LayerList& renderSurfaceLayerList) // concept of a large content layer. updatePropertiesAndRenderSurfaces(m_rootLayer.get(), identityMatrix, renderSurfaceLayerList, m_defaultRenderSurface->m_layerList); - paintContentsRecursive(m_rootLayer.get()); + paintLayerContents(renderSurfaceLayerList); // FIXME: Before updateCompositorResourcesRecursive, when the compositor runs in // its own thread, and when the copyTexImage2D bug is fixed, insert @@ -328,6 +329,46 @@ void LayerRendererChromium::updateLayers(LayerList& renderSurfaceLayerList) } } +void LayerRendererChromium::paintLayerContents(const LayerList& renderSurfaceLayerList) +{ + for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { + CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get(); + RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); + ASSERT(renderSurface); + + // Render surfaces whose drawable area has zero width or height + // will have no layers associated with them and should be skipped. + if (!renderSurface->m_layerList.size()) + continue; + + LayerList& layerList = renderSurface->m_layerList; + ASSERT(layerList.size()); + for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) { + CCLayerImpl* ccLayerImpl = layerList[layerIndex].get(); + + // Layers that start a new render surface will be painted when the render + // surface's list is processed. + if (ccLayerImpl->renderSurface() && ccLayerImpl->renderSurface() != renderSurface) + continue; + + LayerChromium* layer = ccLayerImpl->owner(); + if (layer->bounds().isEmpty()) + continue; + + const IntRect targetSurfaceRect = layer->ccLayerImpl()->scissorRect(); + + if (layer->drawsContent()) + layer->paintContentsIfDirty(targetSurfaceRect); + if (layer->maskLayer() && layer->maskLayer()->drawsContent()) + layer->maskLayer()->paintContentsIfDirty(targetSurfaceRect); + if (layer->replicaLayer() && layer->replicaLayer()->drawsContent()) + layer->replicaLayer()->paintContentsIfDirty(targetSurfaceRect); + if (layer->replicaLayer() && layer->replicaLayer()->maskLayer() && layer->replicaLayer()->maskLayer()->drawsContent()) + layer->replicaLayer()->maskLayer()->paintContentsIfDirty(targetSurfaceRect); + } + } +} + void LayerRendererChromium::drawLayers(const LayerList& renderSurfaceLayerList) { TRACE_EVENT("LayerRendererChromium::drawLayers", this, 0); @@ -761,27 +802,6 @@ void LayerRendererChromium::updatePropertiesAndRenderSurfaces(LayerChromium* lay std::stable_sort(&descendants.at(thisLayerIndex), descendants.end(), compareLayerZ); } -void LayerRendererChromium::paintContentsRecursive(LayerChromium* layer) -{ - const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers(); - for (size_t i = 0; i < sublayers.size(); ++i) - paintContentsRecursive(sublayers[i].get()); - - if (layer->bounds().isEmpty()) - return; - - const IntRect targetSurfaceRect = layer->ccLayerImpl()->scissorRect(); - - if (layer->drawsContent()) - layer->paintContentsIfDirty(targetSurfaceRect); - if (layer->maskLayer() && layer->maskLayer()->drawsContent()) - layer->maskLayer()->paintContentsIfDirty(targetSurfaceRect); - if (layer->replicaLayer() && layer->replicaLayer()->drawsContent()) - layer->replicaLayer()->paintContentsIfDirty(targetSurfaceRect); - if (layer->replicaLayer() && layer->replicaLayer()->maskLayer() && layer->replicaLayer()->maskLayer()->drawsContent()) - layer->replicaLayer()->maskLayer()->paintContentsIfDirty(targetSurfaceRect); -} - void LayerRendererChromium::updateCompositorResourcesRecursive(LayerChromium* layer) { const Vector<RefPtr<LayerChromium> >& sublayers = layer->getSublayers(); @@ -985,6 +1005,7 @@ bool LayerRendererChromium::initializeSharedObjects() m_sharedGeometry = adoptPtr(new GeometryBinding(m_context.get())); m_borderProgram = adoptPtr(new LayerChromium::BorderProgram(m_context.get())); + m_headsUpDisplayProgram = adoptPtr(new CCHeadsUpDisplay::Program(m_context.get())); m_canvasLayerProgram = adoptPtr(new CCCanvasLayerImpl::Program(m_context.get())); m_videoLayerRGBAProgram = adoptPtr(new CCVideoLayerImpl::RGBAProgram(m_context.get())); m_videoLayerYUVProgram = adoptPtr(new CCVideoLayerImpl::YUVProgram(m_context.get())); @@ -995,6 +1016,7 @@ bool LayerRendererChromium::initializeSharedObjects() if (!m_sharedGeometry->initialized() || !m_borderProgram->initialized() || !m_canvasLayerProgram->initialized() + || !m_headsUpDisplayProgram->initialized() || !m_videoLayerRGBAProgram->initialized() || !m_videoLayerYUVProgram->initialized() || !m_pluginLayerProgram->initialized() || !m_renderSurfaceProgram->initialized() || !m_renderSurfaceMaskProgram->initialized() || !m_tilerProgram->initialized()) { @@ -1014,6 +1036,7 @@ void LayerRendererChromium::cleanupSharedObjects() m_sharedGeometry.clear(); m_borderProgram.clear(); m_canvasLayerProgram.clear(); + m_headsUpDisplayProgram.clear(); m_videoLayerRGBAProgram.clear(); m_videoLayerYUVProgram.clear(); m_pluginLayerProgram.clear(); |