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
qxcbbackingstore.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#pragma once
6
7#include <qpa/qplatformbackingstore.h>
8#include <QtCore/QStack>
9
10#include <xcb/xcb.h>
11
12#include "qxcbobject.h"
13
15
17
19{
20public:
21 QXcbBackingStore(QWindow *window);
23
24 QPaintDevice *paintDevice() override;
25 void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
26 FlushResult rhiFlush(QWindow *window,
27 qreal sourceDevicePixelRatio,
28 const QRegion &region,
29 const QPoint &offset,
30 QPlatformTextureList *textures,
31 bool translucentBackground,
32 qreal sourceTransformFactor) override;
33 QImage toImage() const override;
34
36
37 void resize(const QSize &size, const QRegion &staticContents) override;
38 bool scroll(const QRegion &area, int dx, int dy) override;
39
40 void beginPaint(const QRegion &) override;
41 void endPaint() override;
42
43 static bool createSystemVShmSegment(xcb_connection_t *c, size_t segmentSize = 1,
44 void *shmInfo = nullptr);
45
46protected:
47 virtual void render(xcb_window_t window, const QRegion &region, const QPoint &offset);
48 virtual void recreateImage(QXcbWindow *win, const QSize &size);
49
53};
54
56{
57public:
58 QXcbSystemTrayBackingStore(QWindow *window);
60
61 void beginPaint(const QRegion &) override;
62
63protected:
64 void render(xcb_window_t window, const QRegion &region, const QPoint &offset) override;
65 void recreateImage(QXcbWindow *win, const QSize &size) override;
66
67private:
68 void initXRenderMode();
69
70 xcb_pixmap_t m_xrenderPixmap = XCB_NONE;
71 xcb_render_picture_t m_xrenderPicture = XCB_NONE;
72 xcb_render_pictformat_t m_xrenderPictFormat = XCB_NONE;
73 xcb_render_picture_t m_windowPicture = XCB_NONE;
74
75 bool m_usingXRenderMode = false;
76 bool m_useGrabbedBackgound = false;
77 QPixmap m_grabbedBackground;
78};
79
80QT_END_NAMESPACE
QPainter(QPaintDevice *)
Constructs a painter that begins painting the paint device immediately.
QRect window() const
Returns the window rectangle.
void flushScrolledRegion(bool clientSideScroll)
QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size)
void put(xcb_drawable_t dst, const QRegion &region, const QPoint &offset)
void resize(const QSize &size)
void preparePaint(const QRegion &region)
QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size, uint depth, QImage::Format format)
QPlatformGraphicsBuffer * graphicsBuffer()
bool scroll(const QRegion &area, int dx, int dy)
static bool createSystemVShmSegment(xcb_connection_t *c, size_t segmentSize=1, xcb_shm_segment_info_t *shm_info=nullptr)
QXcbBackingStoreImage * m_image
QPlatformGraphicsBuffer * graphicsBuffer() const override
Accessor for a backingstores graphics buffer abstraction.
void resize(const QSize &size, const QRegion &staticContents) override
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
QXcbBackingStore(QWindow *window)
void endPaint() override
This function is called after painting onto the surface has ended.
virtual void render(xcb_window_t window, const QRegion &region, const QPoint &offset)
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
FlushResult rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion &region, const QPoint &offset, QPlatformTextureList *textures, bool translucentBackground, qreal sourceTransformFactor) override
Flushes the given region from the specified window, and compositing it with the specified textures li...
void beginPaint(const QRegion &) override
This function is called before painting onto the surface begins, with the region in which the paintin...
virtual void recreateImage(QXcbWindow *win, const QSize &size)
QStack< QRegion > m_paintRegions
static bool createSystemVShmSegment(xcb_connection_t *c, size_t segmentSize=1, void *shmInfo=nullptr)
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
bool scroll(const QRegion &area, int dx, int dy) override
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.
uchar * data() override
Accessor for the bytes of the buffer.
QXcbGraphicsBuffer(QImage *image)
const uchar * data() const override
Accessor for the bytes of the buffer.
int bytesPerLine() const override
Accessor for bytes per line in the graphics buffer.
Origin origin() const override
In origin of the content of the graphics buffer.
bool doLock(AccessTypes access, const QRect &rect) override
This function should be reimplemented by subclasses.
void doUnlock() override
This function should remove all locks set on the buffer.
QXcbConnection * connection() const
Definition qxcbobject.h:17
xcb_connection_t * xcb_connection() const
Definition qxcbobject.h:20
void setConnection(QXcbConnection *connection)
Definition qxcbobject.h:16
void render(xcb_window_t window, const QRegion &region, const QPoint &offset) override
void beginPaint(const QRegion &) override
This function is called before painting onto the surface begins, with the region in which the paintin...
void recreateImage(QXcbWindow *win, const QSize &size) override
QXcbSystemTrayBackingStore(QWindow *window)
#define MAP_FAILED
static void copy_swapped(char *dst, const int dstStride, const QImage &img, const QRect &rect)
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
static QImage native_sub_image(QByteArray *buffer, const int dstStride, const QImage &src, const QRect &rect, bool swap)
static quint32 round_up_scanline(quint32 base, quint32 pad)
static void copy_unswapped(char *dst, int dstBytesPerLine, const QImage &img, const QRect &rect)
static size_t imageDataSize(const xcb_image_t *image)
#define Q_XCB_REPLY(call,...)
#define Q_XCB_REPLY_UNCHECKED(call,...)