SH-3944 WIP CHUI merge fixing

re-introduced don's refactor of low-level openGL calls pulling out of llui
and putting them into llrender. Took the new code from their updated versions
from the CHUI merge, but put them in a place accessible to appearance utility.
master
Nyx Linden 2013-03-12 22:34:15 +00:00
parent 45838b8b07
commit 1586107e87
19 changed files with 1846 additions and 1714 deletions

View File

@ -43,11 +43,13 @@ set(llrender_SOURCE_FILES
llimagegl.cpp
llpostprocess.cpp
llrender.cpp
llrender2dutils.cpp
llrendernavprim.cpp
llrendersphere.cpp
llrendertarget.cpp
llshadermgr.cpp
lltexture.cpp
lluiimage.cpp
llvertexbuffer.cpp
)
@ -69,10 +71,12 @@ set(llrender_HEADER_FILES
llimagegl.h
llpostprocess.h
llrender.h
llrender2dutils.h
llrendernavprim.h
llrendersphere.h
llshadermgr.h
lltexture.h
lluiimage.h
llvertexbuffer.h
)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
/**
* @file llrender2dutils.h
* @brief GL function declarations for immediate-mode gl drawing.
*
* $LicenseInfo:firstyear=2012&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$
*/
// All immediate-mode gl drawing should happen here.
#ifndef LL_RENDER2DUTILS_H
#define LL_RENDER2DUTILS_H
#include "llpointer.h" // LLPointer<>
#include "llrect.h"
#include "llglslshader.h"
class LLColor4;
class LLVector3;
class LLVector2;
class LLUIImage;
class LLUUID;
extern const LLColor4 UI_VERTEX_COLOR;
BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom);
void gl_state_for_2d(S32 width, S32 height);
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2);
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color );
void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled);
void gl_rect_2d_simple( S32 width, S32 height );
void gl_draw_x(const LLRect& rect, const LLColor4& color);
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE );
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE );
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE );
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f);
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled);
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle);
void gl_deep_circle( F32 radius, F32 depth );
void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center );
void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac);
void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
void gl_rect_2d_simple_tex( S32 width, S32 height );
// segmented rectangles
/*
TL |______TOP_________| TR
/| |\
_/_|__________________|_\_
L| | MIDDLE | |R
_|_|__________________|_|_
\ | BOTTOM | /
BL\|__________________|/ BR
| |
*/
typedef enum e_rounded_edge
{
ROUNDED_RECT_LEFT = 0x1,
ROUNDED_RECT_TOP = 0x2,
ROUNDED_RECT_RIGHT = 0x4,
ROUNDED_RECT_BOTTOM = 0x8,
ROUNDED_RECT_ALL = 0xf
}ERoundedEdge;
void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL);
void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec);
inline void gl_rect_2d( const LLRect& rect, BOOL filled )
{
gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled );
}
inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled)
{
gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled );
}
class LLImageProviderInterface;
class LLRender2D
{
LOG_CLASS(LLRender2D);
public:
static void initClass(LLImageProviderInterface* image_provider,
const LLVector2* scale_factor);
static void cleanupClass();
static void pushMatrix();
static void popMatrix();
static void loadIdentity();
static void translate(F32 x, F32 y, F32 z = 0.0f);
static void setLineWidth(F32 width);
static void setScaleFactor(const LLVector2& scale_factor);
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
static LLVector2 sGLScaleFactor;
private:
static LLImageProviderInterface* sImageProvider;
};
class LLImageProviderInterface
{
protected:
LLImageProviderInterface() {};
virtual ~LLImageProviderInterface() {};
public:
virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0;
virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0;
virtual void cleanUp() = 0;
};
extern LLGLSLShader gSolidColorProgram;
extern LLGLSLShader gUIProgram;
#endif // LL_RENDER2DUTILS_H

View File

