- CreateNativeRenderable();
- setenv( "EGL_PLATFORM", "tbm", 1 );
+ if( surface.Empty() )
+ {
+ mSurfaceSize = surfaceSize;
+ mColorDepth = isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24;
+ mTbmFormat = isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888;
+ CreateNativeRenderable();
+ }
+ else
+ {
+ mTbmQueue = AnyCast< tbm_surface_queue_h >( surface );
+
+ uint16_t width = static_cast<uint16_t>( tbm_surface_queue_get_width( mTbmQueue ) );
+ uint16_t height = static_cast<uint16_t>( tbm_surface_queue_get_height( mTbmQueue ) );
+ mSurfaceSize = SurfaceSize( width, height );
+
+ mTbmFormat = tbm_surface_queue_get_format( mTbmQueue );
+
+ mColorDepth = ( mTbmFormat == TBM_FORMAT_ARGB8888 ) ? COLOR_DEPTH_32 : COLOR_DEPTH_24;
+ }