summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-10-12 13:27:59 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-10-12 13:27:59 -0700
commit25b6485c2f117e2ed3dc3abfe2467f699dfe1942 (patch)
treeb873ee6138a14b78b7a7c81bb01ba44c19a76160
parent8c475c81ff9177af4476ff43acd35a3a2ba6781b (diff)
parent5ed31e7bc52e99103e4da5755d944f9ca98305b3 (diff)
downloadexternal_webkit-25b6485c2f117e2ed3dc3abfe2467f699dfe1942.zip
external_webkit-25b6485c2f117e2ed3dc3abfe2467f699dfe1942.tar.gz
external_webkit-25b6485c2f117e2ed3dc3abfe2467f699dfe1942.tar.bz2
am 5ed31e7b: Merge "Ensure the frame inversion flag is immediately effective." into ics-mr0
* commit '5ed31e7bc52e99103e4da5755d944f9ca98305b3': Ensure the frame inversion flag is immediately effective.
-rw-r--r--Source/WebCore/platform/graphics/android/MediaLayer.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/MediaLayer.h3
-rw-r--r--Source/WebCore/platform/graphics/android/MediaTexture.cpp12
-rw-r--r--Source/WebCore/platform/graphics/android/MediaTexture.h6
-rw-r--r--Source/WebKit/android/plugins/ANPNativeWindowInterface.cpp14
5 files changed, 23 insertions, 16 deletions
diff --git a/Source/WebCore/platform/graphics/android/MediaLayer.cpp b/Source/WebCore/platform/graphics/android/MediaLayer.cpp
index 500fbfc..7fa5ac2 100644
--- a/Source/WebCore/platform/graphics/android/MediaLayer.cpp
+++ b/Source/WebCore/platform/graphics/android/MediaLayer.cpp
@@ -46,7 +46,6 @@ MediaLayer::MediaLayer(jobject webViewRef) : LayerAndroid((RenderLayer*) NULL)
m_mediaTexture->incStrong(this);
m_isCopy = false;
- m_isContentInverted = false;
m_outlineSize = 0;
XLOG("Creating Media Layer %p", this);
}
@@ -57,7 +56,6 @@ MediaLayer::MediaLayer(const MediaLayer& layer) : LayerAndroid(layer)
m_mediaTexture->incStrong(this);
m_isCopy = true;
- m_isContentInverted = layer.m_isContentInverted;
m_outlineSize = layer.m_outlineSize;
XLOG("Creating Media Layer Copy %p -> %p", &layer, this);
}
@@ -86,7 +84,7 @@ bool MediaLayer::drawGL(GLWebViewState* glWebViewState, SkMatrix& matrix)
// the layer's shader draws the content inverted so we must undo
// that change in the transformation matrix
TransformationMatrix m = m_drawTransform;
- if (!m_isContentInverted) {
+ if (!m_mediaTexture->isContentInverted()) {
m.flipY();
m.translate(0, -getSize().height());
}
diff --git a/Source/WebCore/platform/graphics/android/MediaLayer.h b/Source/WebCore/platform/graphics/android/MediaLayer.h
index 30a293d..ef84abf 100644
--- a/Source/WebCore/platform/graphics/android/MediaLayer.h
+++ b/Source/WebCore/platform/graphics/android/MediaLayer.h
@@ -43,7 +43,7 @@ public:
virtual bool isMedia() const { return true; }
virtual LayerAndroid* copy() const { return new MediaLayer(*this); }
- void invertContents(bool invertContent) { m_isContentInverted = invertContent; }
+ void invertContents(bool invert) { m_mediaTexture->invertContents(invert); }
void setOutlineSize(int size) { m_outlineSize = size; }
// function to setup the primary SurfaceTexture in the renderer's context
@@ -57,7 +57,6 @@ public:
private:
bool m_isCopy;
- bool m_isContentInverted;
int m_outlineSize;
// SurfaceTexture member variables
diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.cpp b/Source/WebCore/platform/graphics/android/MediaTexture.cpp
index e12518e..98dca22 100644
--- a/Source/WebCore/platform/graphics/android/MediaTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/MediaTexture.cpp
@@ -64,6 +64,7 @@ MediaTexture::MediaTexture(jobject webViewRef) : android::LightRefBase<MediaText
}
m_contentTexture = 0;
+ m_isContentInverted = false;
m_newWindowRequest = false;
}
@@ -80,6 +81,17 @@ MediaTexture::~MediaTexture()
}
}
+bool MediaTexture::isContentInverted()
+{
+ android::Mutex::Autolock lock(m_mediaLock);
+ return m_isContentInverted;
+}
+void MediaTexture::invertContents(bool invertContent)
+{
+ android::Mutex::Autolock lock(m_mediaLock);
+ m_isContentInverted = invertContent;
+}
+
void MediaTexture::initNativeWindowIfNeeded()
{
{
diff --git a/Source/WebCore/platform/graphics/android/MediaTexture.h b/Source/WebCore/platform/graphics/android/MediaTexture.h
index 964b87b..97bb530 100644
--- a/Source/WebCore/platform/graphics/android/MediaTexture.h
+++ b/Source/WebCore/platform/graphics/android/MediaTexture.h
@@ -43,6 +43,9 @@ public:
MediaTexture(jobject webViewRef);
~MediaTexture();
+ bool isContentInverted();
+ void invertContents(bool invertContent);
+
void initNativeWindowIfNeeded();
void draw(const TransformationMatrix& contentMatrix,
const TransformationMatrix& videoMatrix,
@@ -72,6 +75,9 @@ private:
Vector<TextureWrapper*> m_videoTextures;
Vector<GLuint> m_unusedTextures;
+ // used to track if the content is to be drawn inverted
+ bool m_isContentInverted;
+
// used to generate new video textures
bool m_newWindowRequest;
sp<ANativeWindow> m_newWindow;
diff --git a/Source/WebKit/android/plugins/ANPNativeWindowInterface.cpp b/Source/WebKit/android/plugins/ANPNativeWindowInterface.cpp
index a61e122..48b5fe7 100644
--- a/Source/WebKit/android/plugins/ANPNativeWindowInterface.cpp
+++ b/Source/WebKit/android/plugins/ANPNativeWindowInterface.cpp
@@ -62,17 +62,9 @@ static ANativeWindow* anp_acquireNativeWindow(NPP instance) {
}
static void anp_invertPluginContent(NPP instance, bool isContentInverted) {
- PluginView* pluginView = pluginViewForInstance(instance);
- PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
- WebCore::MediaLayer* mediaLayer = pluginWidget->getLayer();
-
- // update the layer
- mediaLayer->invertContents(isContentInverted);
-
- //force the layer to sync to the UI thread
- WebViewCore* wvc = pluginWidget->webViewCore();
- if (wvc)
- wvc->mainFrame()->page()->chrome()->client()->scheduleCompositingLayerSync();
+ WebCore::MediaLayer* mediaLayer = mediaLayerForInstance(instance);
+ if (mediaLayer)
+ mediaLayer->invertContents(isContentInverted);
}