2011-06-22 10:55:04 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee>
|
|
|
|
Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_GLTEXTURE_H
|
|
|
|
#define KWIN_GLTEXTURE_H
|
|
|
|
|
|
|
|
#include "kwinglobals.h"
|
|
|
|
|
|
|
|
#include <QtCore/QSize>
|
2011-07-18 15:55:39 +00:00
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QExplicitlySharedDataPointer>
|
2011-06-22 10:55:04 +00:00
|
|
|
|
|
|
|
class QImage;
|
|
|
|
class QPixmap;
|
|
|
|
|
|
|
|
/** @addtogroup kwineffects */
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class GLVertexBuffer;
|
2011-07-18 15:55:39 +00:00
|
|
|
class GLTexturePrivate;
|
2011-06-22 10:55:04 +00:00
|
|
|
|
|
|
|
class KWIN_EXPORT GLTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLTexture();
|
2011-07-18 15:55:39 +00:00
|
|
|
GLTexture(const GLTexture& tex);
|
2011-06-22 10:55:04 +00:00
|
|
|
explicit GLTexture(const QImage& image, GLenum target = GL_TEXTURE_2D);
|
|
|
|
explicit GLTexture(const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D);
|
|
|
|
GLTexture(const QString& fileName);
|
|
|
|
GLTexture(int width, int height);
|
|
|
|
virtual ~GLTexture();
|
|
|
|
|
2011-07-18 15:55:39 +00:00
|
|
|
GLTexture & operator = (const GLTexture& tex);
|
|
|
|
|
2011-06-22 10:55:04 +00:00
|
|
|
bool isNull() const;
|
|
|
|
QSize size() const;
|
2011-07-18 15:55:39 +00:00
|
|
|
int width() const;
|
|
|
|
int height() const;
|
2011-07-03 07:30:38 +00:00
|
|
|
/**
|
|
|
|
* @since 4.7
|
|
|
|
**/
|
|
|
|
bool isYInverted() const;
|
2011-07-18 15:55:39 +00:00
|
|
|
/**
|
|
|
|
* @since 4.8
|
|
|
|
**/
|
|
|
|
void setYInverted(bool inverted);
|
2011-06-22 10:55:04 +00:00
|
|
|
|
|
|
|
virtual bool load(const QImage& image, GLenum target = GL_TEXTURE_2D);
|
|
|
|
virtual bool load(const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D);
|
|
|
|
virtual bool load(const QString& fileName);
|
|
|
|
virtual void discard();
|
2011-07-18 15:55:39 +00:00
|
|
|
void bind();
|
|
|
|
void unbind();
|
2011-06-22 10:55:04 +00:00
|
|
|
void render(QRegion region, const QRect& rect);
|
|
|
|
|
|
|
|
GLuint texture() const;
|
|
|
|
GLenum target() const;
|
|
|
|
GLenum filter() const;
|
2012-01-07 21:26:50 +00:00
|
|
|
bool isDirty() const;
|
2011-06-22 10:55:04 +00:00
|
|
|
void setFilter(GLenum filter);
|
|
|
|
void setWrapMode(GLenum mode);
|
2012-01-07 21:26:50 +00:00
|
|
|
void setDirty();
|
2011-06-22 10:55:04 +00:00
|
|
|
|
2011-07-18 15:55:39 +00:00
|
|
|
static bool NPOTTextureSupported();
|
|
|
|
static bool framebufferObjectSupported();
|
|
|
|
static bool saturationSupported();
|
2011-06-22 10:55:04 +00:00
|
|
|
|
|
|
|
protected:
|
2011-07-18 15:55:39 +00:00
|
|
|
QExplicitlySharedDataPointer<GLTexturePrivate> d_ptr;
|
|
|
|
GLTexture(GLTexturePrivate& dd);
|
2011-06-22 10:55:04 +00:00
|
|
|
|
|
|
|
private:
|
2011-08-27 07:31:38 +00:00
|
|
|
Q_DECLARE_PRIVATE(GLTexture)
|
2011-06-22 10:55:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#endif
|