本文整理汇总了C++中QEglProperties::removeValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QEglProperties::removeValue方法的具体用法?C++ QEglProperties::removeValue怎么用?C++ QEglProperties::removeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QEglProperties
的用法示例。
在下文中一共展示了QEglProperties::removeValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: windowSurfaceSize
QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
{
QSize newSize = windowSurfaceSize(widget);
QEglProperties surfaceProps;
#if defined(QVG_RECREATE_ON_SIZE_CHANGE)
#if !defined(QVG_NO_SINGLE_CONTEXT)
if (context && size != newSize) {
// The surface size has changed, so we need to recreate it.
// We can keep the same context and paint engine.
size = newSize;
if (isPaintingActive)
context->doneCurrent();
context->destroySurface(windowSurface);
#if defined(EGL_VG_ALPHA_FORMAT_PRE_BIT)
if (isPremultipliedContext(context)) {
surfaceProps.setValue
(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
} else {
surfaceProps.removeValue(EGL_VG_ALPHA_FORMAT);
}
#endif
windowSurface = context->createSurface(widget, &surfaceProps);
isPaintingActive = false;
needToSwap = true;
}
#else
if (context && size != newSize) {
// The surface size has changed, so we need to recreate
// the EGL context for the widget. We also need to recreate
// the surface's paint engine if context sharing is not
// enabled because we cannot reuse the existing paint objects
// in the new context.
qt_vg_destroy_paint_engine(engine);
engine = 0;
context->destroySurface(windowSurface);
qt_vg_destroy_context(context, QInternal::Widget);
context = 0;
windowSurface = EGL_NO_SURFACE;
}
#endif
#endif
if (!context) {
// Create a new EGL context and bind it to the widget surface.
size = newSize;
context = qt_vg_create_context(widget, QInternal::Widget);
if (!context)
return 0;
// We want a direct to window rendering surface if possible.
#if defined(QVG_DIRECT_TO_WINDOW)
surfaceProps.setValue(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
#endif
#if defined(EGL_VG_ALPHA_FORMAT_PRE_BIT)
if (isPremultipliedContext(context)) {
surfaceProps.setValue
(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE);
} else {
surfaceProps.removeValue(EGL_VG_ALPHA_FORMAT);
}
#endif
EGLSurface surface = context->createSurface(widget, &surfaceProps);
if (surface == EGL_NO_SURFACE) {
qt_vg_destroy_context(context, QInternal::Widget);
context = 0;
return 0;
}
needToSwap = true;
#if defined(QVG_DIRECT_TO_WINDOW)
// Did we get a direct to window rendering surface?
EGLint buffer = 0;
if (eglQueryContext(QEgl::display(), context->context(),
EGL_RENDER_BUFFER, &buffer) &&
buffer == EGL_SINGLE_BUFFER) {
needToSwap = false;
}
#endif
windowSurface = surface;
isPaintingActive = false;
}
#if !defined(QVG_NO_PRESERVED_SWAP)
// Try to force the surface back buffer to preserve its contents.
if (needToSwap) {
eglGetError(); // Clear error state first.
eglSurfaceAttrib(QEgl::display(), windowSurface,
EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
if (eglGetError() != EGL_SUCCESS) {
qWarning("QVG: could not enable preserved swap");
}
}
#endif
return context;
}