src/hbservers/hbthemeserver/hbsgimagerenderer.cpp
changeset 2 06ff229162e9
parent 0 16d8024aca5e
child 21 4633027730f5
--- a/src/hbservers/hbthemeserver/hbsgimagerenderer.cpp	Mon May 03 12:48:33 2010 +0300
+++ b/src/hbservers/hbthemeserver/hbsgimagerenderer.cpp	Fri May 14 16:09:54 2010 +0300
@@ -24,6 +24,8 @@
 ****************************************************************************/
 
 #include "hbsgimagerenderer_p.h"
+#include "hbnvg_p.h"
+
 #include <QDebug>
 QHash<unsigned long long, RSgImage*> HbSgImageRenderer::sgImageHash;
 
@@ -39,7 +41,8 @@
         currentSurface(EGL_NO_SURFACE),
         eglContext(EGL_NO_CONTEXT),
         eglConfig(0),
-        init(false)        
+        init(false),
+        engine(0)
 {
 #ifdef HB_ICON_CACHE_DEBUG
     eglQueryProfilingData = 0;
@@ -74,6 +77,7 @@
         if (error != KErrNone) {
             return false;
         }
+        engine = new HbNvgEngine;
     }
 
     init = true;
@@ -83,6 +87,7 @@
 void HbSgImageRenderer::terminate()
 {
     if (init) {
+        eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
         if (eglContext != EGL_NO_CONTEXT) {
             eglDestroyContext(display, eglContext);
             eglContext = EGL_NO_CONTEXT;
@@ -91,8 +96,10 @@
         sgDriver.Close();
 
         eglTerminate(display);
+        eglReleaseThread();
         display = EGL_NO_DISPLAY;
-
+        delete engine;
+        engine = 0;
         init = false;
     }
 }
@@ -117,7 +124,7 @@
 
     eglContext = eglCreateContext(display, eglConfig, EGL_NO_CONTEXT, 0);
 
-    return true;
+    return eglContext != EGL_NO_CONTEXT;
 }
 
 bool HbSgImageRenderer::beginRendering(RSgImage * sgImage)