diff options
author | Jason Barron <jbarron@trolltech.com> | 2010-03-19 14:50:29 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2010-03-19 15:05:32 (GMT) |
commit | 9842e2f79923d32b6240ce938560a6f3116fa9aa (patch) | |
tree | e70b54216cdb6568340d8204e0364bc3e88294c0 /src/openvg | |
parent | 681f54aabb89309b66ee4e5b229d7d1fd2e0e78d (diff) | |
download | Qt-9842e2f79923d32b6240ce938560a6f3116fa9aa.zip Qt-9842e2f79923d32b6240ce938560a6f3116fa9aa.tar.gz Qt-9842e2f79923d32b6240ce938560a6f3116fa9aa.tar.bz2 |
Change fromSymbianRSgImage() to use the newer version of RSgImage
Symbian have changed the implementation of RSgImage to be more
lightweight and have moved it to a new library. This patch changes Qt's
usage of RSgImage to the new version and fixes some minor code style
issues.
Reviewed-by: Aleksandar Sasha Babic
Diffstat (limited to 'src/openvg')
-rw-r--r-- | src/openvg/qpixmapdata_vg.cpp | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 15a2712..cb5255d 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -45,10 +45,10 @@ #include "qvg_p.h" #include "qvgimagepool_p.h" -#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE #include <private/qt_s60_p.h> #include <fbs.h> -#include <graphics/sgimage.h> +#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE +#include <sgresource/sgimage.h> typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); typedef EGLBoolean (*pfnEglDestroyImageKHR)(EGLDisplay, EGLImageKHR); typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR); @@ -473,23 +473,24 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) TInt err = 0; - err = SgDriver::Open(); - if(err != KErrNone) { + RSgDriver driver; + err = driver.Open(); + if (err != KErrNone) { cleanup(); return; } - if(sgImage->IsNull()) { + if (sgImage->IsNull()) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } TSgImageInfo sgImageInfo; err = sgImage->GetInfo(sgImageInfo); - if(err != KErrNone) { + if (err != KErrNone) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } @@ -497,9 +498,9 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { + if (eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } @@ -510,17 +511,17 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) (EGLClientBuffer)sgImage, (EGLint*)KEglImageAttribs); - if(eglGetError() != EGL_SUCCESS) { + if (eglGetError() != EGL_SUCCESS) { cleanup(); - SgDriver::Close(); + driver.Close(); return; } vgImage = vgCreateEGLImageTargetKHR(eglImage); - if(vgGetError() != VG_NO_ERROR) { + if (vgGetError() != VG_NO_ERROR) { cleanup(); eglDestroyImageKHR(QEglContext::display(), eglImage); - SgDriver::Close(); + driver.Close(); return; } @@ -534,7 +535,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) setSerialNumber(++qt_vg_pixmap_serial); // release stuff eglDestroyImageKHR(QEglContext::display(), eglImage); - SgDriver::Close(); + driver.Close(); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); @@ -592,29 +593,25 @@ void* QVGPixmapData::toNativeType(NativeType type) if (type == QPixmapData::SgImage) { toVGImage(); - if(!isValid() || vgImage == VG_INVALID_HANDLE) + if (!isValid() || vgImage == VG_INVALID_HANDLE) return 0; TInt err = 0; - err = SgDriver::Open(); - if(err != KErrNone) + RSgDriver driver; + err = driver.Open(); + if (err != KErrNone) return 0; TSgImageInfo sgInfo; sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE; sgInfo.iSizeInPixels.SetSize(w, h); - sgInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget; - sgInfo.iShareable = ETrue; - sgInfo.iCpuAccess = ESgCpuAccessNone; - sgInfo.iScreenId = KSgScreenIdMain; //KSgScreenIdAny; - sgInfo.iUserAttributes = NULL; - sgInfo.iUserAttributeCount = 0; + sgInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface; RSgImage *sgImage = q_check_ptr(new RSgImage()); err = sgImage->Create(sgInfo, NULL, NULL); - if(err != KErrNone) { - SgDriver::Close(); + if (err != KErrNone) { + driver.Close(); return 0; } @@ -622,8 +619,8 @@ void* QVGPixmapData::toNativeType(NativeType type) pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - if(eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { - SgDriver::Close(); + if (eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) { + driver.Close(); return 0; } @@ -633,17 +630,17 @@ void* QVGPixmapData::toNativeType(NativeType type) EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, (EGLint*)KEglImageAttribs); - if(eglGetError() != EGL_SUCCESS) { + if (eglGetError() != EGL_SUCCESS) { sgImage->Close(); - SgDriver::Close(); + driver.Close(); return 0; } VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); - if(vgGetError() != VG_NO_ERROR) { + if (vgGetError() != VG_NO_ERROR) { eglDestroyImageKHR(QEglContext::display(), eglImage); sgImage->Close(); - SgDriver::Close(); + driver.Close(); return 0; } @@ -651,14 +648,14 @@ void* QVGPixmapData::toNativeType(NativeType type) vgImage, 0, 0, w, h, VG_FALSE); - if(vgGetError() != VG_NO_ERROR) { + if (vgGetError() != VG_NO_ERROR) { sgImage->Close(); sgImage = 0; } // release stuff vgDestroyImage(dstVgImage); eglDestroyImageKHR(QEglContext::display(), eglImage); - SgDriver::Close(); + driver.Close(); return reinterpret_cast<void*>(sgImage); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); |