Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
We can assume ARGB surface format when creating cursors (enforced by …
Browse files Browse the repository at this point in the history
…higher level API)
  • Loading branch information
slouken committed Mar 11, 2011
1 parent d214f6f commit 62e9298
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/video/windows/SDL_windowsmouse.c
Expand Up @@ -22,6 +22,7 @@

#include "SDL_config.h"

#include "SDL_assert.h"
#include "SDL_windowsvideo.h"

#include "../../events/SDL_mouse_c.h"
Expand Down Expand Up @@ -49,7 +50,6 @@ static SDL_Cursor *
WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
{
SDL_Cursor *cursor;
SDL_Surface *cvt;
HICON hicon;
HDC hdc;
BITMAPV4HEADER bmh;
Expand Down Expand Up @@ -77,12 +77,9 @@ WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
ii.hbmMask = CreateBitmap(surface->w, surface->h, 1, 1, NULL);
ReleaseDC(NULL, hdc);

cvt = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
if (!cvt) {
return NULL;
}
SDL_memcpy(pixels, cvt->pixels, cvt->h * cvt->pitch);
SDL_FreeSurface(cvt);
SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
SDL_assert(surface->pitch == surface->w * 4);
SDL_memcpy(pixels, surface->pixels, surface->h * surface->pitch);

hicon = CreateIconIndirect(&ii);

Expand Down

0 comments on commit 62e9298

Please sign in to comment.