diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-03-04 14:30:57 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-03-04 14:30:57 +0000 |
commit | 496e6e1948423e336088018f2d4d4c6faf942171 (patch) | |
tree | f16eccb6bc2cea926a89254410a27c643b68fe94 /indra/media_plugins/webkit/media_plugin_webkit.cpp | |
parent | 6a66b820bde17729ce2dc819a0afc8c110323411 (diff) |
Add #if'd code that can deal with the newer QPixmap-based LLQtWebkits.
Disabled for now.
Diffstat (limited to 'indra/media_plugins/webkit/media_plugin_webkit.cpp')
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 24 |
1 files changed, 23 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..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<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 +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); |