File indexing completed on 2024-11-10 04:56:57

0001 /*
0002     SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
0003     SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "opengl/glutils.h"
0011 
0012 class QMatrix4x4;
0013 
0014 namespace KWin
0015 {
0016 
0017 class ContrastShader
0018 {
0019 public:
0020     ContrastShader();
0021 
0022     void init();
0023     void setColorMatrix(const QMatrix4x4 &matrix);
0024     void setTextureMatrix(const QMatrix4x4 &matrix);
0025     void setModelViewProjectionMatrix(const QMatrix4x4 &matrix);
0026     void setOpacity(float opacity);
0027 
0028     float opacity() const;
0029     bool isValid() const;
0030 
0031     void bind();
0032     void unbind();
0033 
0034 protected:
0035     void setIsValid(bool value);
0036     void reset();
0037 
0038 private:
0039     bool m_valid;
0040     std::unique_ptr<GLShader> m_shader;
0041     int m_mvpMatrixLocation;
0042     int m_textureMatrixLocation;
0043     int m_colorMatrixLocation;
0044     int m_opacityLocation;
0045     float m_opacity;
0046 };
0047 
0048 } // namespace KWin