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
qqnxrasterbackingstore.cpp
Go to the documentation of this file.
1// Copyright (C) 2011 - 2013 BlackBerry Limited. All rights reserved.
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 "qqnxrasterwindow.h"
6#include "qqnxscreen.h"
7#include "qqnxglobal.h"
8
9#include <QtCore/QDebug>
10
11#include <errno.h>
12
14
17 m_needsPosting(false),
18 m_scrolled(false)
19{
20 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window;
21
22 m_window = window;
23}
24
26{
27 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window();
28}
29
31{
32 if (platformWindow() && platformWindow()->hasBuffers())
33 return platformWindow()->renderBuffer().image();
34
35 return 0;
36}
37
39{
41
42 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << this->window();
43
44 // Sometimes this method is called even though there is nothing to be
45 // flushed (posted in "screen" parlance), for instance, after an expose
46 // event directly follows a geometry change event.
47 if (!m_needsPosting)
48 return;
49
50 auto *targetWindow = window
51 ? static_cast<QQnxRasterWindow *>(window->handle()) : platformWindow();
52
53 if (targetWindow)
54 targetWindow->post(region); // update the display with newly rendered content
55
56 m_needsPosting = false;
57 m_scrolled = false;
58}
59
60void QQnxRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
61{
63 Q_UNUSED(staticContents);
64 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window() << ", s =" << size;
65
66 // NOTE: defer resizing window buffers until next paint as
67 // resize() can be called multiple times before a paint occurs
68}
69
70bool QQnxRasterBackingStore::scroll(const QRegion &area, int dx, int dy)
71{
72 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window();
73
74 m_needsPosting = true;
75
76 if (!m_scrolled) {
77 platformWindow()->scroll(area, dx, dy, true);
78 m_scrolled = true;
79 return true;
80 }
81 return false;
82}
83
85{
86 Q_UNUSED(region);
87
88 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window();
89 m_needsPosting = true;
90
91 platformWindow()->adjustBufferSize();
92
93 if (window()->requestedFormat().alphaBufferSize() > 0) {
94 auto platformScreen = static_cast<QQnxScreen *>(platformWindow()->screen());
95 for (const QRect &r : region) {
96 // Clear transparent regions
97 const int bg[] = {
98 SCREEN_BLIT_COLOR, 0x00000000,
99 SCREEN_BLIT_DESTINATION_X, r.x(),
100 SCREEN_BLIT_DESTINATION_Y, r.y(),
101 SCREEN_BLIT_DESTINATION_WIDTH, r.width(),
102 SCREEN_BLIT_DESTINATION_HEIGHT, r.height(),
103 SCREEN_BLIT_END
104 };
105 Q_SCREEN_CHECKERROR(screen_fill(platformScreen->nativeContext(),
106 platformWindow()->renderBuffer().nativeBuffer(), bg),
107 "failed to clear transparent regions");
108 }
109 Q_SCREEN_CHECKERROR(screen_flush_blits(platformScreen->nativeContext(),
110 SCREEN_WAIT_IDLE), "failed to flush blits");
111 }
112}
113
115{
116 qCDebug(lcQpaBackingStore) << Q_FUNC_INFO << "w =" << window();
117}
118
119QQnxRasterWindow *QQnxRasterBackingStore::platformWindow() const
120{
121 Q_ASSERT(m_window->handle());
122 return static_cast<QQnxRasterWindow*>(m_window->handle());
123}
124
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.
\inmodule QtCore\reentrant
Definition qpoint.h:25
const QImage * image() const
Definition qqnxbuffer.h:25
void beginPaint(const QRegion &region) override
This function is called before painting onto the surface begins, with the region in which the paintin...
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
void resize(const QSize &size, const QRegion &staticContents) override
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.
QQnxRasterBackingStore(QWindow *window)
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
void endPaint() override
This function is called after painting onto the surface has ended.
QQnxBuffer & renderBuffer()
void scroll(const QRegion &region, int dx, int dy, bool flush=false)
QPlatformScreen * screen() const override
Returns the platform screen handle corresponding to this platform window, or null if the window is no...
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
#define Q_FUNC_INFO
static int area(const QSize &s)
Definition qicon.cpp:153
#define qCDebug(category,...)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLenum GLuint GLintptr offset
#define Q_SCREEN_CHECKERROR(x, message)
Definition qqnxglobal.h:13
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_UNUSED(x)
aWidget window() -> setWindowTitle("New Window Title")
[2]