Merge branch 'master' of git://github.com/Shyotl/SingularityViewer
Conflicts: indra/newview/llstartup.cpp indra/newview/llviewerregion.cpp
This commit is contained in:
@@ -39,6 +39,7 @@ set(llui_SOURCE_FILES
|
||||
lliconctrl.cpp
|
||||
llkeywords.cpp
|
||||
lllineeditor.cpp
|
||||
lllocalcliprect.cpp
|
||||
llmenugl.cpp
|
||||
llmodaldialog.cpp
|
||||
llmultifloater.cpp
|
||||
@@ -99,6 +100,7 @@ set(llui_HEADER_FILES
|
||||
lliconctrl.h
|
||||
llkeywords.h
|
||||
lllineeditor.h
|
||||
lllocalcliprect.h
|
||||
llmemberlistener.h
|
||||
llmenugl.h
|
||||
llmodaldialog.h
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "llcontrol.h"
|
||||
#include "lltabcontainer.h"
|
||||
#include "v2math.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
const S32 MINIMIZED_WIDTH = 160;
|
||||
const S32 CLOSE_BOX_FROM_TOP = 1;
|
||||
@@ -2548,6 +2549,7 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
|
||||
return floaterp;
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
|
||||
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */
|
||||
{
|
||||
std::string name(getName());
|
||||
@@ -2617,7 +2619,12 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
|
||||
LLFloater::setFloaterHost(last_host);
|
||||
}
|
||||
|
||||
BOOL result = postBuild();
|
||||
BOOL result;
|
||||
{
|
||||
LLFastTimer ft(POST_BUILD);
|
||||
|
||||
result = postBuild();
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
||||
110
indra/llui/lllocalcliprect.cpp
Normal file
110
indra/llui/lllocalcliprect.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* @file lllocalcliprect.cpp
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lllocalcliprect.h"
|
||||
|
||||
#include "llfontgl.h"
|
||||
#include "llui.h"
|
||||
|
||||
/*static*/ std::stack<LLRect> LLScreenClipRect::sClipRectStack;
|
||||
|
||||
|
||||
LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled)
|
||||
: mScissorState(GL_SCISSOR_TEST),
|
||||
mEnabled(enabled)
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
pushClipRect(rect);
|
||||
mScissorState.setEnabled(!sClipRectStack.empty());
|
||||
updateScissorRegion();
|
||||
}
|
||||
}
|
||||
|
||||
LLScreenClipRect::~LLScreenClipRect()
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
popClipRect();
|
||||
updateScissorRegion();
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLScreenClipRect::pushClipRect(const LLRect& rect)
|
||||
{
|
||||
LLRect combined_clip_rect = rect;
|
||||
if (!sClipRectStack.empty())
|
||||
{
|
||||
LLRect top = sClipRectStack.top();
|
||||
combined_clip_rect.intersectWith(top);
|
||||
|
||||
if(combined_clip_rect.isEmpty())
|
||||
{
|
||||
// avoid artifacts where zero area rects show up as lines
|
||||
combined_clip_rect = LLRect::null;
|
||||
}
|
||||
}
|
||||
sClipRectStack.push(combined_clip_rect);
|
||||
}
|
||||
|
||||
//static
|
||||
void LLScreenClipRect::popClipRect()
|
||||
{
|
||||
sClipRectStack.pop();
|
||||
}
|
||||
|
||||
//static
|
||||
void LLScreenClipRect::updateScissorRegion()
|
||||
{
|
||||
if (sClipRectStack.empty()) return;
|
||||
|
||||
// finish any deferred calls in the old clipping region
|
||||
gGL.flush();
|
||||
|
||||
LLRect rect = sClipRectStack.top();
|
||||
stop_glerror();
|
||||
S32 x,y,w,h;
|
||||
x = llfloor(rect.mLeft * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y = llfloor(rect.mBottom * LLUI::sGLScaleFactor.mV[VY]);
|
||||
w = llmax(0, llceil(rect.getWidth() * LLUI::sGLScaleFactor.mV[VX])) + 1;
|
||||
h = llmax(0, llceil(rect.getHeight() * LLUI::sGLScaleFactor.mV[VY])) + 1;
|
||||
glScissor( x,y,w,h );
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// LLLocalClipRect
|
||||
//---------------------------------------------------------------------------
|
||||
LLLocalClipRect::LLLocalClipRect(const LLRect& rect, BOOL enabled /* = TRUE */)
|
||||
: LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX,
|
||||
rect.mTop + LLFontGL::sCurOrigin.mY,
|
||||
rect.mRight + LLFontGL::sCurOrigin.mX,
|
||||
rect.mBottom + LLFontGL::sCurOrigin.mY), enabled)
|
||||
{}
|
||||
|
||||
LLLocalClipRect::~LLLocalClipRect()
|
||||
{}
|
||||
64
indra/llui/lllocalcliprect.h
Normal file
64
indra/llui/lllocalcliprect.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @file lllocalcliprect.h
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LLLOCALCLIPRECT_H
|
||||
#define LLLOCALCLIPRECT_H
|
||||
|
||||
#include "llgl.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llrect.h" // can't forward declare, it's templated
|
||||
#include <stack>
|
||||
|
||||
// Clip rendering to a specific rectangle using GL scissor
|
||||
// Just create one of these on the stack:
|
||||
// {
|
||||
// LLLocalClipRect(rect);
|
||||
// draw();
|
||||
// }
|
||||
class LLScreenClipRect
|
||||
{
|
||||
public:
|
||||
LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE);
|
||||
virtual ~LLScreenClipRect();
|
||||
|
||||
private:
|
||||
static void pushClipRect(const LLRect& rect);
|
||||
static void popClipRect();
|
||||
static void updateScissorRegion();
|
||||
|
||||
private:
|
||||
LLGLState mScissorState;
|
||||
BOOL mEnabled;
|
||||
|
||||
static std::stack<LLRect> sClipRectStack;
|
||||
};
|
||||
|
||||
class LLLocalClipRect : public LLScreenClipRect
|
||||
{
|
||||
public:
|
||||
LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
|
||||
~LLLocalClipRect();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "llalertdialog.h"
|
||||
#include "llfocusmgr.h"
|
||||
#include "llfontgl.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llrect.h"
|
||||
#include "llerror.h"
|
||||
#include "lltimer.h"
|
||||
@@ -56,6 +57,7 @@
|
||||
#include "llviewborder.h"
|
||||
#include "llbutton.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
// LLLayoutStack
|
||||
#include "llresizebar.h"
|
||||
@@ -415,13 +417,13 @@ void LLPanel::setBorderVisible(BOOL b)
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_PANEL_CONSTRUCTION("Panel Construction");
|
||||
// virtual
|
||||
LLXMLNodePtr LLPanel::getXML(bool save_children) const
|
||||
{
|
||||
LLXMLNodePtr node = LLUICtrl::getXML();
|
||||
|
||||
node->setName(LL_PANEL_TAG);
|
||||
|
||||
if (mBorder && mBorder->getVisible())
|
||||
{
|
||||
node->createChild("border", TRUE)->setBoolValue(TRUE);
|
||||
@@ -471,6 +473,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *fac
|
||||
node->getAttributeString("name", name);
|
||||
|
||||
LLPanel* panelp = factory->createFactoryPanel(name);
|
||||
LLFastTimer _(FTM_PANEL_CONSTRUCTION);
|
||||
// Fall back on a default panel, if there was no special factory.
|
||||
if (!panelp)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "llrender.h"
|
||||
#include "llscrollcontainer.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llscrollbar.h"
|
||||
#include "llui.h"
|
||||
#include "llkeyboard.h"
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "llclipboard.h"
|
||||
#include "llfocusmgr.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llrender.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llscrollbar.h"
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "lltabcontainer.h"
|
||||
#include "llfocusmgr.h"
|
||||
#include "llbutton.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llrect.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llresizehandle.h"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "lltexteditor.h"
|
||||
|
||||
#include "llfontgl.h"
|
||||
#include "lllocalcliprect.h"
|
||||
#include "llrender.h"
|
||||
#include "llui.h"
|
||||
#include "lluictrlfactory.h"
|
||||
@@ -54,6 +55,7 @@
|
||||
#include "llkeywords.h"
|
||||
#include "llundo.h"
|
||||
#include "llviewborder.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
#include "llcontrol.h"
|
||||
#include "llimagegl.h"
|
||||
@@ -4352,18 +4354,25 @@ void LLTextEditor::loadKeywords(const std::string& filename,
|
||||
}
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_TEXT_SEGMENTS("Update Text Segments");
|
||||
|
||||
void LLTextEditor::updateSegments()
|
||||
{
|
||||
if (mKeywords.isLoaded())
|
||||
{
|
||||
// HACK: No non-ascii keywords for now
|
||||
mKeywords.findSegments(&mSegments, mWText, mDefaultColor);
|
||||
}
|
||||
else if (mAllowEmbeddedItems)
|
||||
{
|
||||
findEmbeddedItemSegments();
|
||||
LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
|
||||
if (mKeywords.isLoaded())
|
||||
{
|
||||
// HACK: No non-ascii keywords for now
|
||||
mKeywords.findSegments(&mSegments, mWText, mDefaultColor);
|
||||
}
|
||||
else if (mAllowEmbeddedItems)
|
||||
{
|
||||
findEmbeddedItemSegments();
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer ft(FTM_UPDATE_TEXT_SEGMENTS);
|
||||
// Make sure we have at least one segment
|
||||
if (mSegments.size() == 1 && mSegments[0]->getIsDefault())
|
||||
{
|
||||
|
||||
@@ -73,7 +73,6 @@ LLVector2 LLUI::sGLScaleFactor(1.f, 1.f);
|
||||
LLWindow* LLUI::sWindow = NULL;
|
||||
LLHtmlHelp* LLUI::sHtmlHelp = NULL;
|
||||
BOOL LLUI::sShowXUINames = FALSE;
|
||||
std::stack<LLRect> LLScreenClipRect::sClipRectStack;
|
||||
BOOL LLUI::sQAMode = FALSE;
|
||||
|
||||
//
|
||||
@@ -1856,66 +1855,3 @@ void LLUI::setQAMode(BOOL b)
|
||||
LLUI::sQAMode = b;
|
||||
}
|
||||
|
||||
LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled) : mScissorState(GL_SCISSOR_TEST), mEnabled(enabled)
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
pushClipRect(rect);
|
||||
}
|
||||
mScissorState.setEnabled(!sClipRectStack.empty());
|
||||
updateScissorRegion();
|
||||
}
|
||||
|
||||
LLScreenClipRect::~LLScreenClipRect()
|
||||
{
|
||||
if (mEnabled)
|
||||
{
|
||||
popClipRect();
|
||||
}
|
||||
updateScissorRegion();
|
||||
}
|
||||
|
||||
//static
|
||||
void LLScreenClipRect::pushClipRect(const LLRect& rect)
|
||||
{
|
||||
LLRect combined_clip_rect = rect;
|
||||
if (!sClipRectStack.empty())
|
||||
{
|
||||
LLRect top = sClipRectStack.top();
|
||||
combined_clip_rect.intersectWith(top);
|
||||
}
|
||||
sClipRectStack.push(combined_clip_rect);
|
||||
}
|
||||
|
||||
//static
|
||||
void LLScreenClipRect::popClipRect()
|
||||
{
|
||||
sClipRectStack.pop();
|
||||
}
|
||||
|
||||
//static
|
||||
void LLScreenClipRect::updateScissorRegion()
|
||||
{
|
||||
if (sClipRectStack.empty()) return;
|
||||
|
||||
LLRect rect = sClipRectStack.top();
|
||||
stop_glerror();
|
||||
S32 x,y,w,h;
|
||||
x = llfloor(rect.mLeft * LLUI::sGLScaleFactor.mV[VX]);
|
||||
y = llfloor(rect.mBottom * LLUI::sGLScaleFactor.mV[VY]);
|
||||
w = llmax(0, llceil(rect.getWidth() * LLUI::sGLScaleFactor.mV[VX])) + 1;
|
||||
h = llmax(0, llceil(rect.getHeight() * LLUI::sGLScaleFactor.mV[VY])) + 1;
|
||||
glScissor( x,y,w,h );
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
|
||||
LLLocalClipRect::LLLocalClipRect(const LLRect &rect, BOOL enabled)
|
||||
: LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX,
|
||||
rect.mTop + LLFontGL::sCurOrigin.mY,
|
||||
rect.mRight + LLFontGL::sCurOrigin.mX,
|
||||
rect.mBottom + LLFontGL::sCurOrigin.mY),
|
||||
enabled)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -388,30 +388,6 @@ private:
|
||||
|
||||
template <class T, class U> T* LLUISingleton<T,U>::sInstance = NULL;
|
||||
|
||||
class LLScreenClipRect
|
||||
{
|
||||
public:
|
||||
LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE);
|
||||
virtual ~LLScreenClipRect();
|
||||
|
||||
private:
|
||||
static void pushClipRect(const LLRect& rect);
|
||||
static void popClipRect();
|
||||
static void updateScissorRegion();
|
||||
|
||||
private:
|
||||
LLGLState mScissorState;
|
||||
BOOL mEnabled;
|
||||
|
||||
static std::stack<LLRect> sClipRectStack;
|
||||
};
|
||||
|
||||
class LLLocalClipRect : public LLScreenClipRect
|
||||
{
|
||||
public:
|
||||
LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE);
|
||||
};
|
||||
|
||||
|
||||
//RN: maybe this needs to moved elsewhere?
|
||||
class LLImageProviderInterface
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "lllineeditor.h"
|
||||
#include "lltexteditor.h"
|
||||
#include "lltextbox.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
// <edit>
|
||||
#include "lldelayeduidelete.h"
|
||||
@@ -1664,8 +1665,11 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// getChildView()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Views");
|
||||
|
||||
LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const
|
||||
{
|
||||
LLFastTimer ft(FTM_FIND_VIEWS);
|
||||
//richard: should we allow empty names?
|
||||
//if(name.empty())
|
||||
// return NULL;
|
||||
|
||||
Reference in New Issue
Block a user