mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 12:27:58 +08:00
tune and cleanup
This commit is contained in:
@@ -133,6 +133,7 @@ static HCURSOR srvCreateCursor (int xhotspot, int yhotspot, int w, int h,
|
||||
{
|
||||
GAL_Surface* csr_surf;
|
||||
PCURSOR pcsr;
|
||||
gal_pixel trans_pixel = RGBA2Pixel (_dc_cursor, 0x00, 0x00, 0x00, 0x00);
|
||||
|
||||
if (w != CURSORWIDTH || h != CURSORHEIGHT)
|
||||
return 0;
|
||||
@@ -154,13 +155,12 @@ static HCURSOR srvCreateCursor (int xhotspot, int yhotspot, int w, int h,
|
||||
int x, y;
|
||||
BYTE and_byte = 0;
|
||||
BYTE xor_byte = 0;
|
||||
gal_pixel trans_pixel = RGBA2Pixel (_dc_cursor, 0x00, 0x00, 0x00, 0x00);
|
||||
gal_pixel white_pixel = RGBA2Pixel (_dc_cursor, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
gal_pixel black_pixel = RGBA2Pixel (_dc_cursor, 0x00, 0x00, 0x00, 0xFF);
|
||||
|
||||
pANDBits += MONOPITCH * (CURSORHEIGHT - 1);
|
||||
pXORBits += MONOPITCH * (CURSORHEIGHT - 1);
|
||||
gal_pixel* pixels = (gal_pixel*)csr_surf->pixels;
|
||||
Uint32* pixels = (Uint32*)csr_surf->pixels;
|
||||
|
||||
for (y = 0; y < CURSORHEIGHT; y++) {
|
||||
const BYTE* and_bytes = pANDBits;
|
||||
@@ -187,7 +187,7 @@ static HCURSOR srvCreateCursor (int xhotspot, int yhotspot, int w, int h,
|
||||
|
||||
pANDBits -= MONOPITCH;
|
||||
pXORBits -= MONOPITCH;
|
||||
pixels += csr_surf->pitch;
|
||||
pixels += (csr_surf->pitch >> 2);
|
||||
}
|
||||
}
|
||||
else if (colornum == 4) {
|
||||
@@ -195,12 +195,11 @@ static HCURSOR srvCreateCursor (int xhotspot, int yhotspot, int w, int h,
|
||||
BYTE and_byte = 0;
|
||||
BYTE xor_byte = 0;
|
||||
int idx_16c = 0;
|
||||
gal_pixel trans_pixel = RGBA2Pixel (_dc_cursor, 0x00, 0x00, 0x00, 0x00);
|
||||
const RGB* std16c_rgb = __mg_bmp_get_std_16c ();
|
||||
|
||||
pANDBits += MONOPITCH * (CURSORHEIGHT - 1);
|
||||
pXORBits += MONOPITCH * 4 * (CURSORHEIGHT - 1);
|
||||
gal_pixel* pixels = (gal_pixel*)csr_surf->pixels;
|
||||
Uint32* pixels = (Uint32*)csr_surf->pixels;
|
||||
|
||||
for (y = 0; y < CURSORHEIGHT; y++) {
|
||||
const BYTE* and_bytes = pANDBits;
|
||||
@@ -230,7 +229,7 @@ static HCURSOR srvCreateCursor (int xhotspot, int yhotspot, int w, int h,
|
||||
|
||||
pANDBits -= MONOPITCH;
|
||||
pXORBits -= (MONOPITCH * 4);
|
||||
pixels += csr_surf->pitch;
|
||||
pixels += (csr_surf->pitch >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-15
@@ -106,23 +106,22 @@ GAL_Surface * GAL_CreateCursorSurface (GAL_VideoDevice *video,
|
||||
GAL_SetClipRect (surface, NULL);
|
||||
|
||||
/* Get the pixels */
|
||||
if (video && video->AllocDumbSurface) {
|
||||
if (video->AllocDumbSurface (video, surface) < 0) {
|
||||
if (video == NULL || video->AllocDumbSurface == NULL ||
|
||||
video->AllocDumbSurface (video, surface) < 0) {
|
||||
|
||||
// fallback to allocate in system memory
|
||||
surface->hwdata = NULL;
|
||||
surface->pixels = malloc (surface->h*surface->pitch);
|
||||
if (surface->pixels == NULL) {
|
||||
goto error;
|
||||
}
|
||||
// fallback to allocate in system memory
|
||||
surface->hwdata = NULL;
|
||||
surface->pixels = malloc (surface->h*surface->pitch);
|
||||
if (surface->pixels == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
surface->video = NULL;
|
||||
surface->flags &= ~GAL_HWSURFACE;
|
||||
}
|
||||
else {
|
||||
surface->video = video;
|
||||
surface->flags |= GAL_HWSURFACE;
|
||||
}
|
||||
surface->video = NULL;
|
||||
surface->flags &= ~GAL_HWSURFACE;
|
||||
}
|
||||
else {
|
||||
surface->video = video;
|
||||
surface->flags |= GAL_HWSURFACE;
|
||||
}
|
||||
|
||||
surface->map = GAL_AllocBlitMap();
|
||||
|
||||
@@ -147,8 +147,11 @@ HCURSOR __mg_load_cursor_from_res (int i)
|
||||
char path [MAX_PATH + 1];
|
||||
|
||||
strncpy (path, sysres_get_system_res_path(), MAX_PATH);
|
||||
path [MAX_PATH] = 0;
|
||||
strcat (path, "cursor/");
|
||||
path [MAX_PATH] = 0;
|
||||
strcat (path, filename);
|
||||
path [MAX_PATH] = 0;
|
||||
|
||||
#ifdef _MGUSE_COMPOSITING
|
||||
if (is_png)
|
||||
|
||||
@@ -82,9 +82,8 @@ BOOL GUIAPI RegisterResFromFile (HDC hdc, const char* file)
|
||||
return LoadResource(file, RES_TYPE_IMAGE,(DWORD)HDC_SCREEN)!=NULL;
|
||||
}
|
||||
|
||||
BOOL GUIAPI
|
||||
RegisterResFromMem (HDC hdc, const char* file, const unsigned char* data,
|
||||
size_t data_size)
|
||||
BOOL GUIAPI RegisterResFromMem (HDC hdc, const char* file,
|
||||
const unsigned char* data, size_t data_size)
|
||||
{
|
||||
if (!data || !file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user