diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2024-10-02 09:57:19 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2024-11-29 15:07:14 +0100 |
commit | 577946c1f05aaaa2a3f9682001aeb4144386b26b (patch) | |
tree | ca8d724b6411b744d6ce9e3b7d7e93386a2ed7f3 /src/opengl/qopenglframebufferobject.cpp | |
parent | 7539b659d9ffbb3c44e45bdb7d9669a6df8915c8 (diff) |
Add Qt::Orientations based flip and flipped functions
Is easier to read and more bool-trap safe. Old form header deprecated from 6.10 Fixes: QTBUG-129575 Change-Id: Id785b9ce159007ce745c04120b2112c8bb9b0802 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/opengl/qopenglframebufferobject.cpp')
-rw-r--r-- | src/opengl/qopenglframebufferobject.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp index 5c8f769d399..cd329ba03aa 100644 --- a/src/opengl/qopenglframebufferobject.cpp +++ b/src/opengl/qopenglframebufferobject.cpp @@ -1418,30 +1418,31 @@ static QImage qt_gl_read_framebuffer(const QSize &size, GLenum internal_format, if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST) break; } + Qt::Orientations orient = flip ? Qt::Vertical : Qt::Orientations{}; switch (internal_format) { case GL_RGB: case GL_RGB8: - return qt_gl_read_framebuffer_rgba8(size, false, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba8(size, false, ctx).flipped(orient); case GL_RGB10: - return qt_gl_read_framebuffer_rgb10a2(size, false, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgb10a2(size, false, ctx).flipped(orient); case GL_RGB10_A2: - return qt_gl_read_framebuffer_rgb10a2(size, include_alpha, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgb10a2(size, include_alpha, ctx).flipped(orient); case GL_RGB16: - return qt_gl_read_framebuffer_rgba16(size, false, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba16(size, false, ctx).flipped(orient); case GL_RGBA16: - return qt_gl_read_framebuffer_rgba16(size, include_alpha, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba16(size, include_alpha, ctx).flipped(orient); case GL_RGB16F: - return qt_gl_read_framebuffer_rgba16f(size, false, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba16f(size, false, ctx).flipped(orient); case GL_RGBA16F: - return qt_gl_read_framebuffer_rgba16f(size, include_alpha, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba16f(size, include_alpha, ctx).flipped(orient); case GL_RGB32F: - return qt_gl_read_framebuffer_rgba32f(size, false, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba32f(size, false, ctx).flipped(orient); case GL_RGBA32F: - return qt_gl_read_framebuffer_rgba32f(size, include_alpha, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba32f(size, include_alpha, ctx).flipped(orient); case GL_RGBA: case GL_RGBA8: default: - return qt_gl_read_framebuffer_rgba8(size, include_alpha, ctx).mirrored(false, flip); + return qt_gl_read_framebuffer_rgba8(size, include_alpha, ctx).flipped(orient); } Q_UNREACHABLE_RETURN(QImage()); |