Mir
Loading...
Searching...
No Matches
mirbuffer.h
Go to the documentation of this file.
1/*
2 * Copyright © 2017-2020 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef MIROIL_GLBUFFER_H
18#define MIROIL_GLBUFFER_H
19
20#include <mir/geometry/size.h>
21#include <mir/version.h>
22#include <memory>
23
24#include <GL/gl.h>
25
26namespace mir { namespace graphics { class Buffer; }}
27
28namespace miroil
29{
31{
32public:
35 explicit GLBuffer(std::shared_ptr<mir::graphics::Buffer> const& buffer);
36
37 operator bool() const;
38 bool has_alpha_channel() const;
40
41 void reset();
42 void reset(std::shared_ptr<mir::graphics::Buffer> const& buffer);
43 void bind();
44#if MIR_SERVER_VERSION < MIR_VERSION_NUMBER(2, 3, 0)
45 void gl_bind_tex();
46#endif
47
48private:
49 void init();
50 void destroy();
51
52 std::shared_ptr<mir::graphics::Buffer> wrapped;
53 GLuint m_textureId;
54#if MIR_SERVER_VERSION < MIR_VERSION_NUMBER(2, 3, 0)
55 bool m_isOldTex = false;
56 bool m_inited = false;
57#endif
58};
59}
60
61#endif //MIROIL_GLBUFFER_H
Definition: mirbuffer.h:31
bool has_alpha_channel() const
mir::geometry::Size size() const
void reset(std::shared_ptr< mir::graphics::Buffer > const &buffer)
GLBuffer(std::shared_ptr< mir::graphics::Buffer > const &buffer)
Definition: splash_session.h:22
Definition: compositor.h:21
Definition: size.h:30

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue Nov 8 21:37:30 UTC 2022
This documentation is licensed under the GPL version 2 or 3.