diff options
Diffstat (limited to 'linden/indra/llui/llui.h')
-rw-r--r-- | linden/indra/llui/llui.h | 90 |
1 files changed, 66 insertions, 24 deletions
diff --git a/linden/indra/llui/llui.h b/linden/indra/llui/llui.h index 2832b39..9d98620 100644 --- a/linden/indra/llui/llui.h +++ b/linden/indra/llui/llui.h | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -41,14 +41,15 @@ | |||
41 | #include "llhtmlhelp.h" | 41 | #include "llhtmlhelp.h" |
42 | #include "llgl.h" | 42 | #include "llgl.h" |
43 | #include <stack> | 43 | #include <stack> |
44 | #include "llimagegl.h" | ||
44 | 45 | ||
45 | class LLColor4; | 46 | class LLColor4; |
46 | class LLVector3; | 47 | class LLVector3; |
47 | class LLVector2; | 48 | class LLVector2; |
48 | class LLImageGL; | ||
49 | class LLUUID; | 49 | class LLUUID; |
50 | class LLWindow; | 50 | class LLWindow; |
51 | class LLView; | 51 | class LLView; |
52 | class LLUIImage; | ||
52 | 53 | ||
53 | // UI colors | 54 | // UI colors |
54 | extern const LLColor4 UI_VERTEX_COLOR; | 55 | extern const LLColor4 UI_VERTEX_COLOR; |
@@ -83,13 +84,14 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& | |||
83 | 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); | 84 | 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); |
84 | void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LLColor4& inner_color, const LLColor4& outer_color); | 85 | void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LLColor4& inner_color, const LLColor4& outer_color); |
85 | 86 | ||
86 | void gl_draw_image(S32 x, S32 y, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR); | 87 | void gl_draw_image(S32 x, S32 y, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); |
87 | void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR); | 88 | void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); |
88 | void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR); | 89 | void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); |
89 | void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR); | 90 | void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); |
90 | void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLImageGL* image, const LLColor4 &color, BOOL solid_color = FALSE); | 91 | void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLImageGL* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); |
92 | void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLImageGL* 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)); | ||
91 | // Flip vertical, used for LLFloaterHTML | 93 | // Flip vertical, used for LLFloaterHTML |
92 | void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR); | 94 | void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageGL* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); |
93 | 95 | ||
94 | void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom); | 96 | void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom); |
95 | void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); | 97 | void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); |
@@ -166,20 +168,19 @@ public: | |||
166 | 168 | ||
167 | //helper functions (should probably move free standing rendering helper functions here) | 169 | //helper functions (should probably move free standing rendering helper functions here) |
168 | static LLString locateSkin(const LLString& filename); | 170 | static LLString locateSkin(const LLString& filename); |
169 | static void pushClipRect(const LLRect& rect); | ||
170 | static void popClipRect(); | ||
171 | static void setCursorPositionScreen(S32 x, S32 y); | 171 | static void setCursorPositionScreen(S32 x, S32 y); |
172 | static void setCursorPositionLocal(LLView* viewp, S32 x, S32 y); | 172 | static void setCursorPositionLocal(LLView* viewp, S32 x, S32 y); |
173 | static void setScaleFactor(const LLVector2& scale_factor); | 173 | static void setScaleFactor(const LLVector2& scale_factor); |
174 | static void setLineWidth(F32 width); | 174 | static void setLineWidth(F32 width); |
175 | static LLUUID findAssetUUIDByName(const LLString& name); | 175 | static LLUUID findAssetUUIDByName(const LLString& name); |
176 | static LLUIImage* getUIImageByName(const LLString& name); | ||
176 | static LLVector2 getWindowSize(); | 177 | static LLVector2 getWindowSize(); |
178 | static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); | ||
179 | static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); | ||
180 | static void screenRectToGL(const LLRect& screen, LLRect *gl); | ||
181 | static void glRectToScreen(const LLRect& gl, LLRect *screen); | ||
177 | static void setHtmlHelp(LLHtmlHelp* html_help); | 182 | static void setHtmlHelp(LLHtmlHelp* html_help); |
178 | 183 | ||
179 | private: | ||
180 | static void setScissorRegionScreen(const LLRect& rect); | ||
181 | static void setScissorRegionLocal(const LLRect& rect); // works assuming LLUI::translate has been called | ||
182 | |||
183 | public: | 184 | public: |
184 | static LLControlGroup* sConfigGroup; | 185 | static LLControlGroup* sConfigGroup; |
185 | static LLControlGroup* sColorsGroup; | 186 | static LLControlGroup* sColorsGroup; |
@@ -190,7 +191,6 @@ public: | |||
190 | static LLWindow* sWindow; | 191 | static LLWindow* sWindow; |
191 | static BOOL sShowXUINames; | 192 | static BOOL sShowXUINames; |
192 | static LLHtmlHelp* sHtmlHelp; | 193 | static LLHtmlHelp* sHtmlHelp; |
193 | static std::stack<LLRect> sClipRectStack; | ||
194 | 194 | ||
195 | }; | 195 | }; |
196 | 196 | ||
@@ -282,6 +282,7 @@ typedef enum e_widget_type | |||
282 | WIDGET_TYPE_MEMORY_VIEW, | 282 | WIDGET_TYPE_MEMORY_VIEW, |
283 | WIDGET_TYPE_FRAME_STAT_VIEW, | 283 | WIDGET_TYPE_FRAME_STAT_VIEW, |
284 | WIDGET_TYPE_LAYOUT_STACK, | 284 | WIDGET_TYPE_LAYOUT_STACK, |
285 | WIDGET_TYPE_FLYOUT_BUTTON, | ||
285 | WIDGET_TYPE_DONTCARE, | 286 | WIDGET_TYPE_DONTCARE, |
286 | WIDGET_TYPE_COUNT | 287 | WIDGET_TYPE_COUNT |
287 | } EWidgetType; | 288 | } EWidgetType; |
@@ -378,24 +379,65 @@ protected: | |||
378 | 379 | ||
379 | template <class T, class U> T* LLUISingleton<T,U>::sInstance = NULL; | 380 | template <class T, class U> T* LLUISingleton<T,U>::sInstance = NULL; |
380 | 381 | ||
381 | class LLClipRect | 382 | class LLScreenClipRect |
382 | { | 383 | { |
383 | public: | 384 | public: |
384 | LLClipRect(const LLRect& rect, BOOL enabled = TRUE); | 385 | LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE); |
385 | virtual ~LLClipRect(); | 386 | virtual ~LLScreenClipRect(); |
386 | protected: | 387 | |
388 | private: | ||
389 | static void pushClipRect(const LLRect& rect); | ||
390 | static void popClipRect(); | ||
391 | static void updateScissorRegion(); | ||
392 | |||
393 | private: | ||
387 | LLGLState mScissorState; | 394 | LLGLState mScissorState; |
388 | BOOL mEnabled; | 395 | BOOL mEnabled; |
396 | |||
397 | static std::stack<LLRect> sClipRectStack; | ||
389 | }; | 398 | }; |
390 | 399 | ||
391 | class LLLocalClipRect | 400 | class LLLocalClipRect : public LLScreenClipRect |
392 | { | 401 | { |
393 | public: | 402 | public: |
394 | LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE); | 403 | LLLocalClipRect(const LLRect& rect, BOOL enabled = TRUE); |
395 | virtual ~LLLocalClipRect(); | 404 | }; |
405 | |||
406 | class LLUIImage : public LLRefCount | ||
407 | { | ||
408 | public: | ||
409 | LLUIImage(LLPointer<LLImageGL> image); | ||
410 | |||
411 | void setClipRegion(const LLRectf& region); | ||
412 | void setScaleRegion(const LLRectf& region); | ||
413 | |||
414 | LLPointer<LLImageGL> getImage() { return mImage; } | ||
415 | |||
416 | void draw(S32 x, S32 y, const LLColor4& color = UI_VERTEX_COLOR); | ||
417 | void draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color = UI_VERTEX_COLOR); | ||
418 | void drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color); | ||
419 | void drawSolid(S32 x, S32 y, const LLColor4& color); | ||
420 | |||
421 | S32 getWidth(); | ||
422 | S32 getHeight(); | ||
423 | |||
396 | protected: | 424 | protected: |
397 | LLGLState mScissorState; | 425 | LLRectf mScaleRegion; |
398 | BOOL mEnabled; | 426 | LLRectf mClipRegion; |
427 | LLPointer<LLImageGL> mImage; | ||
428 | BOOL mUniformScaling; | ||
429 | BOOL mNoClip; | ||
430 | }; | ||
431 | |||
432 | //RN: maybe this needs to moved elsewhere? | ||
433 | class LLImageProviderInterface | ||
434 | { | ||
435 | public: | ||
436 | LLImageProviderInterface() {}; | ||
437 | virtual ~LLImageProviderInterface() {}; | ||
438 | |||
439 | virtual LLUIImage* getUIImageByID(const LLUUID& id, BOOL clamped = TRUE) = 0; | ||
440 | virtual LLImageGL* getImageByID(const LLUUID& id, BOOL clamped = TRUE) = 0; | ||
399 | }; | 441 | }; |
400 | 442 | ||
401 | #endif | 443 | #endif |