[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 7e94e0d: [graph/win32] Use faster Set/GetWindow
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master 7e94e0d: [graph/win32] Use faster Set/GetWindowLongPtr. |
Date: |
Thu, 7 Jan 2021 23:18:52 -0500 (EST) |
branch: master
commit 7e94e0dd6d044f58630fd028a07e8c2a07b88942
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[graph/win32] Use faster Set/GetWindowLongPtr.
* graph/win32/grwin32.c (Message_Process): s/SetProp/SetWindowLongPtr/
and s/GetProp/GetWindowLongPtr/ essentially.
(gr_win32_device_init, gr_win32_device_done): Get rid of `ourAtom'.
---
ChangeLog | 10 +++++++++-
graph/win32/grwin32.c | 14 ++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6259f1c..24690a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-07 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [graph/win32] Use faster Set/GetWindowLongPtr.
+
+ * graph/win32/grwin32.c (Message_Process): s/SetProp/SetWindowLongPtr/
+ and s/GetProp/GetWindowLongPtr/ essentially.
+ (gr_win32_device_init, gr_win32_device_done): Get rid of `ourAtom'.
+
2021-01-06 Alexei Podtelezhnikov <apodtele@gmail.com>
[graph/win32] Use top-down DIBs.
@@ -750,7 +758,7 @@
[graph] Clean up win32 driver.
- This removes `BitBlt' and a related bitmap copy. Instead the driver
+ This removes `BitBlt' and a related bitmap copy. Instead the driver
now uses direct `SetDIBitsToDevice' which is similar to `XPutImage'.
* graph/win32/grwin32.c (grWin32Surface): Remove `hbn'.
diff --git a/graph/win32/grwin32.c b/graph/win32/grwin32.c
index a234d05..0fc8052 100644
--- a/graph/win32/grwin32.c
+++ b/graph/win32/grwin32.c
@@ -98,8 +98,6 @@
{ VK_F12, grKeyF12 }
};
- static ATOM ourAtom;
-
typedef struct grWin32SurfaceRec_
{
grSurface root;
@@ -206,7 +204,6 @@ gr_win32_surface_refresh_rectangle(
int read_pitch = bitmap->pitch;
unsigned char* write_line = (unsigned
char*)surface->shadow_bitmap.buffer;
int write_pitch = surface->shadow_bitmap.pitch;
- int bytes = 0;
if ( read_pitch < 0 )
read_line -= ( bitmap->rows - 1 ) * read_pitch;
@@ -605,7 +602,7 @@ gr_win32_surface_init( grWin32Surface* surface,
LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
WPARAM wParam, LPARAM lParam )
{
- grWin32Surface* surface = NULL;
+ grWin32Surface* surface;
if ( mess == WM_CREATE )
{
@@ -615,14 +612,14 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
/* */
surface = ((LPCREATESTRUCT)lParam)->lpCreateParams;
- SetProp( handle, (LPCSTR)(LONG)ourAtom, surface );
+ SetWindowLongPtr( handle, GWLP_USERDATA, (LONG_PTR)surface );
}
else
{
/* for other calls, we retrieve the surface handle from the window */
/* property.. ugly, isn't it ?? */
/* */
- surface = (grWin32Surface*) GetProp( handle, (LPCSTR)(LONG)ourAtom );
+ surface = (grWin32Surface*)GetWindowLongPtr( handle, GWLP_USERDATA );
}
switch( mess )
@@ -697,16 +694,13 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
if ( RegisterClass(&ourClass) == 0 )
return -1;
- /* add global atom */
- ourAtom = GlobalAddAtom( "FreeType.Surface" );
-
return 0;
}
static void
gr_win32_device_done( void )
{
- GlobalDeleteAtom( ourAtom );
+ /* Nothing to do. */
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 7e94e0d: [graph/win32] Use faster Set/GetWindowLongPtr.,
Alexei Podtelezhnikov <=