コード例 #1
0
static void bb10display_destroyWindow(BB10Display *d) {
    if (!d->window_created) {
        ms_warning("[bb10_display] screen wasn't created yet, skipping...");
        return;
    }

    screen_destroy_window_buffers(d->window);
    screen_destroy_window(d->window);
    d->window = NULL;

    d->window_created = FALSE;
    ms_debug("[bb10_display] bb10display_destroyWindow window destroyed");
}
コード例 #2
0
ファイル: qqnxrootwindow.cpp プロジェクト: cedrus/qt
void QQnxRootWindow::makeTranslucent()
{
    if (m_translucent)
        return;

    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);
    if (result != 0) {
        qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno);
    }

    m_translucent = true;
    post();
}
コード例 #3
0
ファイル: BlackberryDisplay.cpp プロジェクト: Bublafus/native
void BlackberryMain::killDisplay(int idx, bool killContext) {
	if (egl_disp[idx] != EGL_NO_DISPLAY) {
		if (killContext)
			eglMakeCurrent(egl_disp[idx], EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
		if (egl_surf[idx] != EGL_NO_SURFACE) {
			eglDestroySurface(egl_disp[idx], egl_surf[idx]);
			egl_surf[idx] = EGL_NO_SURFACE;
		}
		if (killContext)
		{
			eglTerminate(egl_disp[idx]);
			egl_disp[idx] = EGL_NO_DISPLAY;
		}
	}
	if (killContext && screen_win[idx] != NULL) {
		screen_destroy_window(screen_win[idx]);
		screen_win[idx] = NULL;
	}
	screen_destroy_window_buffers(screen_win[idx]);
}
コード例 #4
0
ファイル: ScreenWindow.cpp プロジェクト: asimonov-im/reztest
void ScreenWindow::setVideoMode(int width, int height)
{
	if (m_window) {
		screen_destroy_window(m_window);
		m_window = 0;
	}
	if (!m_window) {
		screen_create_window_type(&m_window, m_context, SCREEN_CHILD_WINDOW);
		char groupName[256];
		snprintf(groupName, 256, "screen-%d", getpid());
		screen_join_window_group(m_window, groupName);
	} else {
		screen_destroy_window_buffers(m_window);
	}

	m_width = width;
	m_height = height;

//#define NOSTRETCH
#define STRETCH_PRESERVE_ASPECT
#ifdef NOSTRETCH
	int position[2] = {ceil((1024-width)/2), ceil((600-height)/2)};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, position);

	int sizeOfWindow[2] = {width, height};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, sizeOfWindow);

	int sizeOfBuffer[2] = {width, height};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, sizeOfBuffer);
#elif defined(STRETCH_PRESERVE_ASPECT)
	width = ceil(width * 600 / height);
	height = 600;

	int position[2] = {ceil((1024-width)/2), ceil((600-height)/2)};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_POSITION, position);

	int sizeOfWindow[2] = {width, height};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, sizeOfWindow);

	int sizeOfBuffer[2] = {m_width, m_height}; // OLD DIMS
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, sizeOfBuffer);
#else
	int sizeOfWindow[2] = {1024, 600};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, sizeOfWindow);

	int sizeOfBuffer[2] = {width, height};
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, sizeOfBuffer);
#endif

	int zOrder = 1;
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ZORDER, &zOrder);

	int format = SCREEN_FORMAT_RGBX8888;
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, &format);

	int usage = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE;
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &usage);

	int angle = 0;
	char *orientation = getenv("ORIENTATION");
	if (orientation) {
		 angle = atoi(orientation);
	}
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ROTATION, &angle);

	int visible = 1;
	screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &visible);

	screen_create_window_buffers(m_window, 1);
}
コード例 #5
0
ファイル: qqnxwindow.cpp プロジェクト: venkatarajasekhar/Qt
void QQnxWindow::setBufferSize(const QSize &size)
{
    qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "size =" << size;

    // libscreen fails when creating empty buffers
    const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size;
    int format = pixelFormat();

    if (nonEmptySize == m_bufferSize || format == -1)
        return;

    Q_SCREEN_CRITICALERROR(
            screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, &format),
            "Failed to set window format");

    if (m_bufferSize.isValid()) {
        // destroy buffers first, if resized
        Q_SCREEN_CRITICALERROR(screen_destroy_window_buffers(m_window),
                               "Failed to destroy window buffers");
    }

    int val[2] = { nonEmptySize.width(), nonEmptySize.height() };
    Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val),
                        "Failed to set window buffer size");

    Q_SCREEN_CRITICALERROR(screen_create_window_buffers(m_window, MAX_BUFFER_COUNT),
                           "Failed to create window buffers");

    // check if there are any buffers available
    int bufferCount = 0;
    Q_SCREEN_CRITICALERROR(
        screen_get_window_property_iv(m_window, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount),
        "Failed to query render buffer count");

    if (bufferCount != MAX_BUFFER_COUNT) {
        qFatal("QQnxWindow: invalid buffer count. Expected = %d, got = %d.",
                MAX_BUFFER_COUNT, bufferCount);
    }

    // Set the transparency. According to QNX technical support, setting the window
    // transparency property should always be done *after* creating the window
    // buffers in order to guarantee the property is paid attention to.
    if (window()->requestedFormat().alphaBufferSize() == 0) {
        // To avoid overhead in the composition manager, disable blending
        // when the underlying window buffer doesn't have an alpha channel.
        val[0] = SCREEN_TRANSPARENCY_NONE;
    } else {
        // Normal alpha blending. This doesn't commit us to translucency; the
        // normal backfill during the painting will contain a fully opaque
        // alpha channel unless the user explicitly intervenes to make something
        // transparent.
        val[0] = SCREEN_TRANSPARENCY_SOURCE_OVER;
    }

    Q_SCREEN_CHECKERROR(screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val),
                        "Failed to set window transparency");

    // Cache new buffer size
    m_bufferSize = nonEmptySize;
    resetBuffers();
}