2011-07-18 15:55:39 +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>
|
|
|
|
Copyright (C) 2011 Philipp Knechtges <philipp-dev@knechtges.com>
|
|
|
|
|
|
|
|
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_P_H
|
|
|
|
#define KWIN_GLTEXTURE_P_H
|
|
|
|
|
|
|
|
#include "kwinconfig.h" // KWIN_HAVE_OPENGL
|
|
|
|
#include "kwinglobals.h"
|
|
|
|
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QSize>
|
|
|
|
#include <QSharedData>
|
2013-02-26 07:02:27 +00:00
|
|
|
#include <QImage>
|
2011-07-18 15:55:39 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2013-02-26 07:02:27 +00:00
|
|
|
// forward declarations
|
|
|
|
class GLVertexBuffer;
|
2011-07-18 15:55:39 +00:00
|
|
|
|
|
|
|
class KWIN_EXPORT GLTexturePrivate
|
|
|
|
: public QSharedData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLTexturePrivate();
|
|
|
|
virtual ~GLTexturePrivate();
|
|
|
|
|
|
|
|
virtual void bind();
|
|
|
|
virtual void unbind();
|
2012-01-07 11:12:29 +00:00
|
|
|
virtual void onDamage();
|
2011-07-18 15:55:39 +00:00
|
|
|
|
|
|
|
QImage convertToGLFormat(const QImage& img) const;
|
|
|
|
|
2012-09-27 19:22:05 +00:00
|
|
|
void updateMatrix();
|
|
|
|
|
2011-07-18 15:55:39 +00:00
|
|
|
GLuint m_texture;
|
|
|
|
GLenum m_target;
|
|
|
|
GLenum m_filter;
|
2012-01-07 11:12:29 +00:00
|
|
|
GLenum m_wrapMode;
|
2011-07-18 15:55:39 +00:00
|
|
|
QSize m_size;
|
|
|
|
QSizeF m_scale; // to un-normalize GL_TEXTURE_2D
|
2012-09-27 19:22:05 +00:00
|
|
|
QMatrix4x4 m_matrix[2];
|
|
|
|
bool m_yInverted; // texture is y-inverted
|
2011-07-18 15:55:39 +00:00
|
|
|
bool m_canUseMipmaps;
|
2012-01-07 11:12:29 +00:00
|
|
|
bool m_markedDirty;
|
|
|
|
bool m_filterChanged;
|
|
|
|
bool m_wrapModeChanged;
|
2011-07-18 15:55:39 +00:00
|
|
|
|
|
|
|
int m_unnormalizeActive; // 0 - no, otherwise refcount
|
|
|
|
int m_normalizeActive; // 0 - no, otherwise refcount
|
|
|
|
GLVertexBuffer* m_vbo;
|
|
|
|
QSize m_cachedSize;
|
|
|
|
|
|
|
|
static void initStatic();
|
|
|
|
|
|
|
|
static bool sNPOTTextureSupported;
|
|
|
|
static bool sFramebufferObjectSupported;
|
|
|
|
static bool sSaturationSupported;
|
2013-02-27 07:41:08 +00:00
|
|
|
static bool sTextureFormatBGRA;
|
2011-07-18 15:55:39 +00:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(GLTexturePrivate)
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2011-08-31 16:16:21 +00:00
|
|
|
#endif
|