KWin
Loading...
Searching...
No Matches
rendertarget.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "core/rendertarget.h"
8#include "opengl/glutils.h"
9
10namespace KWin
11{
12
14 : m_framebuffer(fbo)
15 , m_transform(fbo->colorAttachment() ? fbo->colorAttachment()->contentTransform() : OutputTransform())
16 , m_colorDescription(colorDescription)
17{
18}
19
20RenderTarget::RenderTarget(QImage *image, const ColorDescription &colorDescription)
21 : m_image(image)
22 , m_colorDescription(colorDescription)
23{
24}
25
26QSize RenderTarget::size() const
27{
28 if (m_framebuffer) {
29 return m_framebuffer->size();
30 } else if (m_image) {
31 return m_image->size();
32 } else {
33 Q_UNREACHABLE();
34 }
35}
36
38{
39 return m_transform;
40}
41
43{
44 return m_framebuffer;
45}
46
48{
49 return m_framebuffer->colorAttachment();
50}
51
52QImage *RenderTarget::image() const
53{
54 return m_image;
55}
56
58{
59 return m_colorDescription;
60}
61
62} // namespace KWin
OpenGL framebuffer object.
QSize size() const
GLTexture * colorAttachment() const
GLFramebuffer * framebuffer() const
QSize size() const
GLTexture * texture() const
RenderTarget(GLFramebuffer *fbo, const ColorDescription &colorDescription=ColorDescription::sRGB)
QImage * image() const
const ColorDescription & colorDescription() const
OutputTransform transform() const