diff options
6 files changed, 21 insertions, 9 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h index f821d89..79c84b4 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h @@ -199,13 +199,6 @@ public: void dumpLayers(FILE*, int indentLevel) const; void dumpToLog() const; - /** Call this with the current viewport (scrolling, zoom) to update - the position of the fixed layers. - - This call is recursive, so it should be called on the root of the - hierarchy. - */ - void updateLayerPositions(SkRect viewPort, IFrameLayerAndroid* parentIframeLayer = 0); virtual IFrameLayerAndroid* updatePosition(SkRect viewport, IFrameLayerAndroid* parentIframeLayer); @@ -297,6 +290,13 @@ public: } protected: + /** Call this with the current viewport (scrolling, zoom) to update + the position of the fixed layers. + + This call is recursive, so it should be called on the root of the + hierarchy. + */ + void updateLayerPositions(SkRect viewPort, IFrameLayerAndroid* parentIframeLayer = 0); virtual void onDraw(SkCanvas*, SkScalar opacity, android::DrawExtra* extra, PaintStyle style); virtual InvalidateFlags onSetHwAccelerated(bool hwAccelerated) { return InvalidateNone; } TransformationMatrix m_drawTransform; diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp index df417a3..c9c887a 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp @@ -144,7 +144,7 @@ bool ImageTexture::equalsCRC(unsigned crc) // Return 0 if the image does not meet the repeatable criteria. unsigned int ImageTexture::getImageTextureId() { - return m_tileGrid->getImageTextureId(); + return m_tileGrid ? m_tileGrid->getImageTextureId() : 0; } int ImageTexture::nbTextures() diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index 73466d3..1898910 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -420,6 +420,14 @@ bool Surface::blitFromContents(Tile* tile) if (!singleLayer() || !tile || !getFirstLayer() || !getFirstLayer()->content()) return false; + if (tile->frontTexture() != tile->lastDrawnTexture()) { + // the below works around an issue where glTexSubImage2d can't update a + // texture that hasn't drawn yet by drawing it off screen. + // glFlush() and glFinish() work also, but are likely more wasteful. + SkRect rect = SkRect::MakeXYWH(-100, -100, 0, 0); + FloatRect fillPortion(0, 0, 0, 0); + tile->frontTexture()->drawGL(false, rect, 1.0f, 0, false, true, fillPortion); + } LayerContent* content = getFirstLayer()->content(); // Extract the dirty rect from the region. Note that this is *NOT* constrained // to this tile diff --git a/Source/WebCore/platform/graphics/android/rendering/Tile.cpp b/Source/WebCore/platform/graphics/android/rendering/Tile.cpp index e674884..96b189a 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Tile.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Tile.cpp @@ -52,6 +52,7 @@ Tile::Tile(bool isLayerTile) , m_y(-1) , m_frontTexture(0) , m_backTexture(0) + , m_lastDrawnTexture(0) , m_scale(1) , m_dirty(true) , m_repaintsPending(0) @@ -242,6 +243,7 @@ bool Tile::drawGL(float opacity, const SkRect& rect, float scale, m_frontTexture->drawGL(isLayerTile(), rect, opacity, transform, forceBlending, usePointSampling, fillPortion); + m_lastDrawnTexture = m_frontTexture; return true; } diff --git a/Source/WebCore/platform/graphics/android/rendering/Tile.h b/Source/WebCore/platform/graphics/android/rendering/Tile.h index 2dc5414..b045f1f 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Tile.h +++ b/Source/WebCore/platform/graphics/android/rendering/Tile.h @@ -127,6 +127,7 @@ public: int y() const { return m_y; } TileTexture* frontTexture() { return m_frontTexture; } TileTexture* backTexture() { return m_backTexture; } + TileTexture* lastDrawnTexture() { return m_lastDrawnTexture; } // only used for prioritization - the higher, the more relevant the tile is unsigned long long drawCount() { return m_drawCount; } @@ -151,6 +152,7 @@ private: TileTexture* m_frontTexture; TileTexture* m_backTexture; + TileTexture* m_lastDrawnTexture; float m_scale; // used to signal that the that the tile is out-of-date and needs to be diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 38ba451..a67b5fd 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -316,7 +316,7 @@ void draw(SkCanvas* canvas, SkColor bgColor, DrawExtras extras) // call this to be sure we've adjusted for any scrolling or animations // before we actually draw - m_baseLayer->updateLayerPositions(m_visibleContentRect); + m_baseLayer->updatePositionsRecursive(m_visibleContentRect); m_baseLayer->updatePositions(); // We have to set the canvas' matrix on the base layer |