diff options
Diffstat (limited to 'indra/newview/llmediactrl.cpp')
-rw-r--r-- | indra/newview/llmediactrl.cpp | 61 |
1 files changed, 10 insertions, 51 deletions
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 1f1e49726d..74fa5d350a 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -57,7 +57,6 @@ #include "llcheckboxctrl.h" #include "llnotifications.h" #include "lllineeditor.h" -#include "llfloatermediabrowser.h" #include "llfloaterwebcontent.h" #include "llwindowshade.h" @@ -68,7 +67,6 @@ static LLDefaultChildRegistry::Register<LLMediaCtrl> r("web_browser"); LLMediaCtrl::Params::Params() : start_url("start_url"), border_visible("border_visible", true), - ignore_ui_scale("ignore_ui_scale", true), decouple_texture_size("decouple_texture_size", false), texture_width("texture_width", 1024), texture_height("texture_height", 1024), @@ -89,7 +87,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mFrequentUpdates( true ), mForceUpdate( false ), mHomePageUrl( "" ), - mIgnoreUIScale( true ), mAlwaysRefresh( false ), mMediaSource( 0 ), mTakeFocusOnClick( p.focus_on_click ), @@ -112,8 +109,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : setCaretColor( (unsigned int)color.mV[0], (unsigned int)color.mV[1], (unsigned int)color.mV[2] ); } - setIgnoreUIScale(p.ignore_ui_scale); - setHomePageUrl(p.start_url, p.initial_mime_type); setBorderVisible(p.border_visible); @@ -124,10 +119,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : if(!getDecoupleTextureSize()) { - S32 screen_width = mIgnoreUIScale ? - llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); - S32 screen_height = mIgnoreUIScale ? - llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight(); + S32 screen_width = llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]); + S32 screen_height = llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]); setTextureSize(screen_width, screen_height); } @@ -471,8 +464,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) { if(!getDecoupleTextureSize()) { - S32 screen_width = mIgnoreUIScale ? llround((F32)width * LLUI::sGLScaleFactor.mV[VX]) : width; - S32 screen_height = mIgnoreUIScale ? llround((F32)height * LLUI::sGLScaleFactor.mV[VY]) : height; + S32 screen_width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]); + S32 screen_height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]); // when floater is minimized, these sizes are negative if ( screen_height > 0 && screen_width > 0 ) @@ -689,6 +682,8 @@ bool LLMediaCtrl::ensureMediaSourceExists() mMediaSource->addObserver( this ); mMediaSource->setBackgroundColor( getBackgroundColor() ); mMediaSource->setTrustedBrowser(mTrusted); + mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); + if(mClearCache) { mMediaSource->clearCache(); @@ -770,15 +765,7 @@ void LLMediaCtrl::draw() { gGL.pushUIMatrix(); { - if (mIgnoreUIScale) - { - gGL.loadUIIdentity(); - // font system stores true screen origin, need to scale this by UI scale factor - // to get render origin for this view (with unit scale) - gGL.translateUI(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), - floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), - LLFontGL::sCurOrigin.mZ); - } + mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] ); // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); @@ -826,14 +813,6 @@ void LLMediaCtrl::draw() x_offset = (r.getWidth() - width) / 2; y_offset = (r.getHeight() - height) / 2; - if(mIgnoreUIScale) - { - x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]); - y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]); - width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]); - height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]); - } - // draw the browser gGL.begin( LLRender::QUADS ); if (! media_plugin->getTextureCoordsOpenGL()) @@ -900,14 +879,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); } - x = mIgnoreUIScale ? llround((F32)x * LLUI::sGLScaleFactor.mV[VX]) : x; + x = llround((F32)x * LLUI::sGLScaleFactor.mV[VX]); if ( ! coords_opengl ) { - y = mIgnoreUIScale ? llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]) : y; + y = llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]); } else { - y = mIgnoreUIScale ? llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]) : getRect().getHeight() - y; + y = llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]); }; } @@ -1102,26 +1081,6 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) { if (response["open"]) { - // name of default floater to open - std::string floater_name = "media_browser"; - - // look for parent floater name - if ( gFloaterView ) - { - if ( gFloaterView->getParentFloater(this) ) - { - floater_name = gFloaterView->getParentFloater(this)->getInstanceName(); - } - else - { - lldebugs << "No gFloaterView->getParentFloater(this) for onPopuup()" << llendl; - }; - } - else - { - lldebugs << "No gFloaterView for onPopuup()" << llendl; - }; - LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } else |