From 57c847ed2c0b4116ea791828c41db5edc40fe2f2 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 5 Mar 2010 12:39:17 +1000 Subject: Make the star example recreate its path if the VG context is destroyed. Task-number: QT-2809 Reviewed-by: trustme --- examples/openvg/star/starwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/openvg/star/starwidget.cpp b/examples/openvg/star/starwidget.cpp index bde0719..794ede9 100644 --- a/examples/openvg/star/starwidget.cpp +++ b/examples/openvg/star/starwidget.cpp @@ -93,8 +93,9 @@ void StarWidget::paintEvent(QPaintEvent *) // and prepare to perform raw OpenVG calls. painter.beginNativePainting(); - // Cache the path if we haven't already. - if (path == VG_INVALID_HANDLE) { + // Cache the path if we haven't already or if the path has + // become invalid because the window's context has changed. + if (path == VG_INVALID_HANDLE || !vgGetPathCapabilities(path)) { path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, // scale -- cgit v0.12