@ -31,7 +31,7 @@
// Project includes
#include "lluiimage.h"
#include "llui.h"
#include "llrender2dutils.h"
LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image)
: mName(name),
@ -130,10 +130,10 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
}
}
LLUI::pushMatrix();
LLRender2D::pushMatrix();
{
LLVector3 rect_origin = origin_agent + (rect.mLeft * x_axis) + (rect.mBottom * y_axis);
LLUI::translate(rect_origin.mV[VX],
LLRender2D::translate(rect_origin.mV[VX],
rect_origin.mV[VY],
rect_origin.mV[VZ]);
gGL.getTexUnit(0)->bind(getImage());
@ -152,7 +152,7 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
rect.getWidth() * x_axis,
rect.getHeight() * y_axis);
} LLUI::popMatrix();
} LLRender2D::popMatrix();
}
@ -209,7 +209,7 @@ namespace LLInitParam
return;
}
LLUIImage* imagep = LLUI::getUIImage(name());
LLUIImage* imagep = LLRender2D::getUIImage(name());
if (imagep)
{
updateValue(imagep);

View File

@ -117,7 +117,6 @@ set(llui_SOURCE_FILES
lluicolortable.cpp
lluictrl.cpp
lluictrlfactory.cpp
lluiimage.cpp
lluistring.cpp
llundo.cpp
llurlaction.cpp
@ -231,7 +230,6 @@ set(llui_HEADER_FILES
lluifwd.h
llui.h
lluicolor.h
lluiimage.h
lluistring.h
llundo.h
llurlaction.h

View File

@ -551,7 +551,7 @@ void LLComboBox::showList()
LLCoordWindow window_size;
getWindow()->getSize(&window_size);
//HACK: shouldn't have to know about scale here
mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::sGLScaleFactor.mV[VY]) - 50 );
mList->fitContents( 192, llfloor((F32)window_size.mY / LLUI::getScaleFactor().mV[VY]) - 50 );
// Make sure that we can see the whole list
LLRect root_view_local;

View File

@ -2015,8 +2015,8 @@ void LLLineEditor::draw()
LLRect screen_pos = calcScreenRect();
LLCoordGL ime_pos( screen_pos.mLeft + pixels_after_scroll, screen_pos.mTop - lineeditor_v_pad );
ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]);
ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]);
ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]);
getWindow()->setLanguageTextInput( ime_pos );
}
}
@ -2563,7 +2563,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length)
S32 LLLineEditor::getPreeditFontSize() const
{
return llround(mGLFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
return llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace)

View File

@ -88,10 +88,10 @@ void LLScreenClipRect::updateScissorRegion()
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;
x = llfloor(rect.mLeft * LLUI::getScaleFactor().mV[VX]);
y = llfloor(rect.mBottom * LLUI::getScaleFactor().mV[VY]);
w = llmax(0, llceil(rect.getWidth() * LLUI::getScaleFactor().mV[VX])) + 1;
h = llmax(0, llceil(rect.getHeight() * LLUI::getScaleFactor().mV[VY])) + 1;
glScissor( x,y,w,h );
stop_glerror();
}

View File

@ -521,8 +521,8 @@ void LLTextBase::drawCursor()
LLRect screen_pos = calcScreenRect();
LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_rect.mLeft), screen_pos.mBottom + llfloor(cursor_rect.mTop) );
ime_pos.mX = (S32) (ime_pos.mX * LLUI::sGLScaleFactor.mV[VX]);
ime_pos.mY = (S32) (ime_pos.mY * LLUI::sGLScaleFactor.mV[VY]);
ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]);
ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]);
getWindow()->setLanguageTextInput( ime_pos );
}
}

View File

