diff options
author | callum_linden <none@none> | 2015-11-18 18:17:50 -0800 |
---|---|---|
committer | callum_linden <none@none> | 2015-11-18 18:17:50 -0800 |
commit | 32691c441664821fcb29824461ed85277ae418c8 (patch) | |
tree | 6bba3ce01bff7d253198751d4fa754bb002580a0 /indra/media_plugins/cef/media_plugin_cef.cpp | |
parent | 311b376ab50bacf2bf113616af2a5bbedfcd5ee5 (diff) |
initial support for dropdown menus/select widgits
Diffstat (limited to 'indra/media_plugins/cef/media_plugin_cef.cpp')
-rw-r--r-- | indra/media_plugins/cef/media_plugin_cef.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index a53b453b3e..ec3518100b 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -56,7 +56,7 @@ public: private: bool init(); - void onPageChangedCallback(unsigned char* pixels, int width, int height); + void onPageChangedCallback(unsigned char* pixels, int x, int y, int width, int height, bool is_popup); void onCustomSchemeURLCallback(std::string url); void onConsoleMessageCallback(std::string message, std::string source, int line); void onStatusMessageCallback(std::string value); @@ -149,13 +149,31 @@ void MediaPluginCEF::postDebugMessage(const std::string& msg) //////////////////////////////////////////////////////////////////////////////// // -void MediaPluginCEF::onPageChangedCallback(unsigned char* pixels, int width, int height) +void MediaPluginCEF::onPageChangedCallback(unsigned char* pixels, int x, int y, int width, int height, bool is_popup) { if (mPixels && pixels) { - if (mWidth == width && mHeight == height) + if (is_popup) { - memcpy(mPixels, pixels, mWidth * mHeight * mDepth); + for (int line = 0; line < height; ++line) + { + int inverted_y = mHeight - y - height; + int src = line * width * mDepth; + int dst = (inverted_y + line) * mWidth * mDepth + x * mDepth; + + if (dst + width * mDepth < mWidth * mHeight * mDepth) + { + memcpy(mPixels + dst, pixels + src, width * mDepth); + } + } + } + else + { + if (mWidth == width && mHeight == height) + { + memcpy(mPixels, pixels, mWidth * mHeight * mDepth); + } + } setDirty(0, 0, mWidth, mHeight); } @@ -399,7 +417,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) if (message_name == "init") { // event callbacks from LLCefLib - mLLCEFLib->setOnPageChangedCallback(boost::bind(&MediaPluginCEF::onPageChangedCallback, this, _1, _2, _3)); + mLLCEFLib->setOnPageChangedCallback(boost::bind(&MediaPluginCEF::onPageChangedCallback, this, _1, _2, _3, _4, _5, _6)); mLLCEFLib->setOnCustomSchemeURLCallback(boost::bind(&MediaPluginCEF::onCustomSchemeURLCallback, this, _1)); mLLCEFLib->setOnConsoleMessageCallback(boost::bind(&MediaPluginCEF::onConsoleMessageCallback, this, _1, _2, _3)); mLLCEFLib->setOnStatusMessageCallback(boost::bind(&MediaPluginCEF::onStatusMessageCallback, this, _1)); |