openvg/openvgrefimplementation/sfopenvg/sfopenvg/symbian/riEGLOS.cpp
branchEGL_MERGE
changeset 180 f767bd5f4cfc
parent 118 6aeef2faff80
child 212 a8e55d78eb52
equal deleted inserted replaced
119:5f371025658c 180:f767bd5f4cfc
    84 * \note		
    84 * \note		
    85 *//*-------------------------------------------------------------------*/
    85 *//*-------------------------------------------------------------------*/
    86 
    86 
    87 struct OSWindowContext
    87 struct OSWindowContext
    88 {
    88 {
    89 	TNativeWindowType*  iNativeWindowType;   
    89 	TNativeWindowType   iNativeWindowType;
    90 };
    90 };
    91 
    91 
    92 void* OSCreateWindowContext(EGLNativeWindowType window)
    92 void* OSCreateWindowContext(EGLNativeWindowType window)
    93 {
    93 {
    94     OSWindowContext* ctx = NULL;
    94     OSWindowContext* ctx = NULL;
    98     }
    98     }
    99 	catch(std::bad_alloc)
    99 	catch(std::bad_alloc)
   100 	{
   100 	{
   101 		return NULL;
   101 		return NULL;
   102 	}
   102 	}
   103     ctx->iNativeWindowType = (TNativeWindowType*)window;
   103 	RDrawableWindow* drawableWindow = (RDrawableWindow*)window;
   104     RWindow* win = (RWindow*) window;
   104 	ctx->iNativeWindowType.iSize.iHeight = drawableWindow->Size().iHeight;
   105     TSize size = TSize(win->Size());
   105 	ctx->iNativeWindowType.iSize.iWidth = drawableWindow->Size().iWidth;
   106     ctx->iNativeWindowType->iSize.iWidth = size.iWidth;
       
   107     ctx->iNativeWindowType->iSize.iHeight = size.iHeight;
       
   108     return ctx;
   106     return ctx;
   109 }
   107 }
   110 
   108 
   111 void OSDestroyWindowContext(void* context)
   109 void OSDestroyWindowContext(void* context)
   112 {
   110 {
   130 void OSGetWindowSize(const void* context, int& width, int& height)
   128 void OSGetWindowSize(const void* context, int& width, int& height)
   131 {
   129 {
   132     OSWindowContext* ctx = (OSWindowContext*)context;
   130     OSWindowContext* ctx = (OSWindowContext*)context;
   133     if(ctx)
   131     if(ctx)
   134     {
   132     {
   135         if ( ctx->iNativeWindowType->iSize.iWidth < 360 )
   133     	width=ctx->iNativeWindowType.iSize.iWidth;
   136     	    ctx->iNativeWindowType->iSize.iWidth;
   134 		height=ctx->iNativeWindowType.iSize.iHeight; 
   137         else
       
   138           width= 360;//ctx->iNativeWindowType->iSize.iWidth;
       
   139         if ( ctx->iNativeWindowType->iSize.iHeight < 640 )
       
   140           ctx->iNativeWindowType->iSize.iHeight;
       
   141 		    else
       
   142           height= 640; //ctx->iNativeWindowType->iSize.iHeight; 
       
   143     }
   135     }
   144     else
   136     else
   145     {
   137     {
   146         width = 0;
   138         width = 0;
   147         height = 0;
   139         height = 0;
   158 
   150 
   159 void OSBlitToWindow(void* context, const Drawable* drawable)
   151 void OSBlitToWindow(void* context, const Drawable* drawable)
   160 {
   152 {
   161     OSWindowContext* ctx = (OSWindowContext*)context;
   153     OSWindowContext* ctx = (OSWindowContext*)context;
   162     //blit if either of iBitmap or iMaskBitmap exist
   154     //blit if either of iBitmap or iMaskBitmap exist
   163     if(ctx && ctx->iNativeWindowType->iBitmap)
   155     if(ctx && ctx->iNativeWindowType.iBitmap)
   164     {
   156     {
   165         TUint w = drawable->getWidth();
   157         TUint w = drawable->getWidth();
   166         TUint h = drawable->getHeight();
   158         TUint h = drawable->getHeight();
   167         
   159         
   168         //these should be same as bitmap
   160         //these should be same as bitmap
   169         if(ctx->iNativeWindowType->iBitmap)
   161         if(ctx->iNativeWindowType.iBitmap)
   170         	{
   162         	{
   171         	CFbsBitmap* bitmap = ctx->iNativeWindowType->iBitmap;        	
   163         	CFbsBitmap* bitmap = ctx->iNativeWindowType.iBitmap;        	
   172         	ReadPixelsToCFbsBitmap(*bitmap, w, h);        	
   164         	ReadPixelsToCFbsBitmap(*bitmap, w, h);        	
   173         	}
   165         	}
   174     }
   166     }
   175 }
   167 }
   176 
   168