@ -2911,7 +2911,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
S32 LLTextEditor::getPreeditFontSize() const
{
return llround((F32)mFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
return llround((F32)mFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]);
}
BOOL LLTextEditor::isDirty() const

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/**
* @file llui.h
* @brief GL function declarations and other general static UI services.
* @brief General static UI services.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
@ -24,122 +24,38 @@
* $/LicenseInfo$
*/
// All immediate-mode gl drawing should happen here.
#ifndef LL_LLUI_H
#define LL_LLUI_H
#include "llpointer.h" // LLPointer<>
#include "llrect.h"
#include "llcontrol.h"
#include "llcoord.h"
#include "llglslshader.h"
#include "v2math.h"
#include "llinitparam.h"
#include "llregistry.h"
#include "llrender2dutils.h"
#include "llpointer.h"
#include "lluicolor.h"
#include "lluicolortable.h"
#include "lluiimage.h"
#include <boost/signals2.hpp>
#include "lllazyvalue.h"
#include "llframetimer.h"
#include <limits>
// LLUIFactory
#include "llsd.h"
// for initparam specialization
#include "llfontgl.h"
class LLColor4;
class LLVector3;
class LLVector2;
class LLUIImage;
class LLUUID;
class LLWindow;
class LLView;
class LLHelp;
// UI colors
extern const LLColor4 UI_VERTEX_COLOR;
void make_ui_sound(const char* name);
void make_ui_sound_deferred(const char * name);
BOOL ui_point_in_rect(S32 x, S32 y, S32 left, S32 top, S32 right, S32 bottom);
void gl_state_for_2d(S32 width, S32 height);
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2);
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color );
void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled);
void gl_rect_2d_simple( S32 width, S32 height );
void gl_draw_x(const LLRect& rect, const LLColor4& color);
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled = TRUE );
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled = TRUE );
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset = 0, BOOL filled = TRUE );
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f);
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);
void gl_circle_2d(F32 x, F32 y, F32 radius, S32 steps, BOOL filled);
void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F32 start_angle, F32 end_angle);
void gl_deep_circle( F32 radius, F32 depth );
void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center );
void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac);
void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f );
void gl_rect_2d_simple_tex( S32 width, S32 height );
// segmented rectangles
/*
TL |______TOP_________| TR
/| |\
_/_|__________________|_\_
L| | MIDDLE | |R
_|_|__________________|_|_
\ | BOTTOM | /
BL\|__________________|/ BR
| |
*/
typedef enum e_rounded_edge
{
ROUNDED_RECT_LEFT = 0x1,
ROUNDED_RECT_TOP = 0x2,
ROUNDED_RECT_RIGHT = 0x4,
ROUNDED_RECT_BOTTOM = 0x8,
ROUNDED_RECT_ALL = 0xf
}ERoundedEdge;
void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL);
void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec);
inline void gl_rect_2d( const LLRect& rect, BOOL filled )
{
gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled );
}
inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL filled)
{
gl_rect_2d_offset_local( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, pixel_offset, filled );
}
class LLImageProviderInterface;
typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
@ -281,10 +197,10 @@ public:
static void cleanupClass();
static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& );
static void pushMatrix();
static void popMatrix();
static void loadIdentity();
static void translate(F32 x, F32 y, F32 z = 0.0f);
static void pushMatrix() { LLRender2D::pushMatrix(); }
static void popMatrix() { LLRender2D::popMatrix(); }
static void loadIdentity() { LLRender2D::loadIdentity(); }
static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); }
static LLRect sDirtyRect;
static BOOL sDirty;
@ -329,10 +245,13 @@ public:
static void getMousePositionScreen(S32 *x, S32 *y);
static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y);
static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y);
static void setScaleFactor(const LLVector2& scale_factor);
static void setLineWidth(F32 width);
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; }
static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); }
static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); }
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0)
{ return LLRender2D::getUIImageByID(image_id, priority); }
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0)
{ return LLRender2D::getUIImage(name, priority); }
static LLVector2 getWindowSize();
static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y);
static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y);
@ -362,12 +281,10 @@ public:
static settings_map_t sSettingGroups;
static LLUIAudioCallback sAudioCallback;
static LLUIAudioCallback sDeferredAudioCallback;
static LLVector2 sGLScaleFactor;
static LLWindow* sWindow;
static LLView* sRootView;
static LLHelp* sHelpImpl;
private:
static LLImageProviderInterface* sImageProvider;
static std::vector<std::string> sXUIPaths;
static LLFrameTimer sMouseIdleTimer;
static add_popup_t sAddPopupFunc;
@ -378,18 +295,6 @@ private:
// Moved LLLocalClipRect to lllocalcliprect.h
//RN: maybe this needs to moved elsewhere?
class LLImageProviderInterface
{
protected:
LLImageProviderInterface() {};
virtual ~LLImageProviderInterface() {};
public:
virtual LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority) = 0;
virtual LLPointer<LLUIImage> getUIImageByID(const LLUUID& id, S32 priority) = 0;
virtual void cleanUp() = 0;
};
class LLCallbackRegistry
{
public:
@ -600,7 +505,4 @@ namespace LLInitParam
};
}
extern LLGLSLShader gSolidColorProgram;
extern LLGLSLShader gUIProgram;
#endif

