freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] master 6bf509e: [graph/win32] Simplify icon setting fu


From: Werner Lemberg
Subject: [freetype2-demos] master 6bf509e: [graph/win32] Simplify icon setting further.
Date: Mon, 23 May 2022 16:26:35 -0400 (EDT)

branch: master
commit 6bf509e1ed28a38448c8395506ddb0700d027b94
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [graph/win32] Simplify icon setting further.
    
    * graph/win32/grwin32.c (gr_win32_surface_set_icon): Use `CreateIcon`.
---
 graph/win32/grwin32.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/graph/win32/grwin32.c b/graph/win32/grwin32.c
index e7f2052..b66d44e 100644
--- a/graph/win32/grwin32.c
+++ b/graph/win32/grwin32.c
@@ -247,11 +247,10 @@ static int
 gr_win32_surface_set_icon( grWin32Surface*  surface,
                            grBitmap*        icon )
 {
-  int       s[] = { GetSystemMetrics( SM_CYSMICON ),
-                    GetSystemMetrics( SM_CYICON ) };
-  WPARAM    wParam;
-  ICONINFO  ici = { TRUE };
-  HICON     hIcon;
+  int     s[] = { GetSystemMetrics( SM_CYSMICON ),
+                  GetSystemMetrics( SM_CYICON ) };
+  WPARAM  wParam;
+  HICON   hIcon;
 
   if ( !icon )
     return s[1];
@@ -264,13 +263,8 @@ gr_win32_surface_set_icon( grWin32Surface*  surface,
   else
     return 0;
 
-  ici.hbmMask  = CreateBitmap( icon->width, icon->rows, 1,  1, NULL );
-  ici.hbmColor = CreateBitmap( icon->width, icon->rows, 1, 32, icon->buffer );
-
-  hIcon = CreateIconIndirect( &ici );
-
-  DeleteObject( ici.hbmMask );
-  DeleteObject( ici.hbmColor );
+  hIcon = CreateIcon( NULL, icon->width, icon->rows, 1, 32,
+                      NULL, icon->buffer );
 
   PostMessage( surface->window, WM_SETICON, wParam, (LPARAM)hIcon );
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]