Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
8457ab1e
Commit
8457ab1e
authored
Mar 01, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
You can use SDL_ConvertSurfaceFormat() now
Also, icon is guaranteed not to be NULL going into this function.
parent
5b710cfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
45 deletions
+39
-45
SDL_windowswindow.c
src/video/windows/SDL_windowswindow.c
+39
-45
No files found.
src/video/windows/SDL_windowswindow.c
View file @
8457ab1e
...
@@ -286,12 +286,9 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
...
@@ -286,12 +286,9 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
{
{
HWND
hwnd
=
((
SDL_WindowData
*
)
window
->
driverdata
)
->
hwnd
;
HWND
hwnd
=
((
SDL_WindowData
*
)
window
->
driverdata
)
->
hwnd
;
HICON
hicon
=
NULL
;
HICON
hicon
=
NULL
;
if
(
icon
)
{
BYTE
*
icon_bmp
;
BYTE
*
icon_bmp
;
int
icon_len
;
int
icon_len
;
SDL_RWops
*
dst
;
SDL_RWops
*
dst
;
SDL_PixelFormat
format
;
SDL_Surface
*
surface
;
SDL_Surface
*
surface
;
/* Create temporary bitmap buffer */
/* Create temporary bitmap buffer */
...
@@ -317,8 +314,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
...
@@ -317,8 +314,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
SDL_WriteLE32
(
dst
,
0
);
SDL_WriteLE32
(
dst
,
0
);
/* Convert the icon to a 32-bit surface with alpha channel */
/* Convert the icon to a 32-bit surface with alpha channel */
SDL_InitFormat
(
&
format
,
SDL_PIXELFORMAT_ARGB8888
);
surface
=
SDL_ConvertSurfaceFormat
(
icon
,
SDL_PIXELFORMAT_ARGB8888
,
0
);
surface
=
SDL_ConvertSurface
(
icon
,
&
format
,
0
);
if
(
surface
)
{
if
(
surface
)
{
/* Write the pixels upside down into the bitmap buffer */
/* Write the pixels upside down into the bitmap buffer */
int
y
=
surface
->
h
;
int
y
=
surface
->
h
;
...
@@ -330,13 +326,11 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
...
@@ -330,13 +326,11 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
/* TODO: create the icon in WinCE (CreateIconFromResource isn't available) */
/* TODO: create the icon in WinCE (CreateIconFromResource isn't available) */
#ifndef _WIN32_WCE
#ifndef _WIN32_WCE
hicon
=
hicon
=
CreateIconFromResource
(
icon_bmp
,
icon_len
,
TRUE
,
0x00030000
);
CreateIconFromResource
(
icon_bmp
,
icon_len
,
TRUE
,
0x00030000
);
#endif
#endif
}
}
SDL_RWclose
(
dst
);
SDL_RWclose
(
dst
);
SDL_stack_free
(
icon_bmp
);
SDL_stack_free
(
icon_bmp
);
}
/* Set the icon for the window */
/* Set the icon for the window */
SendMessage
(
hwnd
,
WM_SETICON
,
ICON_SMALL
,
(
LPARAM
)
hicon
);
SendMessage
(
hwnd
,
WM_SETICON
,
ICON_SMALL
,
(
LPARAM
)
hicon
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment