summaryrefslogtreecommitdiff
path: root/indra/media_plugins/webkit/media_plugin_webkit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp')
-rw-r--r--indra/media_plugins/webkit/media_plugin_webkit.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index c7aba04492..e66ac3049f 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -43,6 +43,13 @@
#include "llpluginmessageclasses.h"
#include "media_plugin_base.h"
+// set to 1 if you're using the version of llqtwebkit that's QPixmap-ified
+#if LL_LINUX
+# define LL_QTWEBKIT_USES_PIXMAPS 1
+#else
+# define LL_QTWEBKIT_USES_PIXMAPS 0
+#endif // LL_LINUX
+
#if LL_LINUX
# include "linux_volume_catcher.h"
#endif // LL_LINUX
@@ -142,7 +149,11 @@ private:
{
const unsigned char* browser_pixels = LLQtWebKit::getInstance()->grabBrowserWindow( mBrowserWindowId );
- unsigned int buffer_size = LLQtWebKit::getInstance()->getBrowserRowSpan( mBrowserWindowId ) * LLQtWebKit::getInstance()->getBrowserHeight( mBrowserWindowId );
+ unsigned int rowspan = LLQtWebKit::getInstance()->getBrowserRowSpan( mBrowserWindowId );
+ unsigned int height = LLQtWebKit::getInstance()->getBrowserHeight( mBrowserWindowId );
+#if !LL_QTWEBKIT_USES_PIXMAPS
+ unsigned int buffer_size = rowspan * height;
+#endif // !LL_QTWEBKIT_USES_PIXMAPS
// std::cerr << "webkit plugin: updating" << std::endl;
@@ -150,7 +161,16 @@ private:
if ( mPixels && browser_pixels )
{
// std::cerr << " memcopy of " << buffer_size << " bytes" << std::endl;
+
+#if LL_QTWEBKIT_USES_PIXMAPS
+ // copy the pixel data upside-down because of the co-ord system
+ for (int y=0; y<height; ++y)
+ {
+ memcpy( &mPixels[(height-y-1)*rowspan], &browser_pixels[y*rowspan], rowspan );
+ }
+#else
memcpy( mPixels, browser_pixels, buffer_size );
+#endif // LL_QTWEBKIT_USES_PIXMAPS
}
if ( mWidth > 0 && mHeight > 0 )
@@ -258,8 +278,10 @@ private:
// append details to agent string
LLQtWebKit::getInstance()->setBrowserAgentId( "LLPluginMedia Web Browser" );
+#if !LL_QTWEBKIT_USES_PIXMAPS
// don't flip bitmap
LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true );
+#endif // !LL_QTWEBKIT_USES_PIXMAPS
// set background color
// convert background color channels from [0.0, 1.0] to [0, 255];
@@ -677,7 +699,11 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
message.setValueS32("default_height", 1024);
message.setValueS32("depth", mDepth);
message.setValueU32("internalformat", GL_RGBA);
+#if LL_QTWEBKIT_USES_PIXMAPS
+ message.setValueU32("format", GL_BGRA_EXT); // I hope this isn't system-dependant... is it? If so, we'll have to check the root window's pixel layout or something... yuck.
+#else
message.setValueU32("format", GL_RGBA);
+#endif // LL_QTWEBKIT_USES_PIXMAPS
message.setValueU32("type", GL_UNSIGNED_BYTE);
message.setValueBoolean("coords_opengl", true);
sendMessage(message);