summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender2dutils.h
diff options
context:
space:
mode:
authorMichael Pohoreski <ptolemy@lindenlab.com>2019-11-20 17:10:22 -0800
committerMichael Pohoreski <ptolemy@lindenlab.com>2019-11-20 17:10:22 -0800
commit4b205db468fd371dfe1bb30bb887e2ccbd7044ec (patch)
tree6d83efd5ebc0c2a462f33f1b385c5b415a93cb49 /indra/llrender/llrender2dutils.h
parent18eb8ac90ce409ba620f6fe8ff487e6195d9c3eb (diff)
parent24920de799c8e2dd26854923c7a10fc4a551dd5d (diff)
Merged lindenlab/viewer-eep into default
Diffstat (limited to 'indra/llrender/llrender2dutils.h')
-rw-r--r--indra/llrender/llrender2dutils.h45
1 files changed, 30 insertions, 15 deletions
diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h
index cce3b4ed51..70ab006fd6 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -121,39 +121,54 @@ inline void gl_rect_2d_offset_local( const LLRect& rect, S32 pixel_offset, BOOL
class LLImageProviderInterface;
-class LLRender2D
+class LLRender2D : public LLParamSingleton<LLRender2D>
{
+ LLSINGLETON(LLRender2D, LLImageProviderInterface* image_provider);
LOG_CLASS(LLRender2D);
+ ~LLRender2D();
public:
- static void initClass(LLImageProviderInterface* image_provider,
- const LLVector2* scale_factor);
- static void cleanupClass();
+ void pushMatrix();
+ void popMatrix();
+ void loadIdentity();
+ void translate(F32 x, F32 y, F32 z = 0.0f);
- static void pushMatrix();
- static void popMatrix();
- static void loadIdentity();
- static void translate(F32 x, F32 y, F32 z = 0.0f);
+ void setLineWidth(F32 width);
+ void setScaleFactor(const LLVector2& scale_factor);
- static void setLineWidth(F32 width);
- static void setScaleFactor(const LLVector2& scale_factor);
+ LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
+ LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
- static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
- static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
+ LLVector2 mGLScaleFactor;
+
+protected:
+ // since LLRender2D has no control of image provider's lifecycle
+ // we need a way to tell LLRender2D that provider died and
+ // LLRender2D needs to be updated.
+ static void resetProvider();
- static LLVector2 sGLScaleFactor;
private:
- static LLImageProviderInterface* sImageProvider;
+ LLImageProviderInterface* mImageProvider;
};
class LLImageProviderInterface
{
protected:
LLImageProviderInterface() {};
- virtual ~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;
+
+ // to notify holders when pointer gets deleted
+ typedef void(*callback_t)();
+ void addOnRemovalCallback(callback_t func);
+ void deleteOnRemovalCallback(callback_t func);
+
+private:
+
+ typedef std::list< callback_t > callback_list_t;
+ callback_list_t mCallbackList;
};