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
qplatformgraphicsbuffer.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#include <QtGui/QOpenGLContext>
6#include <QtGui/QOpenGLFunctions>
7#include <QtGui/qopengl.h>
8#include <QtCore/QDebug>
9
61 : m_size(size)
62 , m_format(format)
63{
64}
65
66
73
90{
92 return false;
93}
94
118{
119 bool locked = doLock(access, rect);
120 if (locked)
121 m_lock_access |= access;
122
123 return locked;
124}
125
133{
134 if (m_lock_access == None)
135 return;
136 AccessTypes previous = m_lock_access;
137 doUnlock();
138 m_lock_access = None;
139 emit unlocked(previous);
140}
141
142
180{ return nullptr; }
181
188{
189 return nullptr;
190}
191
199{
200 return size().height() * bytesPerLine();
201}
202
207{
208 return 0;
209}
210
211
223
237
238#include "moc_qplatformgraphicsbuffer.cpp"
\inmodule QtGui
virtual Origin origin() const
In origin of the content of the graphics buffer.
virtual bool bindToTexture(const QRect &rect=QRect()) const
Binds the content of this graphics buffer into the currently bound texture.
virtual const uchar * data() const
Accessor for the bytes of the buffer.
void unlocked(AccessTypes previousAccessTypes)
Signal that is emitted after unlocked has been called.
virtual int bytesPerLine() const
Accessor for bytes per line in the graphics buffer.
virtual bool doLock(AccessTypes access, const QRect &rect=QRect())=0
This function should be reimplemented by subclasses.
~QPlatformGraphicsBuffer()
Virtual destructor.
QPlatformGraphicsBuffer(const QSize &size, const QPixelFormat &format)
Protected constructor to initialize the private members.
bool lock(AccessTypes access, const QRect &rect=QRect())
Before the data can be retrieved or before a buffer can be bound to a texture it needs to be locked.
QSize size() const
Accessor for content size.
void unlock()
Unlocks the current buffer lock.
Origin
This enum describes the origin of the content of the buffer.
int byteCount() const
Accessor for the length of the data buffer.
virtual void doUnlock()=0
This function should remove all locks set on the buffer.
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
rect
[4]
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum access
GLint GLsizei GLsizei GLenum format
#define emit
#define Q_UNUSED(x)
unsigned char uchar
Definition qtypes.h:32