From 7ee144ed7d88d4de010608d3a433e1b47343cd17 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 14 Sep 2010 14:21:25 +0200 Subject: Remove redundant code in SgImage -> VGImage conversion on Symbian. Calling the various Khronos getError() functions here is inefficient since it involves a round trip to the GPU and gains nothing since the null handle can be used to test for error conditions at no cost. Also no need to open the RSgDriver because we don't actually need to call any functions on RSgImage, just convert it. Reviewed-by: Alessandro Portale Reviewed-by: Jani Hautakangas --- src/openvg/qvg_symbian.cpp | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index 0e6e773..ef0160c 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -112,25 +112,8 @@ static VGImage sgImageToVGImage(QEglContext *context, const RSgImage &sgImage) VGImage vgImage = VG_INVALID_HANDLE; - TInt err = 0; - - RSgDriver driver; - err = driver.Open(); - if (err != KErrNone) { - return vgImage; - } - - if (sgImage.IsNull()) { - driver.Close(); - return vgImage; - } - - TSgImageInfo sgImageInfo; - err = sgImage.GetInfo(sgImageInfo); - if (err != KErrNone) { - driver.Close(); + if (sgImage.IsNull()) return vgImage; - } const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), @@ -139,22 +122,12 @@ static VGImage sgImageToVGImage(QEglContext *context, const RSgImage &sgImage) (EGLClientBuffer)&sgImage, (EGLint*)KEglImageAttribs); - if (!eglImage || eglGetError() != EGL_SUCCESS) { - driver.Close(); + if (!eglImage) return vgImage; - } vgImage = QVG::vgCreateEGLImageTargetKHR(eglImage); - if (!vgImage || vgGetError() != VG_NO_ERROR) { - QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); - driver.Close(); - return vgImage; - } - //setSerialNumber(++qt_vg_pixmap_serial); - // release stuff QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); - driver.Close(); return vgImage; } #endif -- cgit v0.12