Ignore:
Timestamp:
Aug 15, 2011 10:06:40 PM (13 years ago)
Author:
nanang
Message:

Re #1285: Updates for SDL 1.3 only:

  • Changed window mode from 'resizable' to 'borderless'.
  • Fixed window resize handling so resizing won't need destroy-recreate the SDL objects (this also fixes lost-focus problem in resizing window on Windows platform).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c

    r3696 r3698  
    541541#if SDL_VERSION_ATLEAST(1,3,0) 
    542542    if (!strm->window) { 
    543         Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE; 
     543        Uint32 flags = SDL_WINDOW_SHOWN | /*SDL_WINDOW_RESIZABLE*/ 
     544                       SDL_WINDOW_BORDERLESS; 
    544545 
    545546#   if PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL 
     
    691692    strm->status = PJ_SUCCESS; 
    692693    if (strm->new_fmt || strm->new_disp_size) { 
    693         if (strm->new_disp_size) 
    694             pj_memcpy(&strm->param.disp_size, strm->new_disp_size, 
     694        if (strm->new_disp_size) { 
     695            pj_memcpy(&strm->param.disp_size, strm->new_disp_size, 
    695696                      sizeof(strm->param.disp_size)); 
     697#if SDL_VERSION_ATLEAST(1,3,0) 
     698            if (strm->scr_tex) { 
     699                strm->dstrect.x = strm->dstrect.y = 0; 
     700                strm->dstrect.w = (Uint16)strm->param.disp_size.w; 
     701                strm->dstrect.h = (Uint16)strm->param.disp_size.h; 
     702                SDL_RenderSetViewport(strm->renderer, &strm->dstrect); 
     703                strm->new_fmt = NULL; 
     704                strm->new_disp_size = NULL; 
     705                return; 
     706            } 
     707#endif 
     708        } 
    696709 
    697710        /* Re-initialize SDL */ 
     
    755768        SDL_UpdateTexture(stream->scr_tex, NULL, frame->buf, stream->pitch); 
    756769        SDL_RenderClear(stream->renderer); 
    757         SDL_RenderCopy(stream->renderer, stream->scr_tex, NULL, NULL); 
     770        SDL_RenderCopy(stream->renderer, stream->scr_tex, 
     771                       &stream->rect, &stream->dstrect); 
    758772        SDL_RenderPresent(stream->renderer); 
    759773    } 
Note: See TracChangeset for help on using the changeset viewer.