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
qdirectfbbackingstore.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
6#include "qdirectfbblitter.h"
8#include "qdirectfbwindow.h"
9#include <private/qpixmap_blitter_p.h>
10
11#include <QtCore/qdebug.h>
12
14
16 : QPlatformBackingStore(window), m_pixmap(0), m_pmdata(0)
17{
18 IDirectFBWindow *dfbWindow = static_cast<QDirectFbWindow *>(window->handle())->dfbWindow();
19 dfbWindow->GetSurface(dfbWindow, m_dfbSurface.outPtr());
20
21//WRONGSIZE
22 QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface.data());
23 m_pmdata = new QDirectFbBlitterPlatformPixmap;
24 m_pmdata->setBlittable(blitter);
25 m_pixmap.reset(new QPixmap(m_pmdata));
26}
27
29{
30 return m_pixmap.data();
31}
32
34{
35 m_pmdata->blittable()->unlock();
36
37 for (const QRect &rect : region) {
38 DFBRegion dfbReg(rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y());
39 m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC));
40 }
41}
42
44{
45 Q_UNUSED(reg);
46
47 if ((m_pmdata->width() == size.width()) &&
48 (m_pmdata->height() == size.height()))
49 return;
50
51 QDirectFbBlitter *blitter = new QDirectFbBlitter(size, m_dfbSurface.data());
52 m_pmdata->setBlittable(blitter);
53}
54
55static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
56{
57 const DFBRectangle rect(r.x(), r.y(), r.width(), r.height());
58 surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy);
59 const DFBRegion region(rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy);
60 surface->Flip(surface, &region, DFBSurfaceFlipFlags(DSFLIP_BLIT));
61}
62
63bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy)
64{
65 m_pmdata->blittable()->unlock();
66
67 if (!m_dfbSurface || area.isEmpty())
68 return false;
69 m_dfbSurface->SetBlittingFlags(m_dfbSurface.data(), DSBLIT_NOFX);
70 if (area.rectCount() == 1) {
71 scrollSurface(m_dfbSurface.data(), area.boundingRect(), dx, dy);
72 } else {
73 for (const QRect &rect : area)
74 scrollSurface(m_dfbSurface.data(), rect, dx, dy);
75 }
76 return true;
77}
78
80{
81 return m_pixmap.data()->toImage();
82}
83
void setBlittable(QBlittable *blittable)
QBlittable * blittable() const
void unlock()
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
void resize(const QSize &size, const QRegion &staticContents) override
QDirectFbBackingStore(QWindow *window)
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
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.
\inmodule QtGui
Definition qimage.h:37
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
QImage toImage() const
Converts the pixmap to a QImage.
Definition qpixmap.cpp:408
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.
int height() const
int width() const
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
QSize size() const override
Returns the size of the window excluding any window frame.
Definition qwindow.h:210
rect
[4]
Combined button and popup list for selecting options.
static void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
static int area(const QSize &s)
Definition qicon.cpp:153
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLenum GLuint GLintptr offset
#define Q_UNUSED(x)
aWidget window() -> setWindowTitle("New Window Title")
[2]