View File

@ -803,7 +803,7 @@ bool LLAppViewer::init()
LLUIImageList::getInstance(),
ui_audio_callback,
deferred_ui_audio_callback,
&LLUI::sGLScaleFactor);
&LLUI::getScaleFactor());
LL_INFOS("InitInfo") << "UI initialized." << LL_ENDL ;
// NOW LLUI::getLanguage() should work. gDirUtilp must know the language

View File

@ -79,10 +79,10 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
S32 top = llmax(y, mDragStartY);
S32 bottom =llmin(y, mDragStartY);
left = llround((F32) left * LLUI::sGLScaleFactor.mV[VX]);
right = llround((F32) right * LLUI::sGLScaleFactor.mV[VX]);
top = llround((F32) top * LLUI::sGLScaleFactor.mV[VY]);
bottom = llround((F32) bottom * LLUI::sGLScaleFactor.mV[VY]);
left = llround((F32) left * LLUI::getScaleFactor().mV[VX]);
right = llround((F32) right * LLUI::getScaleFactor().mV[VX]);
top = llround((F32) top * LLUI::getScaleFactor().mV[VY]);
bottom = llround((F32) bottom * LLUI::getScaleFactor().mV[VY]);
F32 old_far_plane = LLViewerCamera::getInstance()->getFar();
F32 old_near_plane = LLViewerCamera::getInstance()->getNear();

View File

@ -119,8 +119,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
if(!getDecoupleTextureSize())
{
S32 screen_width = llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]);
S32 screen_height = llround((F32)getRect().getHeight() * LLUI::sGLScaleFactor.mV[VY]);
S32 screen_width = llround((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]);
S32 screen_height = llround((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]);
setTextureSize(screen_width, screen_height);
}
@ -469,8 +469,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent )
{
if(!getDecoupleTextureSize())
{
S32 screen_width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
S32 screen_height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
S32 screen_width = llround((F32)width * LLUI::getScaleFactor().mV[VX]);
S32 screen_height = llround((F32)height * LLUI::getScaleFactor().mV[VY]);
// when floater is minimized, these sizes are negative
if ( screen_height > 0 && screen_width > 0 )
@ -667,7 +667,7 @@ bool LLMediaCtrl::ensureMediaSourceExists()
mMediaSource->addObserver( this );
mMediaSource->setBackgroundColor( getBackgroundColor() );
mMediaSource->setTrustedBrowser(mTrusted);
mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] );
mMediaSource->setPageZoomFactor( LLUI::getScaleFactor().mV[ VX ] );
if(mClearCache)
{
@ -750,7 +750,7 @@ void LLMediaCtrl::draw()
{
gGL.pushUIMatrix();
{
mMediaSource->setPageZoomFactor( LLUI::sGLScaleFactor.mV[ VX ] );
mMediaSource->setPageZoomFactor( LLUI::getScaleFactor().mV[ VX ] );
// scale texture to fit the space using texture coords
gGL.getTexUnit(0)->bind(media_texture);
@ -864,14 +864,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL();
}
x = llround((F32)x * LLUI::sGLScaleFactor.mV[VX]);
x = llround((F32)x * LLUI::getScaleFactor().mV[VX]);
if ( ! coords_opengl )
{
y = llround((F32)(y) * LLUI::sGLScaleFactor.mV[VY]);
y = llround((F32)(y) * LLUI::getScaleFactor().mV[VY]);
}
else
{
y = llround((F32)(getRect().getHeight() - y) * LLUI::sGLScaleFactor.mV[VY]);
y = llround((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]);
};
}

View File

@ -1425,7 +1425,7 @@ void render_ui_2d()
gGL.pushMatrix();
S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2);
gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f);
gGL.translatef((F32)half_width, (F32)half_height, 0.f);
F32 zoom = gAgentCamera.mHUDCurZoom;
gGL.scalef(zoom,zoom,1.f);
@ -1463,10 +1463,10 @@ void render_ui_2d()
LLUI::sDirtyRect = last_rect;
last_rect = t_rect;
last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::sGLScaleFactor.mV[0]);
last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::sGLScaleFactor.mV[0]);
last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::sGLScaleFactor.mV[1]);
last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::sGLScaleFactor.mV[1]);
last_rect.mLeft = LLRect::tCoordType(last_rect.mLeft / LLUI::getScaleFactor().mV[0]);
last_rect.mRight = LLRect::tCoordType(last_rect.mRight / LLUI::getScaleFactor().mV[0]);
last_rect.mTop = LLRect::tCoordType(last_rect.mTop / LLUI::getScaleFactor().mV[1]);
last_rect.mBottom = LLRect::tCoordType(last_rect.mBottom / LLUI::getScaleFactor().mV[1]);
LLRect clip_rect(last_rect);

