mirror of
				https://github.com/jojo61/vdr-plugin-softhdcuvid.git
				synced 2025-03-01 10:39:28 +00:00 
			
		
		
		
	Reindent all sources to common coding style.
This commit is contained in:
		
							
								
								
									
										647
									
								
								openglosd.h
									
									
									
									
									
								
							
							
						
						
									
										647
									
								
								openglosd.h
									
									
									
									
									
								
							| @@ -17,25 +17,21 @@ | ||||
| #include FT_STROKER_H | ||||
|  | ||||
| #undef __FTERRORS_H__ | ||||
| #define FT_ERRORDEF( e, v, s )  { e, s }, | ||||
| #define FT_ERROR_START_LIST     { | ||||
| #define FT_ERROR_END_LIST       { 0, 0 } }; | ||||
| const struct { | ||||
|     int          code; | ||||
|     const char*  message; | ||||
| #define FT_ERRORDEF( e, v, s )	{ e, s }, | ||||
| #define FT_ERROR_START_LIST	{ | ||||
| #define FT_ERROR_END_LIST	{ 0, 0 } }; | ||||
| const struct | ||||
| { | ||||
|     int code; | ||||
|     const char *message; | ||||
| } FT_Errors[] = | ||||
| #include FT_ERRORS_H | ||||
|  | ||||
|  | ||||
| #include <memory> | ||||
| #include <queue> | ||||
|  | ||||
| #include <vdr/plugin.h> | ||||
| #include <vdr/osd.h> | ||||
| #include <vdr/thread.h> | ||||
|  | ||||
| #include "softhddev.h" | ||||
|  | ||||
| extern "C" | ||||
| { | ||||
| #include <stdint.h> | ||||
| @@ -49,7 +45,8 @@ extern "C" | ||||
|  | ||||
| extern "C" pthread_mutex_t OSDMutex; | ||||
|  | ||||
| struct sOglImage { | ||||
| struct sOglImage | ||||
| { | ||||
|     GLuint texture; | ||||
|     GLint width; | ||||
|     GLint height; | ||||
| @@ -60,69 +57,97 @@ struct sOglImage { | ||||
| * Helpers | ||||
| ****************************************************************************************/ | ||||
|  | ||||
| void ConvertColor(const GLint &colARGB, glm::vec4 &col); | ||||
| void ConvertColor(const GLint & colARGB, glm::vec4 & col); | ||||
|  | ||||
| /**************************************************************************************** | ||||
| * cShader | ||||
| ****************************************************************************************/ | ||||
| enum eShaderType { | ||||
| enum eShaderType | ||||
| { | ||||
|     stRect, | ||||
|     stTexture, | ||||
|     stText, | ||||
|     stCount | ||||
| }; | ||||
|  | ||||
| class cShader { | ||||
| private: | ||||
| class cShader | ||||
| { | ||||
|   private: | ||||
|     eShaderType type; | ||||
|     GLuint id; | ||||
|     bool Compile(const char *vertexCode, const char *fragmentCode); | ||||
|     bool CheckCompileErrors(GLuint object, bool program = false); | ||||
| public: | ||||
|     cShader(void) {}; | ||||
|     virtual ~cShader(void) {}; | ||||
|   public: | ||||
|      cShader(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual ~ cShader(void) | ||||
|     { | ||||
|     }; | ||||
|     bool Load(eShaderType type); | ||||
|     void Use(void); | ||||
|     void SetFloat    (const GLchar *name, GLfloat value); | ||||
|     void SetInteger  (const GLchar *name, GLint value); | ||||
|     void SetVector2f (const GLchar *name, GLfloat x, GLfloat y); | ||||
|     void SetVector3f (const GLchar *name, GLfloat x, GLfloat y, GLfloat z); | ||||
|     void SetVector4f (const GLchar *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); | ||||
|     void SetMatrix4  (const GLchar *name, const glm::mat4 &matrix); | ||||
|     void SetFloat(const GLchar * name, GLfloat value); | ||||
|     void SetInteger(const GLchar * name, GLint value); | ||||
|     void SetVector2f(const GLchar * name, GLfloat x, GLfloat y); | ||||
|     void SetVector3f(const GLchar * name, GLfloat x, GLfloat y, GLfloat z); | ||||
|     void SetVector4f(const GLchar * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); | ||||
|     void SetMatrix4(const GLchar * name, const glm::mat4 & matrix); | ||||
| }; | ||||
|  | ||||
| /**************************************************************************************** | ||||
| * cOglGlyph | ||||
| ****************************************************************************************/ | ||||
| class cOglGlyph : public cListObject { | ||||
| private: | ||||
|     struct tKerning { | ||||
|         public: | ||||
|             tKerning(uint prevSym, GLfloat kerning = 0.0f)  { | ||||
|                 this->prevSym = prevSym; | ||||
|                 this->kerning = kerning; | ||||
|             } | ||||
|             uint prevSym; | ||||
|             GLfloat kerning; | ||||
| class cOglGlyph:public cListObject | ||||
| { | ||||
|   private: | ||||
|     struct tKerning | ||||
|     { | ||||
|       public: | ||||
|         tKerning(uint prevSym, GLfloat kerning = 0.0f) { | ||||
|             this->prevSym = prevSym; | ||||
|             this->kerning = kerning; | ||||
|         } | ||||
|         uint prevSym; | ||||
|         GLfloat kerning; | ||||
|     }; | ||||
|     uint charCode; | ||||
|     int bearingLeft; | ||||
|     int bearingTop; | ||||
|     int width; | ||||
|     int height; | ||||
|     int advanceX;       | ||||
|     cVector<tKerning> kerningCache; | ||||
|     int advanceX; | ||||
|  | ||||
|     cVector < tKerning > kerningCache; | ||||
|     GLuint texture; | ||||
|     void LoadTexture(FT_BitmapGlyph ftGlyph); | ||||
| public: | ||||
|  | ||||
|   public: | ||||
|     cOglGlyph(uint charCode, FT_BitmapGlyph ftGlyph); | ||||
|     virtual ~cOglGlyph(); | ||||
|     uint CharCode(void) { return charCode; } | ||||
|     int AdvanceX(void) { return advanceX; } | ||||
|     int BearingLeft(void) const { return bearingLeft; } | ||||
|     int BearingTop(void) const { return bearingTop; } | ||||
|     int Width(void) const { return width; } | ||||
|     int Height(void) const { return height; } | ||||
|     virtual ~ cOglGlyph(); | ||||
|     uint CharCode(void) | ||||
|     { | ||||
|         return charCode; | ||||
|     } | ||||
|     int AdvanceX(void) | ||||
|     { | ||||
|         return advanceX; | ||||
|     } | ||||
|     int BearingLeft(void) const | ||||
|     { | ||||
|         return bearingLeft; | ||||
|     } | ||||
|     int BearingTop(void) const | ||||
|     { | ||||
|         return bearingTop; | ||||
|     } | ||||
|     int Width(void) const | ||||
|     { | ||||
|         return width; | ||||
|     } | ||||
|     int Height(void) const | ||||
|     { | ||||
|         return height; | ||||
|     } | ||||
|     int GetKerningCache(uint prevSym); | ||||
|     void SetKerningCache(uint prevSym, int kerning); | ||||
|     void BindTexture(void); | ||||
| @@ -131,8 +156,9 @@ public: | ||||
| /**************************************************************************************** | ||||
| * cOglFont | ||||
| ****************************************************************************************/ | ||||
| class cOglFont : public cListObject { | ||||
| private: | ||||
| class cOglFont:public cListObject | ||||
| { | ||||
|   private: | ||||
|     static bool initiated; | ||||
|     cString name; | ||||
|     int size; | ||||
| @@ -140,41 +166,57 @@ private: | ||||
|     int bottom; | ||||
|     static FT_Library ftLib; | ||||
|     FT_Face face; | ||||
|     static cList<cOglFont> *fonts; | ||||
|     mutable cList<cOglGlyph> glyphCache; | ||||
|     cOglFont(const char *fontName, int charHeight); | ||||
|     static cList < cOglFont > *fonts; | ||||
|     mutable cList < cOglGlyph > glyphCache; | ||||
|      cOglFont(const char *fontName, int charHeight); | ||||
|     static void Init(void); | ||||
| public: | ||||
|     virtual ~cOglFont(void); | ||||
|   public: | ||||
|      virtual ~ cOglFont(void); | ||||
|     static cOglFont *Get(const char *name, int charHeight); | ||||
|     static void Cleanup(void); | ||||
|     const char *Name(void) { return *name; }; | ||||
|     int Size(void) { return size; }; | ||||
|     int Bottom(void) {return bottom; }; | ||||
|     int Height(void) {return height; }; | ||||
|     cOglGlyph* Glyph(uint charCode) const; | ||||
|     int Kerning(cOglGlyph *glyph, uint prevSym) const; | ||||
|     const char *Name(void) | ||||
|     { | ||||
|         return *name; | ||||
|     }; | ||||
|     int Size(void) | ||||
|     { | ||||
|         return size; | ||||
|     }; | ||||
|     int Bottom(void) | ||||
|     { | ||||
|         return bottom; | ||||
|     }; | ||||
|     int Height(void) | ||||
|     { | ||||
|         return height; | ||||
|     }; | ||||
|     cOglGlyph *Glyph(uint charCode) const; | ||||
|     int Kerning(cOglGlyph * glyph, uint prevSym) const; | ||||
| }; | ||||
|  | ||||
| /**************************************************************************************** | ||||
| * cOglFb | ||||
| * Framebuffer Object - OpenGL part of a Pixmap | ||||
| ****************************************************************************************/ | ||||
| class cOglFb { | ||||
| protected: | ||||
| class cOglFb | ||||
| { | ||||
|   protected: | ||||
|     bool initiated; | ||||
| //    GLuint fb; | ||||
| //    GLuint texture; | ||||
|     GLint width, height; | ||||
|     GLint viewPortWidth, viewPortHeight; | ||||
|     bool scrollable; | ||||
| public: | ||||
| 	GLuint fb; | ||||
| 	GLuint texture; | ||||
| 	 | ||||
|     cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight); | ||||
|     virtual ~cOglFb(void); | ||||
|     bool Initiated(void) { return initiated; } | ||||
|   public: | ||||
|      GLuint fb; | ||||
|     GLuint texture; | ||||
|  | ||||
|      cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight); | ||||
|      virtual ~ cOglFb(void); | ||||
|     bool Initiated(void) | ||||
|     { | ||||
|         return initiated; | ||||
|     } | ||||
|     virtual bool Init(void); | ||||
|     void Bind(void); | ||||
|     void BindRead(void); | ||||
| @@ -182,27 +224,43 @@ public: | ||||
|     virtual void Unbind(void); | ||||
|     bool BindTexture(void); | ||||
|     void Blit(GLint destX1, GLint destY1, GLint destX2, GLint destY2); | ||||
|     GLint Width(void) { return width; }; | ||||
|     GLint Height(void) { return height; }; | ||||
|     bool Scrollable(void) { return scrollable; }; | ||||
|     GLint ViewportWidth(void) { return viewPortWidth; }; | ||||
|     GLint ViewportHeight(void) { return viewPortHeight; }; | ||||
|     GLint Width(void) | ||||
|     { | ||||
|         return width; | ||||
|     }; | ||||
|     GLint Height(void) | ||||
|     { | ||||
|         return height; | ||||
|     }; | ||||
|     bool Scrollable(void) | ||||
|     { | ||||
|         return scrollable; | ||||
|     }; | ||||
|     GLint ViewportWidth(void) | ||||
|     { | ||||
|         return viewPortWidth; | ||||
|     }; | ||||
|     GLint ViewportHeight(void) | ||||
|     { | ||||
|         return viewPortHeight; | ||||
|     }; | ||||
| }; | ||||
|  | ||||
| /**************************************************************************************** | ||||
| * cOglOutputFb | ||||
| * Output Framebuffer Object - holds Vdpau Output Surface which is our "output framebuffer" | ||||
| ****************************************************************************************/ | ||||
| class cOglOutputFb : public cOglFb { | ||||
| protected: | ||||
| class cOglOutputFb:public cOglFb | ||||
| { | ||||
|   protected: | ||||
|     bool initiated; | ||||
| private: | ||||
|     GLvdpauSurfaceNV surface; | ||||
| public: | ||||
| 	GLuint fb; | ||||
| 	GLuint texture; | ||||
|     cOglOutputFb(GLint width, GLint height); | ||||
|     virtual ~cOglOutputFb(void); | ||||
|   private: | ||||
|      GLvdpauSurfaceNV surface; | ||||
|   public: | ||||
|      GLuint fb; | ||||
|     GLuint texture; | ||||
|      cOglOutputFb(GLint width, GLint height); | ||||
|      virtual ~ cOglOutputFb(void); | ||||
|     virtual bool Init(void); | ||||
|     virtual void BindWrite(void); | ||||
|     virtual void Unbind(void); | ||||
| @@ -212,7 +270,8 @@ public: | ||||
| * cOglVb | ||||
| * Vertex Buffer - OpenGl Vertices for the different drawing commands   | ||||
| ****************************************************************************************/ | ||||
| enum eVertexBufferType { | ||||
| enum eVertexBufferType | ||||
| { | ||||
|     vbRect, | ||||
|     vbEllipse, | ||||
|     vbSlope, | ||||
| @@ -221,8 +280,9 @@ enum eVertexBufferType { | ||||
|     vbCount | ||||
| }; | ||||
|  | ||||
| class cOglVb { | ||||
| private: | ||||
| class cOglVb | ||||
| { | ||||
|   private: | ||||
|     eVertexBufferType type; | ||||
|     eShaderType shader; | ||||
|     GLuint vao; | ||||
| @@ -231,9 +291,9 @@ private: | ||||
|     int sizeVertex2; | ||||
|     int numVertices; | ||||
|     GLuint drawMode; | ||||
| public: | ||||
|     cOglVb(int type); | ||||
|     virtual ~cOglVb(void); | ||||
|   public: | ||||
|      cOglVb(int type); | ||||
|      virtual ~ cOglVb(void); | ||||
|     bool Init(void); | ||||
|     void Bind(void); | ||||
|     void Unbind(void); | ||||
| @@ -243,184 +303,271 @@ public: | ||||
|     void SetShaderColor(GLint color); | ||||
|     void SetShaderAlpha(GLint alpha); | ||||
|     void SetShaderProjectionMatrix(GLint width, GLint height); | ||||
|     void SetVertexData(GLfloat *vertices, int count = 0); | ||||
|     void SetVertexData(GLfloat * vertices, int count = 0); | ||||
|     void DrawArrays(int count = 0); | ||||
| }; | ||||
|  | ||||
| /**************************************************************************************** | ||||
| * cOpenGLCmd | ||||
| ****************************************************************************************/ | ||||
| class cOglCmd { | ||||
| protected: | ||||
|     cOglFb *fb; | ||||
| public: | ||||
|     cOglCmd(cOglFb *fb) { this->fb = fb; }; | ||||
|     virtual ~cOglCmd(void) {}; | ||||
|     virtual const char* Description(void) = 0; | ||||
| class cOglCmd | ||||
| { | ||||
|   protected: | ||||
|     cOglFb * fb; | ||||
|   public: | ||||
|     cOglCmd(cOglFb * fb) | ||||
|     { | ||||
|         this->fb = fb; | ||||
|     }; | ||||
|     virtual ~ cOglCmd(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) = 0; | ||||
|     virtual bool Execute(void) = 0; | ||||
| }; | ||||
|  | ||||
| class cOglCmdInitOutputFb : public cOglCmd { | ||||
| private: | ||||
|     cOglOutputFb *oFb; | ||||
| public: | ||||
|     cOglCmdInitOutputFb(cOglOutputFb *oFb); | ||||
|     virtual ~cOglCmdInitOutputFb(void) {}; | ||||
|     virtual const char* Description(void) { return "InitOutputFramebuffer"; } | ||||
| class cOglCmdInitOutputFb:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     cOglOutputFb * oFb; | ||||
|   public: | ||||
|     cOglCmdInitOutputFb(cOglOutputFb * oFb); | ||||
|     virtual ~ cOglCmdInitOutputFb(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "InitOutputFramebuffer"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdInitFb : public cOglCmd { | ||||
| private: | ||||
|     cCondWait *wait; | ||||
| public: | ||||
|     cOglCmdInitFb(cOglFb *fb, cCondWait *wait = NULL); | ||||
|     virtual ~cOglCmdInitFb(void) {}; | ||||
|     virtual const char* Description(void) { return "InitFramebuffer"; } | ||||
| class cOglCmdInitFb:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     cCondWait * wait; | ||||
|   public: | ||||
|     cOglCmdInitFb(cOglFb * fb, cCondWait * wait = NULL); | ||||
|     virtual ~ cOglCmdInitFb(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "InitFramebuffer"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDeleteFb : public cOglCmd { | ||||
| public: | ||||
|     cOglCmdDeleteFb(cOglFb *fb); | ||||
|     virtual ~cOglCmdDeleteFb(void) {}; | ||||
|     virtual const char* Description(void) { return "DeleteFramebuffer"; } | ||||
| class cOglCmdDeleteFb:public cOglCmd | ||||
| { | ||||
|   public: | ||||
|     cOglCmdDeleteFb(cOglFb * fb); | ||||
|     virtual ~ cOglCmdDeleteFb(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "DeleteFramebuffer"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdRenderFbToBufferFb : public cOglCmd { | ||||
| private: | ||||
|     cOglFb *buffer; | ||||
| class cOglCmdRenderFbToBufferFb:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     cOglFb * buffer; | ||||
|     GLfloat x, y; | ||||
|     GLfloat drawPortX, drawPortY; | ||||
|     GLint transparency; | ||||
| public: | ||||
|     cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, GLint drawPortY); | ||||
|     virtual ~cOglCmdRenderFbToBufferFb(void) {}; | ||||
|     virtual const char* Description(void) { return "Render Framebuffer to Buffer"; } | ||||
|   public: | ||||
|      cOglCmdRenderFbToBufferFb(cOglFb * fb, cOglFb * buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, | ||||
|         GLint drawPortY); | ||||
|      virtual ~ cOglCmdRenderFbToBufferFb(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Render Framebuffer to Buffer"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdCopyBufferToOutputFb : public cOglCmd { | ||||
| private: | ||||
|     cOglOutputFb *oFb; | ||||
| class cOglCmdCopyBufferToOutputFb:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     cOglOutputFb * oFb; | ||||
|     GLint x, y; | ||||
| public: | ||||
|     cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y); | ||||
|     virtual ~cOglCmdCopyBufferToOutputFb(void) {}; | ||||
|     virtual const char* Description(void) { return "Copy buffer to OutputFramebuffer"; } | ||||
|   public: | ||||
|      cOglCmdCopyBufferToOutputFb(cOglFb * fb, cOglOutputFb * oFb, GLint x, GLint y); | ||||
|      virtual ~ cOglCmdCopyBufferToOutputFb(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Copy buffer to OutputFramebuffer"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdFill : public cOglCmd { | ||||
| private: | ||||
| class cOglCmdFill:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     GLint color; | ||||
| public: | ||||
|     cOglCmdFill(cOglFb *fb, GLint color); | ||||
|     virtual ~cOglCmdFill(void) {}; | ||||
|     virtual const char* Description(void) { return "Fill"; } | ||||
|   public: | ||||
|     cOglCmdFill(cOglFb * fb, GLint color); | ||||
|     virtual ~ cOglCmdFill(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Fill"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDrawRectangle : public cOglCmd { | ||||
| private: | ||||
| class cOglCmdDrawRectangle:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     GLint x, y; | ||||
|     GLint width, height; | ||||
|     GLint color; | ||||
| public: | ||||
|     cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color); | ||||
|     virtual ~cOglCmdDrawRectangle(void) {}; | ||||
|     virtual const char* Description(void) { return "DrawRectangle"; } | ||||
|   public: | ||||
|      cOglCmdDrawRectangle(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color); | ||||
|      virtual ~ cOglCmdDrawRectangle(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "DrawRectangle"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDrawEllipse : public cOglCmd { | ||||
| private: | ||||
| class cOglCmdDrawEllipse:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     GLint x, y; | ||||
|     GLint width, height; | ||||
|     GLint color; | ||||
|     GLint quadrants; | ||||
|     GLfloat *CreateVerticesFull(int &numVertices); | ||||
|     GLfloat *CreateVerticesQuadrant(int &numVertices); | ||||
|     GLfloat *CreateVerticesHalf(int &numVertices);  | ||||
| public: | ||||
|     cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants); | ||||
|     virtual ~cOglCmdDrawEllipse(void) {}; | ||||
|     virtual const char* Description(void) { return "DrawEllipse"; } | ||||
|     GLfloat *CreateVerticesHalf(int &numVertices); | ||||
|   public: | ||||
|      cOglCmdDrawEllipse(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants); | ||||
|      virtual ~ cOglCmdDrawEllipse(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "DrawEllipse"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDrawSlope : public cOglCmd { | ||||
| private: | ||||
| class cOglCmdDrawSlope:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     GLint x, y; | ||||
|     GLint width, height; | ||||
|     GLint color; | ||||
|     GLint type; | ||||
| public: | ||||
|     cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type); | ||||
|     virtual ~cOglCmdDrawSlope(void) {}; | ||||
|     virtual const char* Description(void) { return "DrawSlope"; } | ||||
|   public: | ||||
|      cOglCmdDrawSlope(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type); | ||||
|      virtual ~ cOglCmdDrawSlope(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "DrawSlope"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDrawText : public cOglCmd { | ||||
| private: | ||||
| class cOglCmdDrawText:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     GLint x, y; | ||||
|     GLint limitX; | ||||
|     GLint colorText; | ||||
|     cString fontName; | ||||
|     int fontSize; | ||||
|     unsigned int *symbols; | ||||
| public: | ||||
|     cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText); | ||||
|     virtual ~cOglCmdDrawText(void); | ||||
|     virtual const char* Description(void) { return "DrawText"; } | ||||
|   public: | ||||
|      cOglCmdDrawText(cOglFb * fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, | ||||
|         int fontSize, tColor colorText); | ||||
|      virtual ~ cOglCmdDrawText(void); | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "DrawText"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDrawImage : public cOglCmd { | ||||
| private: | ||||
|     tColor *argb; | ||||
| class cOglCmdDrawImage:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     tColor * argb; | ||||
|     GLint x, y, width, height; | ||||
|     bool overlay; | ||||
|     GLfloat scaleX, scaleY; | ||||
| public: | ||||
|     cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true, double scaleX = 1.0f, double scaleY = 1.0f); | ||||
|     virtual ~cOglCmdDrawImage(void); | ||||
|     virtual const char* Description(void) { return "Draw Image"; } | ||||
|   public: | ||||
|      cOglCmdDrawImage(cOglFb * fb, tColor * argb, GLint width, GLint height, GLint x, GLint y, bool overlay = | ||||
|         true, double scaleX = 1.0f, double scaleY = 1.0f); | ||||
|      virtual ~ cOglCmdDrawImage(void); | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Draw Image"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDrawTexture : public cOglCmd { | ||||
| private: | ||||
|     sOglImage *imageRef; | ||||
| class cOglCmdDrawTexture:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     sOglImage * imageRef; | ||||
|     GLint x, y; | ||||
| public: | ||||
|     cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y); | ||||
|     virtual ~cOglCmdDrawTexture(void) {}; | ||||
|     virtual const char* Description(void) { return "Draw Texture"; } | ||||
|   public: | ||||
|      cOglCmdDrawTexture(cOglFb * fb, sOglImage * imageRef, GLint x, GLint y); | ||||
|      virtual ~ cOglCmdDrawTexture(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Draw Texture"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdStoreImage : public cOglCmd { | ||||
| private: | ||||
|     sOglImage *imageRef; | ||||
| class cOglCmdStoreImage:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     sOglImage * imageRef; | ||||
|     tColor *data; | ||||
| public: | ||||
|     cOglCmdStoreImage(sOglImage *imageRef, tColor *argb); | ||||
|     virtual ~cOglCmdStoreImage(void); | ||||
|     virtual const char* Description(void) { return "Store Image"; } | ||||
|   public: | ||||
|      cOglCmdStoreImage(sOglImage * imageRef, tColor * argb); | ||||
|      virtual ~ cOglCmdStoreImage(void); | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Store Image"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| class cOglCmdDropImage : public cOglCmd { | ||||
| private: | ||||
|     sOglImage *imageRef; | ||||
| class cOglCmdDropImage:public cOglCmd | ||||
| { | ||||
|   private: | ||||
|     sOglImage * imageRef; | ||||
|     cCondWait *wait; | ||||
| public: | ||||
|     cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait); | ||||
|     virtual ~cOglCmdDropImage(void) {}; | ||||
|     virtual const char* Description(void) { return "Drop Image"; } | ||||
|   public: | ||||
|      cOglCmdDropImage(sOglImage * imageRef, cCondWait * wait); | ||||
|      virtual ~ cOglCmdDropImage(void) | ||||
|     { | ||||
|     }; | ||||
|     virtual const char *Description(void) | ||||
|     { | ||||
|         return "Drop Image"; | ||||
|     } | ||||
|     virtual bool Execute(void); | ||||
| }; | ||||
|  | ||||
| @@ -430,12 +577,13 @@ public: | ||||
| #define OGL_MAX_OSDIMAGES 256 | ||||
| #define OGL_CMDQUEUE_SIZE 100 | ||||
|  | ||||
| class cOglThread : public cThread { | ||||
| private: | ||||
|     cCondWait *startWait; | ||||
| class cOglThread:public cThread | ||||
| { | ||||
|   private: | ||||
|     cCondWait * startWait; | ||||
|     cCondWait *wait; | ||||
|     bool stalled; | ||||
|     std::queue<cOglCmd*> commands; | ||||
|      std::queue < cOglCmd * >commands; | ||||
|     GLint maxTextureSize; | ||||
|     sOglImage imageCache[OGL_MAX_OSDIMAGES]; | ||||
|     long memCached; | ||||
| @@ -449,73 +597,96 @@ private: | ||||
|     void Cleanup(void); | ||||
|     int GetFreeSlot(void); | ||||
|     void ClearSlot(int slot); | ||||
| protected: | ||||
|     virtual void Action(void); | ||||
| public: | ||||
|     cOglThread(cCondWait *startWait, int maxCacheSize); | ||||
|     virtual ~cOglThread(); | ||||
|   protected: | ||||
|      virtual void Action(void); | ||||
|   public: | ||||
|      cOglThread(cCondWait * startWait, int maxCacheSize); | ||||
|      virtual ~ cOglThread(); | ||||
|     void Stop(void); | ||||
|     void DoCmd(cOglCmd* cmd); | ||||
|     int StoreImage(const cImage &image); | ||||
|     void DoCmd(cOglCmd * cmd); | ||||
|     int StoreImage(const cImage & image); | ||||
|     void DropImageData(int imageHandle); | ||||
|     sOglImage *GetImageRef(int slot); | ||||
|     int MaxTextureSize(void) { return maxTextureSize; }; | ||||
|     int MaxTextureSize(void) | ||||
|     { | ||||
|         return maxTextureSize; | ||||
|     }; | ||||
| }; | ||||
|  | ||||
| /**************************************************************************************** | ||||
| * cOglPixmap | ||||
| ****************************************************************************************/ | ||||
| class cOglPixmap : public cPixmap { | ||||
| private: | ||||
|     cOglFb *fb; | ||||
|     std::shared_ptr<cOglThread> oglThread; | ||||
| class cOglPixmap:public cPixmap | ||||
| { | ||||
|   private: | ||||
|     cOglFb * fb; | ||||
|     std::shared_ptr < cOglThread > oglThread; | ||||
|     bool dirty; | ||||
| public: | ||||
|     cOglPixmap(std::shared_ptr<cOglThread> oglThread, int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); | ||||
|     virtual ~cOglPixmap(void); | ||||
|     cOglFb *Fb(void) { return fb; }; | ||||
|     int X(void) { return ViewPort().X(); }; | ||||
|     int Y(void) { return ViewPort().Y(); }; | ||||
|     virtual bool IsDirty(void) { return dirty; } | ||||
|     virtual void SetDirty(bool dirty = true) { this->dirty = dirty; } | ||||
|   public: | ||||
|      cOglPixmap(std::shared_ptr < cOglThread > oglThread, int Layer, const cRect & ViewPort, const cRect & DrawPort = | ||||
|         cRect::Null); | ||||
|      virtual ~ cOglPixmap(void); | ||||
|     cOglFb *Fb(void) | ||||
|     { | ||||
|         return fb; | ||||
|     }; | ||||
|     int X(void) | ||||
|     { | ||||
|         return ViewPort().X(); | ||||
|     }; | ||||
|     int Y(void) | ||||
|     { | ||||
|         return ViewPort().Y(); | ||||
|     }; | ||||
|     virtual bool IsDirty(void) | ||||
|     { | ||||
|         return dirty; | ||||
|     } | ||||
|     virtual void SetDirty(bool dirty = true) { | ||||
|         this->dirty = dirty; | ||||
|     } | ||||
|     virtual void SetAlpha(int Alpha); | ||||
|     virtual void SetTile(bool Tile); | ||||
|     virtual void SetViewPort(const cRect &Rect); | ||||
|     virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty = true); | ||||
|     virtual void SetViewPort(const cRect & Rect); | ||||
|     virtual void SetDrawPortPoint(const cPoint & Point, bool Dirty = true); | ||||
|     virtual void Clear(void); | ||||
|     virtual void Fill(tColor Color); | ||||
|     virtual void DrawImage(const cPoint &Point, const cImage &Image); | ||||
|     virtual void DrawImage(const cPoint &Point, int ImageHandle); | ||||
|     virtual void DrawPixel(const cPoint &Point, tColor Color); | ||||
|     virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false); | ||||
|     virtual void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault); | ||||
|     virtual void DrawRectangle(const cRect &Rect, tColor Color); | ||||
|     virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0); | ||||
|     virtual void DrawSlope(const cRect &Rect, tColor Color, int Type); | ||||
|     virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest); | ||||
|     virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest); | ||||
|     virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null); | ||||
|     virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null); | ||||
|     virtual void DrawImage(const cPoint & Point, const cImage & Image); | ||||
|     virtual void DrawImage(const cPoint & Point, int ImageHandle); | ||||
|     virtual void DrawPixel(const cPoint & Point, tColor Color); | ||||
|     virtual void DrawBitmap(const cPoint & Point, const cBitmap & Bitmap, tColor ColorFg = 0, tColor ColorBg = | ||||
|         0, bool Overlay = false); | ||||
|     virtual void DrawText(const cPoint & Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont * Font, | ||||
|         int Width = 0, int Height = 0, int Alignment = taDefault); | ||||
|     virtual void DrawRectangle(const cRect & Rect, tColor Color); | ||||
|     virtual void DrawEllipse(const cRect & Rect, tColor Color, int Quadrants = 0); | ||||
|     virtual void DrawSlope(const cRect & Rect, tColor Color, int Type); | ||||
|     virtual void Render(const cPixmap * Pixmap, const cRect & Source, const cPoint & Dest); | ||||
|     virtual void Copy(const cPixmap * Pixmap, const cRect & Source, const cPoint & Dest); | ||||
|     virtual void Scroll(const cPoint & Dest, const cRect & Source = cRect::Null); | ||||
|     virtual void Pan(const cPoint & Dest, const cRect & Source = cRect::Null); | ||||
| }; | ||||
|  | ||||
| /****************************************************************************** | ||||
| * cOglOsd | ||||
| ******************************************************************************/ | ||||
| class cOglOsd : public cOsd { | ||||
| private: | ||||
|     cOglFb *bFb; | ||||
|     std::shared_ptr<cOglThread> oglThread; | ||||
|     cVector<cOglPixmap *> oglPixmaps; | ||||
| class cOglOsd:public cOsd | ||||
| { | ||||
|   private: | ||||
|     cOglFb * bFb; | ||||
|     std::shared_ptr < cOglThread > oglThread; | ||||
|     cVector < cOglPixmap * >oglPixmaps; | ||||
|     bool isSubtitleOsd; | ||||
| protected: | ||||
| public: | ||||
|     cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread); | ||||
|     virtual ~cOglOsd(); | ||||
|     virtual eOsdError SetAreas(const tArea *Areas, int NumAreas); | ||||
|     virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); | ||||
|     virtual void DestroyPixmap(cPixmap *Pixmap); | ||||
|   protected: | ||||
|   public: | ||||
|      cOglOsd(int Left, int Top, uint Level, std::shared_ptr < cOglThread > oglThread); | ||||
|      virtual ~ cOglOsd(); | ||||
|     virtual eOsdError SetAreas(const tArea * Areas, int NumAreas); | ||||
|     virtual cPixmap *CreatePixmap(int Layer, const cRect & ViewPort, const cRect & DrawPort = cRect::Null); | ||||
|     virtual void DestroyPixmap(cPixmap * Pixmap); | ||||
|     virtual void Flush(void); | ||||
|     virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias = false); | ||||
|     virtual void DrawScaledBitmap(int x, int y, const cBitmap & Bitmap, double FactorX, double FactorY, | ||||
|         bool AntiAlias = false); | ||||
|     static cOglOutputFb *oFb; | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user