summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-10-12 15:22:02 -0400
committerDerek Sollenberger <djsollen@google.com>2011-10-12 15:39:28 -0400
commit196a1c3a9cbc24ea20708ec0a6ad8810e2036109 (patch)
treede3486c8a003bf53cfc5a63f4139d0398dd5f3e8 /Source/WebCore
parent47f387fdb2c9e81ee710f41b1e79f1419817801a (diff)
downloadexternal_webkit-196a1c3a9cbc24ea20708ec0a6ad8810e2036109.zip
external_webkit-196a1c3a9cbc24ea20708ec0a6ad8810e2036109.tar.gz
external_webkit-196a1c3a9cbc24ea20708ec0a6ad8810e2036109.tar.bz2
Ensure the frame inversion flag is immediately effective.
Previously the frame inversion state was passed to the UI thread when the layer tree was synced. This CL removes that restriction and updates it immediately by storing the state in a cross thread refcounted object. bug: 5283034 Change-Id: I58a7ea0f2ed261008b945241bc783cfee4f33466
Diffstat (limited to 'Source/WebCore')
-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
4 files changed, 20 insertions, 5 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;