diff options
Diffstat (limited to 'WebCore/platform/graphics')
-rw-r--r-- | WebCore/platform/graphics/android/MediaLayer.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/MediaLayer.h | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TextureOwner.cpp | 7 |
3 files changed, 17 insertions, 2 deletions
diff --git a/WebCore/platform/graphics/android/MediaLayer.cpp b/WebCore/platform/graphics/android/MediaLayer.cpp index 9c370a5..e4ccbdb 100644 --- a/WebCore/platform/graphics/android/MediaLayer.cpp +++ b/WebCore/platform/graphics/android/MediaLayer.cpp @@ -46,6 +46,7 @@ MediaLayer::MediaLayer() : LayerAndroid(false) m_bufferedTexture = new MediaTexture(EGL_NO_CONTEXT); m_bufferedTexture->incStrong(this); m_currentTextureInfo = 0; + m_isContentInverted = false; XLOG("Creating Media Layer %p", this); } @@ -54,6 +55,7 @@ MediaLayer::MediaLayer(const MediaLayer& layer) : LayerAndroid(layer) m_bufferedTexture = layer.getTexture(); m_bufferedTexture->incStrong(this); m_currentTextureInfo = 0; + m_isContentInverted = layer.m_isContentInverted; XLOG("Creating Media Layer Copy %p -> %p", &layer, this); } @@ -71,6 +73,14 @@ bool MediaLayer::drawGL(SkMatrix& matrix) SkRect rect; rect.set(0, 0, getSize().width(), getSize().height()); TransformationMatrix m = drawTransform(); + + // the layer's shader draws the content inverted so we must undo + // that change in the transformation matrix + if (!m_isContentInverted) { + m.flipY(); + m.translate(0, -getSize().height()); + } + TilesManager::instance()->shader()->drawLayerQuad(m, rect, textureInfo->m_textureId, 1.0f); //TODO fix this m_drawOpacity diff --git a/WebCore/platform/graphics/android/MediaLayer.h b/WebCore/platform/graphics/android/MediaLayer.h index eb56440..1944512 100644 --- a/WebCore/platform/graphics/android/MediaLayer.h +++ b/WebCore/platform/graphics/android/MediaLayer.h @@ -54,6 +54,7 @@ public: void setCurrentTextureInfo(TextureInfo* info) { m_currentTextureInfo = info; } TextureInfo* getCurrentTextureInfo() const { return m_currentTextureInfo; } + void invertContents(bool invertContent) { m_isContentInverted = invertContent; } private: @@ -62,6 +63,7 @@ private: TextureInfo* m_currentTextureInfo; + bool m_isContentInverted; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/TextureOwner.cpp b/WebCore/platform/graphics/android/TextureOwner.cpp index 6a6845a..c4446d7 100644 --- a/WebCore/platform/graphics/android/TextureOwner.cpp +++ b/WebCore/platform/graphics/android/TextureOwner.cpp @@ -34,8 +34,11 @@ TextureOwner::~TextureOwner() { if (m_ownedTextures.size()) { // This TextureOwner owns textures still! - HashSet<BackedDoubleBufferedTexture*>::iterator it = m_ownedTextures.begin(); - for (; it != m_ownedTextures.end(); ++it) + HashSet<BackedDoubleBufferedTexture*> textures; + // Swap to a local copy because release will modify the iterator. + textures.swap(m_ownedTextures); + HashSet<BackedDoubleBufferedTexture*>::const_iterator it = textures.begin(); + for (; it != textures.end(); ++it) (*it)->release(this); } } |