[QNX]Fix transparencies
It is not guaranteed that buffers are cleared when they are allocated. So don't use a buffer for the root window, and clear buffers for the actual content. Change-Id: I42939baec03fa05968c83bbf2739ab8d1d70c8be Reviewed-by: Matt Hoosier <matt.hoosier@garmin.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
parent
9d0b190f4b
commit
5680484476
@ -188,35 +188,8 @@ void QQnxRootWindow::makeTranslucent()
|
||||
int result;
|
||||
|
||||
errno = 0;
|
||||
result = screen_destroy_window_buffers(m_window);
|
||||
if (result != 0) {
|
||||
qFatal("QQnxRootWindow: failed to destroy window buffer, errno=%d", errno);
|
||||
}
|
||||
|
||||
QRect geometry = m_screen->geometry();
|
||||
errno = 0;
|
||||
int val[2];
|
||||
val[0] = geometry.width();
|
||||
val[1] = geometry.height();
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val);
|
||||
if (result != 0) {
|
||||
qFatal("QQnxRootWindow: failed to set window buffer size, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_create_window_buffers(m_window, 1);
|
||||
if (result != 0) {
|
||||
qFatal("QQNX: failed to create window buffer, errno=%d", errno);
|
||||
}
|
||||
|
||||
// Install an alpha channel on the root window.
|
||||
//
|
||||
// This is necessary in order to avoid interfering with any particular
|
||||
// toplevel widget's QQnxWindow window instance from showing transparent
|
||||
// if it desires.
|
||||
errno = 0;
|
||||
val[0] = SCREEN_TRANSPARENCY_SOURCE_OVER;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val);
|
||||
const int val = SCREEN_TRANSPARENCY_DISCARD;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
|
||||
if (result != 0) {
|
||||
qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno);
|
||||
}
|
||||
|
@ -418,15 +418,27 @@ QQnxBuffer &QQnxWindow::renderBuffer()
|
||||
// Get all buffers available for rendering
|
||||
errno = 0;
|
||||
screen_buffer_t buffers[MAX_BUFFER_COUNT];
|
||||
const int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
|
||||
int result = screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
|
||||
if (result != 0)
|
||||
qFatal("QQnxWindow: failed to query window buffers, errno=%d", errno);
|
||||
|
||||
// Wrap each buffer
|
||||
// Wrap each buffer and clear
|
||||
for (int i = 0; i < MAX_BUFFER_COUNT; ++i) {
|
||||
m_buffers[i] = QQnxBuffer(buffers[i]);
|
||||
|
||||
// Clear Buffer
|
||||
errno = 0;
|
||||
int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, SCREEN_BLIT_END };
|
||||
result = screen_fill(m_screen->nativeContext(), buffers[i], bg);
|
||||
if (result != 0)
|
||||
qFatal("QQnxWindow: failed to clear window buffer, errno=%d", errno);
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_flush_blits(m_screen->nativeContext(), 0);
|
||||
if (result != 0)
|
||||
qFatal("QQnxWindow: failed to flush blits, errno=%d", errno);
|
||||
|
||||
// Use the first available render buffer
|
||||
m_currentBufferIndex = 0;
|
||||
m_previousBufferIndex = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user