Commit 7e94e0dd authored by Alexei Podtelezhnikov's avatar Alexei Podtelezhnikov

[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'.
parent 84871fdc
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'.
......
......@@ -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. */
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment