diff options
Diffstat (limited to 'src/openvg/qpixmapdata_vg.cpp')
-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 53f6b4c..e66d80b 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); @@ -465,23 +465,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; } @@ -489,9 +490,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; } @@ -502,17 +503,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(QEgl::display(), eglImage); - SgDriver::Close(); + driver.Close(); return; } @@ -526,7 +527,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) setSerialNumber(++qt_vg_pixmap_serial); // release stuff eglDestroyImageKHR(QEgl::display(), eglImage); - SgDriver::Close(); + driver.Close(); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); @@ -584,29 +585,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; } @@ -614,8 +611,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; } @@ -625,17 +622,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(QEgl::display(), eglImage); sgImage->Close(); - SgDriver::Close(); + driver.Close(); return 0; } @@ -643,14 +640,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(QEgl::display(), eglImage); - SgDriver::Close(); + driver.Close(); return reinterpret_cast<void*>(sgImage); } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); |