We can assume ARGB surface format when creating cursors (enforced by higher level API)
authorSam Lantinga <slouken@libsdl.org>
Fri, 11 Mar 2011 13:59:52 -0800
changeset 5472674d45edfaeb
parent 5471 179adad3ae6f
child 5473 5665ccbd6792
We can assume ARGB surface format when creating cursors (enforced by higher level API)
src/video/windows/SDL_windowsmouse.c
     1.1 --- a/src/video/windows/SDL_windowsmouse.c	Fri Mar 11 13:56:53 2011 -0800
     1.2 +++ b/src/video/windows/SDL_windowsmouse.c	Fri Mar 11 13:59:52 2011 -0800
     1.3 @@ -22,6 +22,7 @@
     1.4  
     1.5  #include "SDL_config.h"
     1.6  
     1.7 +#include "SDL_assert.h"
     1.8  #include "SDL_windowsvideo.h"
     1.9  
    1.10  #include "../../events/SDL_mouse_c.h"
    1.11 @@ -49,7 +50,6 @@
    1.12  WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
    1.13  {
    1.14      SDL_Cursor *cursor;
    1.15 -    SDL_Surface *cvt;
    1.16      HICON hicon;
    1.17      HDC hdc;
    1.18      BITMAPV4HEADER bmh;
    1.19 @@ -77,12 +77,9 @@
    1.20      ii.hbmMask = CreateBitmap(surface->w, surface->h, 1, 1, NULL);
    1.21      ReleaseDC(NULL, hdc);
    1.22  
    1.23 -    cvt = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
    1.24 -    if (!cvt) {
    1.25 -        return NULL;
    1.26 -    }
    1.27 -    SDL_memcpy(pixels, cvt->pixels, cvt->h * cvt->pitch);
    1.28 -    SDL_FreeSurface(cvt);
    1.29 +    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
    1.30 +    SDL_assert(surface->pitch == surface->w * 4);
    1.31 +    SDL_memcpy(pixels, surface->pixels, surface->h * surface->pitch);
    1.32  
    1.33      hicon = CreateIconIndirect(&ii);
    1.34