egl/sfopenvg/riMiniEGL.cpp
branchEGL_MERGE
changeset 58 5b9c23c1a54c
parent 57 2bf8a359aa2f
child 72 360f71440b77
equal deleted inserted replaced
57:2bf8a359aa2f 58:5b9c23c1a54c
   296 	if (!es || Dll::SetTls(es)!= KErrNone)
   296 	if (!es || Dll::SetTls(es)!= KErrNone)
   297 		{
   297 		{
   298 		delete es;
   298 		delete es;
   299 		return NULL;
   299 		return NULL;
   300 		}
   300 		}
   301 	
       
   302 	return es->getEgl();
   301 	return es->getEgl();
   303 	
   302 	}
   304 	//TODO do we need to associate EGL with session here Jose
       
   305 /*	if ((pEgl = static_cast<EGL*> (Dll::Tls())) == NULL)
       
   306 		{
       
   307 		//create TLS instance
       
   308 		pEgl = RI_NEW(EGL, ());
       
   309 		RDebug::Printf("---------- In getEGL()::Static(),Addr of pEgl Ptr = %x\n", &pEgl);
       
   310 		RDebug::Printf("---------- In getEGL()::Static(),Addr of pEgl= %x\n", pEgl);
       
   311 		//RDebug::Printf("In CEglThreadSession::Static(),Thread Id %Lu",(RThread().Id().Id()));
       
   312 		RDebug::Printf("---------- In getEGL()::Static(),Thread Id %Lu",(RThread().Id()));
       
   313 		Dll::SetTls(pEgl);
       
   314 		}*/
       
   315 	//return pEgl;
       
   316 
       
   317 	}
       
   318 
       
   319 
   303 
   320 static void releaseEGL()
   304 static void releaseEGL()
   321 	{
   305 	{
   322 	/*
   306 	/*
   323 	 if(g_egl)
   307 	 if(g_egl)
   480  *//*-------------------------------------------------------------------*/
   464  *//*-------------------------------------------------------------------*/
   481 
   465 
   482 void* eglvgGetCurrentVGContext(void)
   466 void* eglvgGetCurrentVGContext(void)
   483 	{
   467 	{
   484 	EGL* egl = getEGL();
   468 	EGL* egl = getEGL();
   485 /*	RDebug::Printf(" \n");
       
   486 	RDebug::Printf(" \n");
       
   487 	RDebug::Printf(" \n");
       
   488 	
       
   489 	
       
   490 	RDebug::Printf(" $$$$$$$$$$$$$ I am in function eglvgGetCurrentVGContext $$$$$$$$$$$$$$$$$\n");
       
   491 	RDebug::Printf(" $$$$$$$$$$$$$ In eglvgGetCurrentVGContext,Thread Id %Lu  $$$$$$$$$$$$$ ",(RThread().Id()));*/
       
   492 	
       
   493 			
       
   494 	if (egl)
   469 	if (egl)
   495 		{
   470 		{
   496 		RIEGLThread* thread = egl->getCurrentThread();
   471 		RIEGLThread* thread = egl->getCurrentThread();
   497 		//RDebug::Printf(" $$$$$$$$$$$$$ I am in function eglvgGetCurrentVGContext.EGL addr is %x = \n",egl);
       
   498 		if (thread)
   472 		if (thread)
   499 			{
   473 			{
   500 			RI_ASSERT(thread->getCurrentContext() && thread->getCurrentSurface());
   474 			RI_ASSERT(thread->getCurrentContext() && thread->getCurrentSurface());
   501 			return thread->getCurrentContext()->getVGContext();
   475 			return thread->getCurrentContext()->getVGContext();
   502 			}
   476 			}
  1579 	try
  1553 	try
  1580 		{
  1554 		{
  1581 		vgctx
  1555 		vgctx
  1582 				= RI_NEW(OpenVGRI::VGContext, (share_context ? ((RIEGLContext*)share_context)->getVGContext() : NULL)); //throws bad_alloc
  1556 				= RI_NEW(OpenVGRI::VGContext, (share_context ? ((RIEGLContext*)share_context)->getVGContext() : NULL)); //throws bad_alloc
  1583 		c = RI_NEW(RIEGLContext, (vgctx, config)); //throws bad_alloc
  1557 		c = RI_NEW(RIEGLContext, (vgctx, config)); //throws bad_alloc
  1584 		
       
  1585 		RDebug::Printf(" ---------------------------- In eglCreateContext,VGContext addr is %x  $$$$$$$$$$$$$ ",vgctx);
       
  1586 		RDebug::Printf(" ---------------------------- In eglCreateContext,RIEGLContext addr is %x  $$$$$$$$$$$$$ ",c);
       
  1587 		c->addReference();
  1558 		c->addReference();
  1588 		display->addContext(c); //throws bad_alloc
  1559 		display->addContext(c); //throws bad_alloc
  1589 		}
  1560 		}
  1590 	catch (std::bad_alloc)
  1561 	catch (std::bad_alloc)
  1591 		{
  1562 		{
  1703 		RIEGLThread* newThread = egl->getThread();
  1674 		RIEGLThread* newThread = egl->getThread();
  1704 		if (!newThread)
  1675 		if (!newThread)
  1705 			EGL_RETURN(EGL_BAD_ALLOC, EGL_FALSE);
  1676 			EGL_RETURN(EGL_BAD_ALLOC, EGL_FALSE);
  1706 		newThread->makeCurrent(c, s);
  1677 		newThread->makeCurrent(c, s);
  1707 		Drawable* temp = s->getDrawable();
  1678 		Drawable* temp = s->getDrawable();
  1708 		RDebug::Printf(" ------------------------------ In Drawable* temp,Drawable addr is %x  $$$$$$$$$$$$$ ",temp);
       
  1709 		c->getVGContext()->setDefaultDrawable(s->getDrawable());
  1679 		c->getVGContext()->setDefaultDrawable(s->getDrawable());
  1710 
  1680 
  1711 		try
  1681 		try
  1712 			{
  1682 			{
  1713 			egl->addCurrentThread(newThread); //throws bad_alloc
  1683 			egl->addCurrentThread(newThread); //throws bad_alloc