72 // CHgVgEGL::InitWindowSurfaceL() |
72 // CHgVgEGL::InitWindowSurfaceL() |
73 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
74 // |
74 // |
75 void CHgVgEGL::InitWindowSurfaceL(RWindow& aWindow) |
75 void CHgVgEGL::InitWindowSurfaceL(RWindow& aWindow) |
76 { |
76 { |
77 RDebug::Print(_L("CHgVgEGL::InitWindowSurface")); |
77 //RDebug::Print(_L("CHgVgEGL::InitWindowSurface")); |
78 |
78 |
79 InitEGL(aWindow); |
79 InitEGL(aWindow); |
80 } |
80 } |
81 |
81 |
82 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
83 // CHgVgEGL::FreeWindowSurface() |
83 // CHgVgEGL::FreeWindowSurface() |
84 // --------------------------------------------------------------------------- |
84 // --------------------------------------------------------------------------- |
85 // |
85 // |
86 void CHgVgEGL::FreeWindowSurface() |
86 void CHgVgEGL::FreeWindowSurface() |
87 { |
87 { |
88 RDebug::Print(_L("CHgVgEGL::FreeWindowSurface")); |
88 //RDebug::Print(_L("CHgVgEGL::FreeWindowSurface")); |
89 |
89 |
90 // make sure there is nothing pending. |
90 // make sure there is nothing pending. |
91 vgFinish(); |
91 vgFinish(); |
92 |
92 |
93 // unbind current surface. |
93 // unbind current surface. |
237 // |
237 // |
238 void CHgVgEGL::InitEGLWindowSurfaceL(RWindow& aWindow) |
238 void CHgVgEGL::InitEGLWindowSurfaceL(RWindow& aWindow) |
239 { |
239 { |
240 |
240 |
241 |
241 |
242 // Create surface with premodulated alpha, on IVE3 this gives better performance. |
242 // Create surface with premodulated alpha. |
243 const EGLint KAttriblist[] = |
243 const EGLint KAttriblist[] = |
244 { |
244 { |
245 EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE, |
245 EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE, |
246 EGL_NONE |
246 EGL_NONE |
247 }; |
247 }; |
248 iSurface = eglCreateWindowSurface(iDisplay, iChosenConfig, &aWindow, KAttriblist); |
248 iSurface = eglCreateWindowSurface(iDisplay, iChosenConfig, &aWindow, KAttriblist); |
249 EGLint error = eglGetError(); |
249 EGLint error = eglGetError(); |
250 if (error == EGL_BAD_ALLOC) |
250 if (error == EGL_BAD_ALLOC) |
251 { |
251 { |
252 RDebug::Print(_L("CHgVgEGL:: Can't create surface! (out of memory)")); |
252 //RDebug::Print(_L("CHgVgEGL:: Can't create surface! (out of memory)")); |
253 User::Leave(KErrNoMemory); |
253 User::Leave(KErrNoMemory); |
254 } |
254 } |
255 else if (error == EGL_BAD_SURFACE || iSurface == EGL_NO_SURFACE) |
255 else if (error == EGL_BAD_SURFACE || iSurface == EGL_NO_SURFACE) |
256 { |
256 { |
257 RDebug::Print(_L("CHgVgEGL:: Can't create surface! (general)")); |
257 //RDebug::Print(_L("CHgVgEGL:: Can't create surface! (general)")); |
258 User::Leave(KErrGeneral); |
258 User::Leave(KErrGeneral); |
259 } |
259 } |
260 |
260 |
261 eglSurfaceAttrib(iDisplay, iSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); |
261 eglSurfaceAttrib(iDisplay, iSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); |
262 |
262 |
291 |
291 |
292 if (bitmap) |
292 if (bitmap) |
293 { |
293 { |
294 // create temporary buffer for data |
294 // create temporary buffer for data |
295 RBuf8 buf; |
295 RBuf8 buf; |
296 buf.Create(aRect.Width() * dataStride); |
296 buf.Create(aRect.Height() * dataStride); |
297 buf.Fill(0xFF); |
297 buf.Fill(0xFF); |
298 |
298 |
299 // read data from vg (this is sloooww) |
299 // read data from vg (this is sloooww) |
300 vgReadPixels((void*)buf.Ptr(), |
300 vgReadPixels((void*)buf.Ptr(), |
301 dataStride, VG_sARGB_8888, 0, 0, aRect.Width(), aRect.Height()); |
301 dataStride, VG_sARGB_8888, 0, 0, aRect.Width(), aRect.Height()); |