Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qminimaleglbackingstore.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtGui/QOpenGLContext>
7#include <QtOpenGL/QOpenGLPaintDevice>
8
10
13 , m_context(new QOpenGLContext)
14 , m_device(nullptr)
15{
16 m_context->setFormat(window->requestedFormat());
17 m_context->setScreen(window->screen());
18 m_context->create();
19}
20
25
30
32{
33 Q_UNUSED(region);
35
36#ifdef QEGL_EXTRA_DEBUG
37 qWarning("QEglBackingStore::flush %p", window);
38#endif
39
40 m_context->swapBuffers(window);
41}
42
44{
45 m_context->makeCurrent(window());
46 m_device = new QOpenGLPaintDevice(window()->size());
47}
48
50{
51 delete m_device;
52}
53
54void QMinimalEglBackingStore::resize(const QSize &size, const QRegion &staticContents)
55{
57 Q_UNUSED(staticContents);
58}
59
void endPaint() override
This function is called after painting onto the surface has ended.
void resize(const QSize &size, const QRegion &staticContents) override
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
void beginPaint(const QRegion &) override
This function is called before painting onto the surface begins, with the region in which the paintin...
\inmodule QtGui
bool create()
Attempts to create the OpenGL context with the current configuration.
void setScreen(QScreen *screen)
Sets the screen the OpenGL context should be valid for.
bool makeCurrent(QSurface *surface)
Makes the context current in the current thread, against the given surface.
void setFormat(const QSurfaceFormat &format)
Sets the format the OpenGL context should be compatible with.
void swapBuffers(QSurface *surface)
Swap the back and front buffers of surface.
The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter.
The QPlatformBackingStore class provides the drawing area for top-level windows.
QWindow * window() const
Returns a pointer to the top-level window associated with this surface.
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
#define qWarning
Definition qlogging.h:166
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
#define Q_UNUSED(x)
QObject::connect nullptr
aWidget window() -> setWindowTitle("New Window Title")
[2]