/* 
 *  call-seq: 
 *    to_display()  ->  Surface
 *
 *  Copies the Surface to a new Surface with the pixel format of the display,
 *  suitable for fast blitting to the display surface (i.e. Screen).
 *  May raise SDLError if a problem occurs.
 *
 *  If you want to take advantage of hardware colorkey or alpha blit
 *  acceleration, you should set the colorkey and alpha value before calling
 *  this function. 
 *
 */
VALUE rbgm_surface_dispform(VALUE self)
{
        SDL_Surface *surf, *newsurf;
        Data_Get_Struct(self, SDL_Surface, surf);

  newsurf = SDL_DisplayFormat( surf );

  if( newsurf == NULL )
  {
    rb_raise(eSDLError,\
             "Could not convert the Surface to display format: %s",\
             SDL_GetError());
  }

  return Data_Wrap_Struct( cSurface,0,SDL_FreeSurface,newsurf );  
}