summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-12-09 23:28:04 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-12-09 23:28:04 (GMT)
commit16de24d638deafb6e985b531fdf0c15691c0b7b4 (patch)
tree068df00a6bbe20aa86cc85b1e1bc55d3d509e8d6 /src
parent293db01f907ad8644e8242055521e6b8e7c4dfec (diff)
downloadQt-16de24d638deafb6e985b531fdf0c15691c0b7b4.zip
Qt-16de24d638deafb6e985b531fdf0c15691c0b7b4.tar.gz
Qt-16de24d638deafb6e985b531fdf0c15691c0b7b4.tar.bz2
Recreate VGImage properly in out of memory case
If vgCreateImage() runs out of memory, then the drawPixmap() will fail. But previously, it would also prevent future attempts to call vgImageSubData() to populate the data when memory was present. Task-number: QTBUG-6639 Reviewed-by: Sarah Smith
Diffstat (limited to 'src')
-rw-r--r--src/openvg/qpixmapdata_vg.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index 5d5fcbf..af6f0f0 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -250,6 +250,10 @@ VGImage QVGPixmapData::toVGImage()
if (vgImage == VG_INVALID_HANDLE) {
vgImage = vgCreateImage
(VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+
+ // Bail out if we run out of GPU memory - try again next time.
+ if (vgImage == VG_INVALID_HANDLE)
+ return VG_INVALID_HANDLE;
}
if (!source.isNull() && recreate) {
@@ -280,6 +284,10 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
if (vgImageOpacity == VG_INVALID_HANDLE) {
vgImageOpacity = vgCreateImage
(VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+
+ // Bail out if we run out of GPU memory - try again next time.
+ if (vgImageOpacity == VG_INVALID_HANDLE)
+ return VG_INVALID_HANDLE;
}
VGfloat matrix[20] = {
1.0f, 0.0f, 0.0f, 0.0f,