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
qhaikurasterbackingstore.cpp
Go to the documentation of this file.
1// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias Koenig <tobias.koenig@kdab.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6
7#include <Bitmap.h>
8#include <View.h>
9
11
13 : QPlatformBackingStore(window)
14 , m_bitmap(nullptr)
15{
16}
17
19{
20 delete m_bitmap;
21 m_bitmap = nullptr;
22}
23
25{
26 if (!m_bufferSize.isEmpty() && m_bitmap)
27 return m_buffer.image();
28
29 return nullptr;
30}
31
32void QHaikuRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
33{
34 Q_UNUSED(region);
35 Q_UNUSED(offset);
36
37 if (!window)
38 return;
39
40 QHaikuRasterWindow *targetWindow = static_cast<QHaikuRasterWindow*>(window->handle());
41
42 BView *view = targetWindow->nativeViewHandle();
43
44 view->LockLooper();
45 view->DrawBitmap(m_bitmap);
46 view->UnlockLooper();
47}
48
49void QHaikuRasterBackingStore::resize(const QSize &size, const QRegion &staticContents)
50{
51 Q_UNUSED(staticContents);
52
53 if (m_bufferSize == size)
54 return;
55
56 delete m_bitmap;
57 m_bitmap = new BBitmap(BRect(0, 0, size.width(), size.height()), B_RGB32, false, true);
58 m_buffer = QHaikuBuffer(m_bitmap);
59 m_bufferSize = size;
60}
61
62QT_END_NAMESPACE
void resize(const QSize &size, const QRegion &staticContents) override
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
\inmodule QtGui
Definition qwindow.h:63