View File

@ -2157,7 +2157,7 @@ void LLViewerWindow::reshape(S32 width, S32 height)
calcDisplayScale();
BOOL display_scale_changed = mDisplayScale != LLUI::sGLScaleFactor;
BOOL display_scale_changed = mDisplayScale != LLUI::getScaleFactor();
LLUI::setScaleFactor(mDisplayScale);
// update our window rectangle
@ -2363,7 +2363,7 @@ void LLViewerWindow::draw()
// scale view by UI global scale factor and aspect ratio correction factor
gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
LLVector2 old_scale_factor = LLUI::sGLScaleFactor;
LLVector2 old_scale_factor = LLUI::getScaleFactor();
// apply camera zoom transform (for high res screenshots)
F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion();
@ -2377,7 +2377,7 @@ void LLViewerWindow::draw()
(F32)getWindowHeightScaled() * -(F32)pos_y,
0.f);
gGL.scalef(zoom_factor, zoom_factor, 1.f);
LLUI::sGLScaleFactor *= zoom_factor;
LLUI::getScaleFactor() *= zoom_factor;
}
// Draw tool specific overlay on world
@ -2425,7 +2425,7 @@ void LLViewerWindow::draw()
LLFontGL::HCENTER, LLFontGL::TOP);
}
LLUI::sGLScaleFactor = old_scale_factor;
LLUI::setScaleFactor(old_scale_factor);
}
LLUI::popMatrix();
gGL.popMatrix();
@ -3230,8 +3230,8 @@ void LLViewerWindow::updateLayout()
void LLViewerWindow::updateMouseDelta()
{
S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::getScaleFactor().mV[VX]);
S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::getScaleFactor().mV[VY]);
//RN: fix for asynchronous notification of mouse leaving window not working
LLCoordWindow mouse_pos;

View File

@ -421,7 +421,7 @@ void LLWorldMapView::draw()
{
// Inform the fetch mechanism of the size we need
S32 draw_size = llround(sMapScale);
overlayimage->setKnownDrawSize(llround(draw_size * LLUI::sGLScaleFactor.mV[VX]), llround(draw_size * LLUI::sGLScaleFactor.mV[VY]));
overlayimage->setKnownDrawSize(llround(draw_size * LLUI::getScaleFactor().mV[VX]), llround(draw_size * LLUI::getScaleFactor().mV[VY]));
// Draw something whenever we have enough info
if (overlayimage->hasGLTexture())
{
@ -1320,7 +1320,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.translatef((F32)x * LLUI::sGLScaleFactor.mV[VX], (F32)y * LLUI::sGLScaleFactor.mV[VY], 0.f);
gGL.translatef((F32)x * LLUI::getScaleFactor().mV[VX], (F32)y * LLUI::getScaleFactor().mV[VY], 0.f);
gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
gGL.popMatrix();