From 496e6e1948423e336088018f2d4d4c6faf942171 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 4 Mar 2010 14:30:57 +0000 Subject: Add #if'd code that can deal with the newer QPixmap-based LLQtWebkits. Disabled for now. --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index c7aba04492..072b58720f 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -43,6 +43,9 @@ #include "llpluginmessageclasses.h" #include "media_plugin_base.h" +// set to 1 if you're using the version of llqtwebkit that's QPixmap-ified +#define LL_QTWEBKIT_USES_PIXMAPS 0 + #if LL_LINUX # include "linux_volume_catcher.h" #endif // LL_LINUX @@ -142,7 +145,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 +157,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 0 && mHeight > 0 ) @@ -258,8 +274,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 +695,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); -- cgit v1.2.3