4#include <QtGui/qpa/qplatformgraphicsbuffer.h>
7#include <QtCore/QDebug>
8#include <QtGui/qopengl.h>
10#include <QtGui/QOpenGLContext>
11#include <QtGui/QOpenGLFunctions>
13#ifndef GL_UNPACK_ROW_LENGTH
14#define GL_UNPACK_ROW_LENGTH 0x0CF2
18#define GL_RGB10_A2 0x8059
21#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
22#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
59 bool *
swizzle,
bool *premultiplied,
64 qWarning(
"Failed to bind %sgraphicsbuffer to texture",
"");
70 *premultiplied =
false;
73 qWarning(
"Failed to bind %sgraphicsbuffer to texture",
"SW ");
109 bool *swizzleRandB,
bool *premultipliedB,
110 const QRect &subRect)
127 bool needsConversion =
false;
129 bool premultiplied =
false;
132 switch (imageformat) {
134 premultiplied =
true;
141 premultiplied =
true;
148 if (!
ctx->isOpenGLES() ||
ctx->format().majorVersion() >= 3) {
151 premultiplied =
true;
153 needsConversion =
true;
158 if (!
ctx->isOpenGLES() ||
ctx->format().majorVersion() >= 3) {
161 premultiplied =
true;
164 needsConversion =
true;
168 needsConversion =
true;
171 if (!needsConversion &&
image.bytesPerLine() != (
size.width() * 4) &&
ctx->isOpenGLES() &&
ctx->format().majorVersion() < 3)
172 needsConversion =
true;
176 bool needsRowLength = (
image.bytesPerLine() !=
image.width() * 4);
187 if (!
ctx->isOpenGLES() ||
ctx->format().majorVersion() >= 3) {
197 if (
rect.width() >=
size.width() / 2) {
205 if (
rect.width() ==
image.bytesPerLine() / 4) {
217 *premultipliedB = premultiplied;
Format
The following image formats are available in Qt.
@ Format_RGBA8888_Premultiplied
@ Format_A2BGR30_Premultiplied
@ Format_ARGB32_Premultiplied
@ Format_A2RGB30_Premultiplied
static QImage::Format toImageFormat(QPixelFormat format) noexcept
Converts format into a QImage::Format.
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
static VulkanServerBufferGlFunctions * funcs
Combined button and popup list for selecting options.
static bool contains(const QJsonArray &haystack, unsigned needle)
typedef GLint(GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC)(GLuint program
GLenum GLuint GLintptr GLsizeiptr size
[1]
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLsizei GLenum internalFormat