src/video/SDL_renderer_sw.c
branchSDL-1.3
changeset 1678 90bf530ced8e
parent 1676 e136f3ffdc1b
child 1680 9488fca10677
equal deleted inserted replaced
1677:5e4c5e095925 1678:90bf530ced8e
    28 /* SDL surface based renderer implementation */
    28 /* SDL surface based renderer implementation */
    29 
    29 
    30 static SDL_Renderer *SDL_SW_CreateRenderer(SDL_Window * window, Uint32 flags);
    30 static SDL_Renderer *SDL_SW_CreateRenderer(SDL_Window * window, Uint32 flags);
    31 static int SDL_SW_CreateTexture(SDL_Renderer * renderer,
    31 static int SDL_SW_CreateTexture(SDL_Renderer * renderer,
    32                                 SDL_Texture * texture);
    32                                 SDL_Texture * texture);
       
    33 static int SDL_SW_QueryTexturePixels(SDL_Renderer * renderer,
       
    34                                      SDL_Texture * texture, void **pixels,
       
    35                                      int *pitch);
    33 static int SDL_SW_UpdateTexture(SDL_Renderer * renderer,
    36 static int SDL_SW_UpdateTexture(SDL_Renderer * renderer,
    34                                 SDL_Texture * texture, SDL_Rect * rect,
    37                                 SDL_Texture * texture, SDL_Rect * rect,
    35                                 const void *pixels, int pitch);
    38                                 const void *pixels, int pitch);
    36 static int SDL_SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    39 static int SDL_SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    37                               SDL_Rect * rect, int markDirty, void **pixels,
    40                               SDL_Rect * rect, int markDirty, void **pixels,
   124         return NULL;
   127         return NULL;
   125     }
   128     }
   126     SDL_zerop(data);
   129     SDL_zerop(data);
   127 
   130 
   128     renderer->CreateTexture = SDL_SW_CreateTexture;
   131     renderer->CreateTexture = SDL_SW_CreateTexture;
       
   132     renderer->QueryTexturePixels = SDL_SW_QueryTexturePixels;
   129     renderer->UpdateTexture = SDL_SW_UpdateTexture;
   133     renderer->UpdateTexture = SDL_SW_UpdateTexture;
   130     renderer->LockTexture = SDL_SW_LockTexture;
   134     renderer->LockTexture = SDL_SW_LockTexture;
   131     renderer->UnlockTexture = SDL_SW_UnlockTexture;
   135     renderer->UnlockTexture = SDL_SW_UnlockTexture;
   132     renderer->DirtyTexture = SDL_SW_DirtyTexture;
   136     renderer->DirtyTexture = SDL_SW_DirtyTexture;
   133     renderer->SelectRenderTexture = SDL_SW_SelectRenderTexture;
   137     renderer->SelectRenderTexture = SDL_SW_SelectRenderTexture;
   213     texture->driverdata = surface;
   217     texture->driverdata = surface;
   214     return 0;
   218     return 0;
   215 }
   219 }
   216 
   220 
   217 int
   221 int
       
   222 SDL_SW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
       
   223                           void **pixels, int *pitch)
       
   224 {
       
   225     SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
       
   226 
       
   227     *pixels = surface->pixels;
       
   228     *pitch = surface->pitch;
       
   229     return 0;
       
   230 }
       
   231 
       
   232 int
   218 SDL_SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   233 SDL_SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   219                      SDL_Rect * rect, const void *pixels, int pitch)
   234                      SDL_Rect * rect, const void *pixels, int pitch)
   220 {
   235 {
   221     SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   236     SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   222     Uint8 *src, *dst;
   237     Uint8 *src, *dst;