C

qnxwindow.cpp Example File

telltales/qnx/qnxwindow.cpp
/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Safe Renderer module ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/
#include "qnxwindow.h" RasterWindow::RasterWindow(const QSafeSize &size) :AbstractWindow(size) ,m_buffer(size.width(), size.height(), SCREEN_FORMAT_RGBA8888, &m_screen_ctx) ,m_size(size) { int rect[4] = { 0, 0, (int)size.width(), (int)size.height() }; screen_create_window(&m_window, m_screen_ctx); int pipeline = 2; screen_set_window_property_iv(m_window, SCREEN_PROPERTY_PIPELINE, &pipeline); int usage = SCREEN_USAGE_OVERLAY; screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &usage); int format = SCREEN_FORMAT_RGBA8888; screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, &format); screen_create_window_buffers(m_window, 1); screen_get_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, rect+2); } void RasterWindow::render() { screen_buffer_t screen_buf[2]; int rect[4] = { 0, 0, (int)m_size.width(), (int)m_size.height() }; screen_get_window_property_pv(m_window, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)screen_buf); int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, SCREEN_BLIT_END }; screen_fill(m_screen_ctx, screen_buf[0], bg); int hg[] = { SCREEN_BLIT_SOURCE_WIDTH, (int)m_size.width(), SCREEN_BLIT_SOURCE_HEIGHT, (int)m_size.height(), SCREEN_BLIT_DESTINATION_X, 0, SCREEN_BLIT_DESTINATION_Y, 0, SCREEN_BLIT_DESTINATION_WIDTH, (int)m_size.width(), SCREEN_BLIT_DESTINATION_HEIGHT, (int)m_size.height(), SCREEN_BLIT_TRANSPARENCY, SCREEN_TRANSPARENCY_SOURCE_OVER, SCREEN_BLIT_END }; screen_blit(m_screen_ctx, screen_buf[0], m_buffer.buffer(), hg); screen_flush_blits(m_screen_ctx, SCREEN_WAIT_IDLE); screen_post_window(m_window, screen_buf[0], 1, rect, 0); }

Available under certain Qt licenses.
Find out more.