summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebCore/platform/graphics/android/MediaLayer.cpp10
-rw-r--r--WebCore/platform/graphics/android/MediaLayer.h2
-rw-r--r--WebKit/android/plugins/ANPOpenGLInterface.cpp21
-rw-r--r--WebKit/android/plugins/ANPOpenGL_npapi.h6
4 files changed, 39 insertions, 0 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/WebKit/android/plugins/ANPOpenGLInterface.cpp b/WebKit/android/plugins/ANPOpenGLInterface.cpp
index 55eb3e0..8f5f9b4 100644
--- a/WebKit/android/plugins/ANPOpenGLInterface.cpp
+++ b/WebKit/android/plugins/ANPOpenGLInterface.cpp
@@ -30,6 +30,11 @@
#include "PluginView.h"
#include "PluginWidgetAndroid.h"
#include "MediaLayer.h"
+#include "WebViewCore.h"
+#include "Frame.h"
+#include "Page.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
using namespace android;
@@ -84,6 +89,21 @@ static void anp_releaseTexture(NPP instance, const ANPTextureInfo* textureInfo)
texture->producerReleaseAndSwap();
}
+static void anp_invertPluginContent(NPP instance, bool isContentInverted) {
+ WebCore::PluginView* pluginView = pluginViewForInstance(instance);
+ PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
+ WebCore::MediaLayer* mediaLayer = pluginWidget->getLayer();
+
+ mediaLayer->invertContents(isContentInverted);
+
+ //force the layer to sync to the UI thread
+ WebViewCore* wvc = pluginWidget->webViewCore();
+ if (wvc)
+ wvc->mainFrame()->page()->chrome()->client()->scheduleCompositingLayerSync();
+}
+
+
+
///////////////////////////////////////////////////////////////////////////////
#define ASSIGN(obj, name) (obj)->name = anp_##name
@@ -94,4 +114,5 @@ void ANPOpenGLInterfaceV0_Init(ANPInterface* v) {
ASSIGN(i, acquireContext);
ASSIGN(i, lockTexture);
ASSIGN(i, releaseTexture);
+ ASSIGN(i, invertPluginContent);
}
diff --git a/WebKit/android/plugins/ANPOpenGL_npapi.h b/WebKit/android/plugins/ANPOpenGL_npapi.h
index bfca0dd..5aabbc4 100644
--- a/WebKit/android/plugins/ANPOpenGL_npapi.h
+++ b/WebKit/android/plugins/ANPOpenGL_npapi.h
@@ -52,6 +52,12 @@ struct ANPOpenGLInterfaceV0 : ANPInterface {
/**
*/
void (*releaseTexture)(NPP instance, const ANPTextureInfo*);
+
+ /**
+ * Invert the contents of the plugin on the y-axis.
+ * default is to not be inverted (i.e. use OpenGL coordinates)
+ */
+ void (*invertPluginContent)(NPP instance, bool isContentInverted);
};
#endif //ANPOpenGL_npapi_H