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 | |
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')
16 files changed, 95 insertions, 106 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index aff2981..98244b9 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -100,7 +100,11 @@ void ContentLayerChromium::paintContentsIfDirty(const IntRect& targetSurfaceRect IntRect layerRect = visibleLayerRect(targetSurfaceRect); if (layerRect.isEmpty()) return; - m_tiler->invalidateRect(enclosingIntRect(m_dirtyRect)); + + IntRect dirty = enclosingIntRect(m_dirtyRect); + dirty.intersect(layerBounds()); + m_tiler->invalidateRect(dirty); + m_tiler->update(painter, layerRect); m_dirtyRect = FloatRect(); } @@ -182,7 +186,6 @@ void ContentLayerChromium::draw(const IntRect& targetSurfaceRect) IntRect layerRect = visibleLayerRect(targetSurfaceRect); if (!layerRect.isEmpty()) m_tiler->draw(layerRect, transform, ccLayerImpl()->drawOpacity()); - m_tiler->unreserveTextures(); } void ContentLayerChromium::createTilerIfNeeded() @@ -215,11 +218,6 @@ void ContentLayerChromium::bindContentsTexture() texture->bindTexture(); } -void ContentLayerChromium::unreserveContentsTexture() -{ - m_tiler->unreserveTextures(); -} - void ContentLayerChromium::setIsMask(bool isMask) { setTilingOption(isMask ? NeverTile : AutoTile); diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h index c0cf582..ab5485f 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h @@ -55,7 +55,6 @@ public: virtual void paintContentsIfDirty(const IntRect& targetSurfaceRect); virtual void updateCompositorResources(); virtual void setIsMask(bool); - virtual void unreserveContentsTexture(); virtual void bindContentsTexture(); virtual void draw(const IntRect& targetSurfaceRect); diff --git a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp index ac1e1af..5ca1414 100644 --- a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp @@ -454,25 +454,8 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, // Skip 100% transparent text; no need to draw anything. if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStroke && !graphicsContext->hasShadow()) return; - if (!alpha || windowsCanHandleDrawTextShadow(graphicsContext) || !windowsCanHandleTextDrawingWithoutShadow(graphicsContext)) { - drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); - return; - } - // Draw in two passes: skia for the shadow, GDI for foreground text - // pass1: shadow (will use skia) - graphicsContext->save(); - graphicsContext->setFillColor(Color::transparent, graphicsContext->fillColorSpace()); - drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); - graphicsContext->restore(); - // pass2: foreground text (will use GDI) - FloatSize shadowOffset; - float shadowBlur; - Color shadowColor; - ColorSpace shadowColorSpace; - graphicsContext->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); - graphicsContext->setShadow(shadowOffset, shadowBlur, Color::transparent, shadowColorSpace); + drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); - graphicsContext->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); } FloatRect Font::selectionRectForComplexText(const TextRun& run, diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index d72fb1e..b0b7053 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -74,19 +74,19 @@ void ImageLayerChromium::paintContentsIfDirty(const IntRect&) if (!m_dirtyRect.isEmpty()) { m_decodedImage.updateFromImage(m_contents->nativeImageForCurrentFrame()); + updateLayerSize(m_decodedImage.size()); + IntRect paintRect(IntPoint(0, 0), m_decodedImage.size()); + if (!m_dirtyRect.isEmpty()) { + m_tiler->invalidateRect(paintRect); + m_dirtyRect = IntRect(); + } } } void ImageLayerChromium::updateCompositorResources() { - updateLayerSize(m_decodedImage.size()); - IntRect paintRect(IntPoint(0, 0), m_decodedImage.size()); - if (!m_dirtyRect.isEmpty()) { - m_tiler->invalidateRect(paintRect); - m_dirtyRect = IntRect(); - } - m_tiler->updateFromPixels(paintRect, m_decodedImage.pixels()); + m_tiler->updateFromPixels(paintRect, paintRect, m_decodedImage.pixels()); } IntRect ImageLayerChromium::layerBounds() const 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(); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 813eb46..b373c59 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -110,6 +110,7 @@ public: const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); } const LayerChromium::BorderProgram* borderProgram() const { return m_borderProgram.get(); } + const CCHeadsUpDisplay::Program* headsUpDisplayProgram() const { return m_headsUpDisplayProgram.get(); } const RenderSurfaceChromium::Program* renderSurfaceProgram() const { return m_renderSurfaceProgram.get(); } const RenderSurfaceChromium::MaskProgram* renderSurfaceMaskProgram() const { return m_renderSurfaceMaskProgram.get(); } const LayerTilerChromium::Program* tilerProgram() const { return m_tilerProgram.get(); } @@ -143,7 +144,7 @@ private: void updateRootLayerContents(); void updatePropertiesAndRenderSurfaces(LayerChromium*, const TransformationMatrix& parentMatrix, LayerList& renderSurfaceLayerList, LayerList& layers); - void paintContentsRecursive(LayerChromium*); + void paintLayerContents(const LayerList&); void updateCompositorResourcesRecursive(LayerChromium*); void drawLayers(const LayerList& renderSurfaceLayerList); @@ -205,6 +206,7 @@ private: // we cannot store these values in static variables. OwnPtr<GeometryBinding> m_sharedGeometry; OwnPtr<LayerChromium::BorderProgram> m_borderProgram; + OwnPtr<CCHeadsUpDisplay::Program> m_headsUpDisplayProgram; OwnPtr<RenderSurfaceChromium::Program> m_renderSurfaceProgram; OwnPtr<RenderSurfaceChromium::MaskProgram> m_renderSurfaceMaskProgram; OwnPtr<LayerTilerChromium::Program> m_tilerProgram; diff --git a/Source/WebCore/platform/graphics/chromium/LayerTexture.cpp b/Source/WebCore/platform/graphics/chromium/LayerTexture.cpp index 23cb4b3..39402f6 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTexture.cpp @@ -71,12 +71,6 @@ bool LayerTexture::reserve(const IntSize& size, unsigned format) return m_textureId; } -void LayerTexture::unreserve() -{ - if (m_token) - m_textureManager->unprotectTexture(m_token); -} - void LayerTexture::bindTexture() { ASSERT(m_textureManager->hasTexture(m_token)); diff --git a/Source/WebCore/platform/graphics/chromium/LayerTexture.h b/Source/WebCore/platform/graphics/chromium/LayerTexture.h index b60dff2..2d43b34 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTexture.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTexture.h @@ -49,7 +49,6 @@ public: bool isValid(const IntSize&, unsigned format); bool reserve(const IntSize&, unsigned format); - void unreserve(); bool isReserved() { ASSERT(m_textureManager); diff --git a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp index 54c6ac2..5c2375e 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp @@ -60,6 +60,13 @@ LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, con setTileSize(tileSize); } +void LayerTilerChromium::setLayerRenderer(LayerRendererChromium* layerRenderer) +{ + if (m_layerRenderer != layerRenderer) + reset(); + m_layerRenderer = layerRenderer; +} + LayerTilerChromium::~LayerTilerChromium() { reset(); @@ -252,10 +259,14 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont } } - if (dirtyLayerRect.isEmpty()) - return; + // Due to borders, when the paint rect is extended to tile boundaries, it + // may end up overlapping more tiles than the original content rect. Record + // that original rect so we don't upload more tiles than necessary. + m_updateRect = contentRect; m_paintRect = layerRectToContentRect(dirtyLayerRect); + if (dirtyLayerRect.isEmpty()) + return; m_canvas.resize(m_paintRect.size()); @@ -276,11 +287,11 @@ void LayerTilerChromium::uploadCanvas() PlatformCanvas::AutoLocker locker(&m_canvas); { TRACE_EVENT("LayerTilerChromium::updateFromPixels", this, 0); - updateFromPixels(m_paintRect, locker.pixels()); + updateFromPixels(m_updateRect, m_paintRect, locker.pixels()); } } -void LayerTilerChromium::updateFromPixels(const IntRect& paintRect, const uint8_t* paintPixels) +void LayerTilerChromium::updateFromPixels(const IntRect& contentRect, const IntRect& paintRect, const uint8_t* paintPixels) { // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update. if (!m_tilingData.totalSizeX() || !m_tilingData.totalSizeY()) @@ -289,7 +300,7 @@ void LayerTilerChromium::updateFromPixels(const IntRect& paintRect, const uint8_ GraphicsContext3D* context = layerRendererContext(); int left, top, right, bottom; - contentRectToTileIndices(paintRect, left, top, right, bottom); + contentRectToTileIndices(contentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { Tile* tile = tileAt(i, j); @@ -407,16 +418,6 @@ void LayerTilerChromium::draw(const IntRect& contentRect, const TransformationMa } } -void LayerTilerChromium::unreserveTextures() -{ - for (TileMap::iterator iter = m_tiles.begin(); iter != m_tiles.end(); ++iter) { - Tile* tile = iter->second.get(); - if (!tile) - continue; - tile->texture()->unreserve(); - } -} - void LayerTilerChromium::growLayerToContain(const IntRect& contentRect) { // Grow the tile array to contain this content rect. diff --git a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h index 111dd7e..1650c86 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h @@ -68,20 +68,16 @@ public: void uploadCanvas(); // Reserve and upload tile textures from an externally painted buffer. - void updateFromPixels(const IntRect& paintRect, const uint8_t* pixels); + void updateFromPixels(const IntRect& contentRect, const IntRect& paintRect, const uint8_t* pixels); // Draw all tiles that intersect with the content rect. void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity); - // If uploadCanvas/updateFromPixels is called, this must be called after - // draw() to unreserve any textures that were reserved prior to uploading. - void unreserveTextures(); - // Set position of this tiled layer in content space. void setLayerPosition(const IntPoint& position); // Change the tile size. This may invalidate all the existing tiles. void setTileSize(const IntSize& size); - void setLayerRenderer(LayerRendererChromium* layerRenderer) { m_layerRenderer = layerRenderer; } + void setLayerRenderer(LayerRendererChromium*); bool skipsDraw() const { return m_skipsDraw; } @@ -161,7 +157,9 @@ private: // Tightly packed set of unused tiles. Vector<RefPtr<Tile> > m_unusedTiles; + // State held between update and uploadCanvas. IntRect m_paintRect; + IntRect m_updateRect; PlatformCanvas m_canvas; // Cache a tile-sized pixel buffer to draw into. diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp index c93ef3f..31249ae 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp @@ -136,11 +136,6 @@ void RenderSurfaceChromium::drawSurface(CCLayerImpl* maskLayer, const Transforma LayerChromium::drawTexturedQuad(layerRenderer()->context(), layerRenderer()->projectionMatrix(), drawTransform, m_contentRect.width(), m_contentRect.height(), m_drawOpacity, shaderMatrixLocation, shaderAlphaLocation); - - m_contentsTexture->unreserve(); - - if (maskLayer) - maskLayer->unreserveContentsTexture(); } void RenderSurfaceChromium::draw(const IntRect&) diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp index 13cdb89..e98a701 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp @@ -84,17 +84,10 @@ void TextureManager::protectTexture(TextureToken token) m_textures.add(token, info); } -void TextureManager::unprotectTexture(TextureToken token) +void TextureManager::unprotectAllTextures() { - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) { - TextureInfo info = it->second; - if (info.isProtected) { - info.isProtected = false; - m_textures.remove(it); - m_textures.add(token, info); - } - } + for (TextureMap::iterator it = m_textures.begin(); it != m_textures.end(); ++it) + it->second.isProtected = false; } bool TextureManager::reduceMemoryToLimit(size_t limit) diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h index 83104a9..a90b8b2 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.h @@ -52,7 +52,7 @@ public: unsigned requestTexture(TextureToken, IntSize, unsigned textureFormat, bool* newTexture = 0); void protectTexture(TextureToken); - void unprotectTexture(TextureToken); + void unprotectAllTextures(); bool isProtected(TextureToken); private: diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp index d22b098..cb2874d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp @@ -32,6 +32,7 @@ #include "FontDescription.h" #include "GraphicsContext3D.h" #include "LayerChromium.h" +#include "LayerRendererChromium.h" #include "LayerTexture.h" #include "TextRun.h" #include "TextStream.h" @@ -109,7 +110,7 @@ void CCHeadsUpDisplay::draw() } // Draw the HUD onto the default render surface. - const LayerTilerChromium::Program* program = m_layerRenderer->tilerProgram(); + const Program* program = m_layerRenderer->headsUpDisplayProgram(); ASSERT(program && program->initialized()); GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); m_hudTexture->bindTexture(); @@ -122,8 +123,6 @@ void CCHeadsUpDisplay::draw() matrix, hudSize.width(), hudSize.height(), 1.0f, program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation()); - - m_hudTexture->unreserve(); } void CCHeadsUpDisplay::drawHudContents(GraphicsContext* ctx, const IntSize& hudSize) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h index 09f198a..fc68f1d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.h @@ -28,13 +28,15 @@ #if USE(ACCELERATED_COMPOSITING) #include "Font.h" -#include "LayerRendererChromium.h" - +#include "ProgramBinding.h" +#include "ShaderChromium.h" namespace WebCore { class GeometryBinding; class GraphicsContext3D; +class LayerRendererChromium; +class LayerTexture; // Class that handles drawing of composited render layers using GL. class CCHeadsUpDisplay { @@ -58,6 +60,8 @@ public: bool enabled() const { return m_showPlatformLayerTree || m_showFPSCounter; } void draw(); + typedef ProgramBinding<VertexShaderPosTex, FragmentShaderBGRATexAlpha> Program; + private: explicit CCHeadsUpDisplay(LayerRendererChromium* owner); void drawHudContents(GraphicsContext*, const IntSize& hudSize); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index 649f4dd..9b6bc42 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -51,6 +51,7 @@ public: // When this class gets subclasses, remember to add 'virtual' here. virtual ~CCLayerImpl(); void resetOwner() { m_owner = 0; } + LayerChromium* owner() const { return m_owner; } #ifndef NDEBUG int debugID() const { return m_debugID; } |