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.h
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
4#ifndef QPLATFORMGRAPHICSBUFFER_H
5#define QPLATFORMGRAPHICSBUFFER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16
17#include <QtGui/qtguiglobal.h>
18#include <QtCore/QSize>
19#include <QtCore/QRect>
20#include <QtGui/QPixelFormat>
21#include <QtCore/qflags.h>
22#include <QtCore/QObject>
23
25
26class Q_GUI_EXPORT QPlatformGraphicsBuffer : public QObject
27{
29public:
31 {
32 None = 0x00,
33 SWReadAccess = 0x01,
34 SWWriteAccess = 0x02,
35 TextureAccess = 0x04,
36 HWCompositor = 0x08
37 };
40
41 enum Origin {
43 OriginTopLeft
44 };
46
48
49 AccessTypes isLocked() const { return m_lock_access; }
50 bool lock(AccessTypes access, const QRect &rect = QRect());
51 void unlock();
52
53 virtual bool bindToTexture(const QRect &rect = QRect()) const;
54
55 virtual const uchar *data() const;
56 virtual uchar *data();
57 virtual int bytesPerLine() const;
58 int byteCount() const;
59
60 virtual Origin origin() const;
61
62 QSize size() const { return m_size; }
63 QPixelFormat format() const { return m_format; }
64
66 void unlocked(AccessTypes previousAccessTypes);
67
68protected:
70
71 virtual bool doLock(AccessTypes access, const QRect &rect = QRect()) = 0;
72 virtual void doUnlock() = 0;
73
74private:
75 QSize m_size;
76 QPixelFormat m_format;
77 AccessTypes m_lock_access;
78};
79
81
82#endif //QPLATFORMGRAPHICSBUFFER_H
\inmodule QtCore
Definition qobject.h:103
\inmodule QtGui
AccessType
This enum describes the access that is desired or granted for the graphics buffer.
void unlocked(AccessTypes previousAccessTypes)
Signal that is emitted after unlocked has been called.
virtual bool doLock(AccessTypes access, const QRect &rect=QRect())=0
This function should be reimplemented by subclasses.
Q_DECLARE_FLAGS(AccessTypes, AccessType)
AccessTypes isLocked() const
Function to check if the buffer is locked.
QPixelFormat format() const
Accessor for the pixel format of the buffer.
QSize size() const
Accessor for content size.
Origin
This enum describes the origin of the content of the 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
rect
[4]
Combined button and popup list for selecting options.
@ None
Definition qhash.cpp:531
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum access
GLint GLsizei GLsizei GLenum format
#define Q_OBJECT
#define Q_SIGNALS
unsigned char uchar
Definition qtypes.h:32
QReadWriteLock lock
[0]
mutex unlock()