2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2020-07-22 17:29:23 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2020-07-22 17:29:23 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2020-07-22 17:29:23 +00:00
|
|
|
|
|
|
|
#include "kwineglimagetexture.h"
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <epoxy/egl.h>
|
|
|
|
|
2020-08-21 10:32:04 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2020-07-22 17:29:23 +00:00
|
|
|
EGLImageTexture::EGLImageTexture(EGLDisplay display, EGLImage image, int internalFormat, const QSize &size)
|
|
|
|
: GLTexture(internalFormat, size, 1, true)
|
|
|
|
, m_image(image)
|
|
|
|
, m_display(display)
|
|
|
|
{
|
|
|
|
if (m_image == EGL_NO_IMAGE_KHR) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bind();
|
|
|
|
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_image);
|
|
|
|
}
|
|
|
|
|
|
|
|
EGLImageTexture::~EGLImageTexture()
|
|
|
|
{
|
|
|
|
eglDestroyImageKHR(m_display, m_image);
|
|
|
|
}
|
2020-08-21 10:32:04 +00:00
|
|
|
|
|
|
|
} // namespace KWin
|