kwin/libkwineffects/kwingltexture_p.h
Philipp Knechtges 87bcabdf99 kwin: improving the texture update handling
This patch changes the behavior of strictly bound textures such that
they are only updated if the corresponding window has been damaged.
Additionally GLTexture now keeps track of the current filter and
wrapmode setting.

REVIEW: 103655
2012-01-31 23:09:58 +01:00

77 lines
2.2 KiB
C++

/********************************************************************
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"
#include <QtCore/QSize>
#include <QtCore/QSharedData>
namespace KWin
{
class KWIN_EXPORT GLTexturePrivate
: public QSharedData
{
public:
GLTexturePrivate();
virtual ~GLTexturePrivate();
virtual void bind();
virtual void unbind();
virtual void release();
virtual void onDamage();
QImage convertToGLFormat(const QImage& img) const;
GLuint m_texture;
GLenum m_target;
GLenum m_filter;
GLenum m_wrapMode;
QSize m_size;
QSizeF m_scale; // to un-normalize GL_TEXTURE_2D
bool m_yInverted; // texture has y inverted
bool m_canUseMipmaps;
bool m_markedDirty;
bool m_filterChanged;
bool m_wrapModeChanged;
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;
private:
Q_DISABLE_COPY(GLTexturePrivate)
};
} // namespace
#endif