summaryrefslogtreecommitdiffstats
path: root/src/openvg/qpixmapdata_vg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvg/qpixmapdata_vg.cpp')
-rw-r--r--src/openvg/qpixmapdata_vg.cpp259
1 files changed, 0 insertions, 259 deletions
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index a4afc95..cb413d0 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -48,15 +48,6 @@
#include "qvg_p.h"
#include "qvgimagepool_p.h"
-#if defined(Q_OS_SYMBIAN)
-#include <private/qt_s60_p.h>
-#include <fbs.h>
-#endif
-#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
-#include <sgresource/sgimage.h>
-typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR);
-#endif // QT_SYMBIAN_SUPPORTS_SGIMAGE
-
QT_BEGIN_NAMESPACE
static int qt_vg_pixmap_serial = 0;
@@ -421,254 +412,4 @@ Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap)
return VG_INVALID_HANDLE;
}
-#if defined(Q_OS_SYMBIAN)
-
-static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap)
-{
- CFbsBitmap *copy = q_check_ptr(new CFbsBitmap);
- if(!copy)
- return 0;
-
- if (copy->Create(bitmap->SizeInPixels(), bitmap->DisplayMode()) != KErrNone) {
- delete copy;
- copy = 0;
-
- return 0;
- }
-
- CFbsBitmapDevice* bitmapDevice = 0;
- CFbsBitGc *bitmapGc = 0;
- QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(copy));
- QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
- bitmapGc->Activate(bitmapDevice);
-
- bitmapGc->BitBlt(TPoint(), bitmap);
-
- delete bitmapGc;
- delete bitmapDevice;
-
- return copy;
-}
-
-void QVGPixmapData::cleanup()
-{
- is_null = w = h = 0;
- recreate = false;
- source = QImage();
-}
-
-void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
-{
- if (type == QPixmapData::SgImage && pixmap) {
-#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
- RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmap);
-
- destroyImages();
- prevSize = QSize();
-
- TInt err = 0;
-
- RSgDriver driver;
- err = driver.Open();
- if (err != KErrNone) {
- cleanup();
- return;
- }
-
- if (sgImage->IsNull()) {
- cleanup();
- driver.Close();
- return;
- }
-
- TSgImageInfo sgImageInfo;
- err = sgImage->GetInfo(sgImageInfo);
- if (err != KErrNone) {
- cleanup();
- driver.Close();
- return;
- }
-
- pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
-
- if (eglGetError() != EGL_SUCCESS || !(QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) || !vgCreateEGLImageTargetKHR) {
- cleanup();
- driver.Close();
- return;
- }
-
- const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
- EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(),
- EGL_NO_CONTEXT,
- EGL_NATIVE_PIXMAP_KHR,
- (EGLClientBuffer)sgImage,
- (EGLint*)KEglImageAttribs);
-
- if (eglGetError() != EGL_SUCCESS) {
- cleanup();
- driver.Close();
- return;
- }
-
- vgImage = vgCreateEGLImageTargetKHR(eglImage);
- if (vgGetError() != VG_NO_ERROR) {
- cleanup();
- QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
- driver.Close();
- return;
- }
-
- w = sgImageInfo.iSizeInPixels.iWidth;
- h = sgImageInfo.iSizeInPixels.iHeight;
- d = 32; // We always use ARGB_Premultiplied for VG pixmaps.
- is_null = (w <= 0 || h <= 0);
- source = QImage();
- recreate = false;
- prevSize = QSize(w, h);
- setSerialNumber(++qt_vg_pixmap_serial);
- // release stuff
- QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
- driver.Close();
-#endif
- } else if (type == QPixmapData::FbsBitmap) {
- CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap);
-
- bool deleteSourceBitmap = false;
-
-#ifdef Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
-
- // Rasterize extended bitmaps
-
- TUid extendedBitmapType = bitmap->ExtendedBitmapType();
- if (extendedBitmapType != KNullUid) {
- bitmap = createBlitCopy(bitmap);
- deleteSourceBitmap = true;
- }
-#endif
-
- if (bitmap->IsCompressedInRAM()) {
- bitmap = createBlitCopy(bitmap);
- deleteSourceBitmap = true;
- }
-
- TDisplayMode displayMode = bitmap->DisplayMode();
- QImage::Format format = qt_TDisplayMode2Format(displayMode);
-
- TSize size = bitmap->SizeInPixels();
-
- bitmap->BeginDataAccess();
- uchar *bytes = (uchar*)bitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
- img = img.copy();
- bitmap->EndDataAccess();
-
- if(displayMode == EGray2) {
- //Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
- //So invert mono bitmaps so that masks work correctly.
- img.invertPixels();
- } else if(displayMode == EColor16M) {
- img = img.rgbSwapped(); // EColor16M is BGR
- }
-
- fromImage(img, Qt::AutoColor);
-
- if(deleteSourceBitmap)
- delete bitmap;
- }
-}
-
-void* QVGPixmapData::toNativeType(NativeType type)
-{
- if (type == QPixmapData::SgImage) {
-#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL)
- toVGImage();
-
- if (!isValid() || vgImage == VG_INVALID_HANDLE)
- return 0;
-
- TInt err = 0;
-
- RSgDriver driver;
- err = driver.Open();
- if (err != KErrNone)
- return 0;
-
- TSgImageInfo sgInfo;
- sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
- sgInfo.iSizeInPixels.SetSize(w, h);
- sgInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
-
- RSgImage *sgImage = q_check_ptr(new RSgImage());
- err = sgImage->Create(sgInfo, NULL, NULL);
- if (err != KErrNone) {
- driver.Close();
- return 0;
- }
-
- pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
-
- if (eglGetError() != EGL_SUCCESS || !(QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) || !vgCreateEGLImageTargetKHR) {
- driver.Close();
- return 0;
- }
-
- const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
- EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(),
- EGL_NO_CONTEXT,
- EGL_NATIVE_PIXMAP_KHR,
- (EGLClientBuffer)sgImage,
- (EGLint*)KEglImageAttribs);
- if (eglGetError() != EGL_SUCCESS) {
- sgImage->Close();
- driver.Close();
- return 0;
- }
-
- VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage);
- if (vgGetError() != VG_NO_ERROR) {
- QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
- sgImage->Close();
- driver.Close();
- return 0;
- }
-
- vgCopyImage(dstVgImage, 0, 0,
- vgImage, 0, 0,
- w, h, VG_FALSE);
-
- if (vgGetError() != VG_NO_ERROR) {
- sgImage->Close();
- sgImage = 0;
- }
- // release stuff
- vgDestroyImage(dstVgImage);
- QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
- driver.Close();
- return reinterpret_cast<void*>(sgImage);
-#endif
- } else if (type == QPixmapData::FbsBitmap) {
- CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap);
-
- if (bitmap) {
- if (bitmap->Create(TSize(source.width(), source.height()),
- EColor16MAP) == KErrNone) {
- const uchar *sptr = source.constBits();
- bitmap->BeginDataAccess();
-
- uchar *dptr = (uchar*)bitmap->DataAddress();
- Mem::Copy(dptr, sptr, source.byteCount());
-
- bitmap->EndDataAccess();
- } else {
- delete bitmap;
- bitmap = 0;
- }
- }
-
- return reinterpret_cast<void*>(bitmap);
- }
- return 0;
-}
-#endif //Q_OS_SYMBIAN
-
QT_END_NAMESPACE