Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QPLATFORMGRAPHICSBUFFER_H
6#define QPLATFORMGRAPHICSBUFFER_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the QPA API and is not meant to be used
13// in applications. Usage of this API may make your code
14// source and binary incompatible with future versions of Qt.
15//
16
17
18#include <QtGui/qtguiglobal.h>
19#include <QtCore/QSize>
20#include <QtCore/QRect>
21#include <QtGui/QPixelFormat>
22#include <QtCore/qflags.h>
23#include <QtCore/QObject>
24
26
28{
29Q_OBJECT
30public:
31 enum AccessType
32 {
33 None = 0x00,
34 SWReadAccess = 0x01,
35 SWWriteAccess = 0x02,
36 TextureAccess = 0x04,
37 HWCompositor = 0x08
38 };
39 Q_ENUM(AccessType)
40 Q_DECLARE_FLAGS(AccessTypes, AccessType)
41
42 enum Origin {
43 OriginBottomLeft,
44 OriginTopLeft
45 };
46 Q_ENUM(Origin)
47
48 ~QPlatformGraphicsBuffer();
49
50 AccessTypes isLocked() const { return m_lock_access; }
51 bool lock(AccessTypes access, const QRect &rect = QRect());
52 void unlock();
53
54 virtual bool bindToTexture(const QRect &rect = QRect()) const;
55
56 virtual const uchar *data() const;
57 virtual uchar *data();
58 virtual int bytesPerLine() const;
59 int byteCount() const;
60
61 virtual Origin origin() const;
62
63 QSize size() const { return m_size; }
64 QPixelFormat format() const { return m_format; }
65
66Q_SIGNALS:
67 void unlocked(AccessTypes previousAccessTypes);
68
69protected:
70 QPlatformGraphicsBuffer(const QSize &size, const QPixelFormat &format);
71
72 virtual bool doLock(AccessTypes access, const QRect &rect = QRect()) = 0;
73 virtual void doUnlock() = 0;
74
75private:
76 QSize m_size;
77 QPixelFormat m_format;
78 AccessTypes m_lock_access;
79};
80
81QT_END_NAMESPACE
82
83#endif //QPLATFORMGRAPHICSBUFFER_H
Combined button and popup list for selecting options.