summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2010-06-17 06:33:58 (GMT)
committerJason Barron <jbarron@trolltech.com>2010-07-12 07:03:16 (GMT)
commitedd3ffa92df8c6e0fb68f3eb6e10872e69532c90 (patch)
tree0972c59c53b47b1b31ad1a3cb6a2d58ecdda6e6c /src/openvg
parent3606cd38f7fbcfb9a9d6cb43d5a99da65891e0b1 (diff)
downloadQt-edd3ffa92df8c6e0fb68f3eb6e10872e69532c90.zip
Qt-edd3ffa92df8c6e0fb68f3eb6e10872e69532c90.tar.gz
Qt-edd3ffa92df8c6e0fb68f3eb6e10872e69532c90.tar.bz2
Convert to new EGL API.
Recent changes in Qt's EGL layer required some changes in the code used to convert RSgImage to/from VGImage. Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/qvg_symbian.cpp85
-rw-r--r--src/openvg/qvgfontglyphcache_p.h4
2 files changed, 42 insertions, 47 deletions
diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp
index 214fedf..9bcb6f5 100644
--- a/src/openvg/qvg_symbian.cpp
+++ b/src/openvg/qvg_symbian.cpp
@@ -43,22 +43,35 @@
#include "qvgfontglyphcache_p.h"
#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
-#include <private/qt_s60_p.h>
-#include <fbs.h>
-#include <gdi.h>
-#include <sgresource/sgimage.h>
-typedef EGLImageKHR (*pfnEglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*);
-typedef EGLBoolean (*pfnEglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
-typedef VGImage (*pfnVgCreateEGLImageTargetKHR)(VGeglImageKHR);
-#ifdef SYMBIAN_GDI_GLYPHDATA // defined in gdi.h
-#define QT_SYMBIAN_HARDWARE_GLYPH_CACHE
-#include <graphics/glyphdataiterator.h>
-#include <private/qfontengine_s60_p.h>
-#endif
+# include <private/qt_s60_p.h>
+# include <fbs.h>
+# include <gdi.h>
+# include <sgresource/sgimage.h>
+# ifdef SYMBIAN_GDI_GLYPHDATA // defined in gdi.h
+# define QT_SYMBIAN_HARDWARE_GLYPH_CACHE
+# include <graphics/glyphdataiterator.h>
+# include <private/qfontengine_s60_p.h>
+# endif
#endif
QT_BEGIN_NAMESPACE
+typedef VGImage (*_vgCreateEGLImageTargetKHR)(VGeglImageKHR);
+static _vgCreateEGLImageTargetKHR qt_vgCreateEGLImageTargetKHR = 0;
+
+namespace QVG
+{
+ VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR eglImage);
+}
+
+VGImage QVG::vgCreateEGLImageTargetKHR(VGeglImageKHR eglImage)
+{
+ if (!qt_vgCreateEGLImageTargetKHR && QEgl::hasExtension("EGL_KHR_image"))
+ qt_vgCreateEGLImageTargetKHR = (_vgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
+
+ return qt_vgCreateEGLImageTargetKHR ? qt_vgCreateEGLImageTargetKHR(eglImage) : 0;
+}
+
extern int qt_vg_pixmap_serial;
static CFbsBitmap* createBlitCopy(CFbsBitmap* bitmap)
@@ -117,37 +130,28 @@ static VGImage sgImageToVGImage(QEglContext *context, const RSgImage &sgImage)
return vgImage;
}
- pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
- pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
- pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
-
- if (eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) {
- driver.Close();
- return vgImage;
- }
-
const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
- EGLImageKHR eglImage = eglCreateImageKHR(context->display(),
+ EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(),
EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)&sgImage,
(EGLint*)KEglImageAttribs);
- if (eglGetError() != EGL_SUCCESS) {
+ if (!eglImage || eglGetError() != EGL_SUCCESS) {
driver.Close();
return vgImage;
}
- vgImage = vgCreateEGLImageTargetKHR(eglImage);
- if (vgGetError() != VG_NO_ERROR) {
- eglDestroyImageKHR(context->display(), eglImage);
+ 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
- eglDestroyImageKHR(context->display(), eglImage);
+ QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
driver.Close();
return vgImage;
}
@@ -255,30 +259,21 @@ void* QVGPixmapData::toNativeType(NativeType type)
return 0;
}
- pfnEglCreateImageKHR eglCreateImageKHR = (pfnEglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
- pfnEglDestroyImageKHR eglDestroyImageKHR = (pfnEglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
- pfnVgCreateEGLImageTargetKHR vgCreateEGLImageTargetKHR = (pfnVgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR");
-
- if (eglGetError() != EGL_SUCCESS || !eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateEGLImageTargetKHR) {
- driver.Close();
- return 0;
- }
-
const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE};
- EGLImageKHR eglImage = eglCreateImageKHR(context->display(),
+ EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(),
EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)sgImage,
(EGLint*)KEglImageAttribs);
- if (eglGetError() != EGL_SUCCESS) {
+ if (!eglImage || eglGetError() != EGL_SUCCESS) {
sgImage->Close();
driver.Close();
return 0;
}
- VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage);
- if (vgGetError() != VG_NO_ERROR) {
- eglDestroyImageKHR(context->display(), eglImage);
+ VGImage dstVgImage = QVG::vgCreateEGLImageTargetKHR(eglImage);
+ if (!dstVgImage || vgGetError() != VG_NO_ERROR) {
+ QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
sgImage->Close();
driver.Close();
return 0;
@@ -294,7 +289,7 @@ void* QVGPixmapData::toNativeType(NativeType type)
}
// release stuff
vgDestroyImage(dstVgImage);
- eglDestroyImageKHR(context->display(), eglImage);
+ QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
driver.Close();
return reinterpret_cast<void*>(sgImage);
#endif
@@ -330,8 +325,8 @@ QSymbianVGFontGlyphCache::QSymbianVGFontGlyphCache() : QVGFontGlyphCache()
}
void QSymbianVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
- const QTextItemInt &ti,
- const QVarLengthArray<glyph_t> &glyphs)
+ QFontEngine *fontEngine,
+ const glyph_t *g, int count)
{
#ifdef QT_SYMBIAN_HARDWARE_GLYPH_CACHE
QFontEngineS60 *fontEngine = static_cast<QFontEngineS60*>(ti.fontEngine);
@@ -385,7 +380,7 @@ void QSymbianVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d,
else if (err != KErrNotFound)
qWarning("Received error %d from glyph cache", err);
#else
- QVGFontGlyphCache::cacheGlyphs(d, ti, glyphs);
+ QVGFontGlyphCache::cacheGlyphs(d, fontEngine, g, count);
#endif
}
diff --git a/src/openvg/qvgfontglyphcache_p.h b/src/openvg/qvgfontglyphcache_p.h
index 2bf79aa..b32a873 100644
--- a/src/openvg/qvgfontglyphcache_p.h
+++ b/src/openvg/qvgfontglyphcache_p.h
@@ -85,8 +85,8 @@ class QSymbianVGFontGlyphCache : public QVGFontGlyphCache
public:
QSymbianVGFontGlyphCache();
void cacheGlyphs(QVGPaintEnginePrivate *d,
- const QTextItemInt &ti,
- const QVarLengthArray<glyph_t> &glyphs);
+ QFontEngine *fontEngine,
+ const glyph_t *g, int count);
};
#endif