diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2014-11-13 21:37:54 -0500 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-11-15 12:17:43 +0100 |
commit | dce9610afed674ecec23497a1a004193a6cf3bf1 (patch) | |
tree | 7b0e2063667645ae3a4259a08c0ab1d2fce0eaf1 /vcl/inc/opengl/texture.hxx | |
parent | 330b7b310193f3290cbd4c340659f72d12c352e1 (diff) |
vcl: Improve OpenGLTexture implementation by allowing implicit sharing
Conflicts:
vcl/opengl/gdiimpl.cxx
Change-Id: I6421265325e72023d1affe671d75488185772786
Diffstat (limited to 'vcl/inc/opengl/texture.hxx')
-rw-r--r-- | vcl/inc/opengl/texture.hxx | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx index c0b6541d7700..eb003cfe5b96 100644 --- a/vcl/inc/opengl/texture.hxx +++ b/vcl/inc/opengl/texture.hxx @@ -20,37 +20,62 @@ #ifndef INCLUDED_VCL_INC_OPENGL_TEXTURE_H #define INCLUDED_VCL_INC_OPENGL_TEXTURE_H -#include <boost/shared_ptr.hpp> #include <GL/glew.h> +#include <vcl/dllapi.h> -class OpenGLTexture +class ImplOpenGLTexture { -private: +public: + int mnRefCount; GLuint mnTexture; int mnWidth; int mnHeight; GLenum mnFilter; -public: - OpenGLTexture(); - OpenGLTexture( int nWidth, int nHeight ); - OpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData ); - OpenGLTexture( int nX, int nY, int nWidth, int nHeight ); - virtual ~OpenGLTexture(); - - GLuint Id() const; - int GetWidth() const; - int GetHeight() const; - - void Bind(); - void Unbind(); - bool Draw(); - - GLenum GetFilter() const; - void SetFilter( GLenum nFilter ); + ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate ); + ImplOpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData ); + ImplOpenGLTexture( int nX, int nY, int nWidth, int nHeight ); + ~ImplOpenGLTexture(); }; -typedef boost::shared_ptr< OpenGLTexture > OpenGLTextureSharedPtr; +class VCL_PLUGIN_PUBLIC OpenGLTexture +{ +private: + // if the rect size doesn't match the mpImpl one, this instance + // is a sub-area from the real OpenGL texture + Rectangle maRect; + + ImplOpenGLTexture* mpImpl; + +public: + OpenGLTexture(); + OpenGLTexture( int nWidth, int nHeight, bool bAllocate = true ); + OpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData ); + OpenGLTexture( int nX, int nY, int nWidth, int nHeight ); + OpenGLTexture( const OpenGLTexture& rTexture ); + OpenGLTexture( const OpenGLTexture& rTexture, int nX, int nY, int nWidth, int nHeight ); + virtual ~OpenGLTexture(); + + bool IsUnique() const; + + GLuint Id() const; + int GetWidth() const; + int GetHeight() const; + void GetCoord( GLfloat* pCoord, const SalTwoRect& rPosAry, bool bInverted=false ) const; + + void Bind(); + void Unbind(); + bool Draw(); + void Read( GLenum nFormat, GLenum nType, sal_uInt8* pData ); + + GLenum GetFilter() const; + void SetFilter( GLenum nFilter ); + + operator bool() const; + OpenGLTexture& operator=( const OpenGLTexture& rTexture ); + bool operator==( const OpenGLTexture& rTexture ) const; + bool operator!=( const OpenGLTexture& rTexture ) const; +}; #endif // INCLUDED_VCL_INC_OPENGL_TEXTURE_H |