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

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "plugins/screencast/screencastdmabuftexture.h"
0008 #include "core/graphicsbuffer.h"
0009 #include "opengl/glutils.h"
0010 
0011 namespace KWin
0012 {
0013 
0014 ScreenCastDmaBufTexture::ScreenCastDmaBufTexture(std::shared_ptr<GLTexture> texture, GraphicsBuffer *buffer)
0015     : m_texture(texture)
0016     , m_framebuffer(std::make_unique<GLFramebuffer>(texture.get()))
0017     , m_buffer(buffer)
0018 {
0019 }
0020 ScreenCastDmaBufTexture::~ScreenCastDmaBufTexture()
0021 {
0022     m_framebuffer.reset();
0023     m_texture.reset();
0024     m_buffer->drop();
0025 }
0026 
0027 GraphicsBuffer *ScreenCastDmaBufTexture::buffer() const
0028 {
0029     return m_buffer;
0030 }
0031 
0032 KWin::GLTexture *ScreenCastDmaBufTexture::texture() const
0033 {
0034     return m_texture.get();
0035 }
0036 
0037 KWin::GLFramebuffer *ScreenCastDmaBufTexture::framebuffer() const
0038 {
0039     return m_framebuffer.get();
0040 }
0041 
0042 } // namespace KWin