Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5811a2cc
Commit
5811a2cc
authored
Jan 28, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Use the official constants instead of the old Win9x magic numbers for GDI object types.
parent
d0e77f8a
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
113 additions
and
214 deletions
+113
-214
bitmap.c
dlls/gdi32/bitmap.c
+9
-10
brush.c
dlls/gdi32/brush.c
+6
-6
clipping.c
dlls/gdi32/clipping.c
+1
-1
dc.c
dlls/gdi32/dc.c
+9
-9
dib.c
dlls/gdi32/dib.c
+7
-7
enhmetafile.c
dlls/gdi32/enhmetafile.c
+3
-5
init.c
dlls/gdi32/enhmfdrv/init.c
+2
-2
font.c
dlls/gdi32/font.c
+7
-7
gdi_private.h
dlls/gdi32/gdi_private.h
+2
-28
gdiobj.c
dlls/gdi32/gdiobj.c
+26
-93
metafile.c
dlls/gdi32/metafile.c
+3
-4
init.c
dlls/gdi32/mfdrv/init.c
+2
-2
palette.c
dlls/gdi32/palette.c
+10
-11
pen.c
dlls/gdi32/pen.c
+7
-9
region.c
dlls/gdi32/region.c
+18
-19
wing.c
dlls/gdi32/wing.c
+1
-1
No files found.
dlls/gdi32/bitmap.c
View file @
5811a2cc
...
@@ -281,8 +281,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
...
@@ -281,8 +281,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
}
}
/* Create the BITMAPOBJ */
/* Create the BITMAPOBJ */
bmpobj
=
GDI_AllocObject
(
sizeof
(
BITMAPOBJ
),
BITMAP_MAGIC
,
bmpobj
=
GDI_AllocObject
(
sizeof
(
BITMAPOBJ
),
OBJ_BITMAP
,
(
HGDIOBJ
*
)
&
hbitmap
,
&
bitmap_funcs
);
(
HGDIOBJ
*
)
&
hbitmap
,
&
bitmap_funcs
);
if
(
!
bmpobj
)
if
(
!
bmpobj
)
{
{
...
@@ -325,7 +324,7 @@ LONG WINAPI GetBitmapBits(
...
@@ -325,7 +324,7 @@ LONG WINAPI GetBitmapBits(
LONG
count
,
/* [in] Number of bytes to copy */
LONG
count
,
/* [in] Number of bytes to copy */
LPVOID
bits
)
/* [out] Pointer to buffer to receive bits */
LPVOID
bits
)
/* [out] Pointer to buffer to receive bits */
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
);
LONG
height
,
ret
;
LONG
height
,
ret
;
if
(
!
bmp
)
return
0
;
if
(
!
bmp
)
return
0
;
...
@@ -436,7 +435,7 @@ LONG WINAPI SetBitmapBits(
...
@@ -436,7 +435,7 @@ LONG WINAPI SetBitmapBits(
LONG
count
,
/* [in] Number of bytes in bitmap array */
LONG
count
,
/* [in] Number of bytes in bitmap array */
LPCVOID
bits
)
/* [in] Address of array with bitmap bits */
LPCVOID
bits
)
/* [in] Address of array with bitmap bits */
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
);
LONG
height
,
ret
;
LONG
height
,
ret
;
if
((
!
bmp
)
||
(
!
bits
))
if
((
!
bmp
)
||
(
!
bits
))
...
@@ -540,7 +539,7 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc )
...
@@ -540,7 +539,7 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc )
/* never set the owner of the stock bitmap since it can be selected in multiple DCs */
/* never set the owner of the stock bitmap since it can be selected in multiple DCs */
if
(
hbitmap
==
GetStockObject
(
DEFAULT_BITMAP
))
return
TRUE
;
if
(
hbitmap
==
GetStockObject
(
DEFAULT_BITMAP
))
return
TRUE
;
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
)))
return
FALSE
;
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
)))
return
FALSE
;
ret
=
TRUE
;
ret
=
TRUE
;
if
(
!
bitmap
->
funcs
)
/* not owned by a DC yet */
if
(
!
bitmap
->
funcs
)
/* not owned by a DC yet */
...
@@ -578,7 +577,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -578,7 +577,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
ret
=
dc
->
hBitmap
;
ret
=
dc
->
hBitmap
;
if
(
handle
==
dc
->
hBitmap
)
goto
done
;
/* nothing to do */
if
(
handle
==
dc
->
hBitmap
)
goto
done
;
/* nothing to do */
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
handle
,
BITMAP_MAGIC
)))
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
handle
,
OBJ_BITMAP
)))
{
{
ret
=
0
;
ret
=
0
;
goto
done
;
goto
done
;
...
@@ -626,7 +625,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -626,7 +625,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
*/
*/
static
BOOL
BITMAP_DeleteObject
(
HGDIOBJ
handle
)
static
BOOL
BITMAP_DeleteObject
(
HGDIOBJ
handle
)
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
handle
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
handle
,
OBJ_BITMAP
);
if
(
!
bmp
)
return
FALSE
;
if
(
!
bmp
)
return
FALSE
;
...
@@ -673,7 +672,7 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
...
@@ -673,7 +672,7 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
static
INT
BITMAP_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
static
INT
BITMAP_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
{
{
INT
ret
;
INT
ret
;
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
handle
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
handle
,
OBJ_BITMAP
);
if
(
!
bmp
)
return
0
;
if
(
!
bmp
)
return
0
;
...
@@ -735,7 +734,7 @@ BOOL WINAPI GetBitmapDimensionEx(
...
@@ -735,7 +734,7 @@ BOOL WINAPI GetBitmapDimensionEx(
HBITMAP
hbitmap
,
/* [in] Handle to bitmap */
HBITMAP
hbitmap
,
/* [in] Handle to bitmap */
LPSIZE
size
)
/* [out] Address of struct receiving dimensions */
LPSIZE
size
)
/* [out] Address of struct receiving dimensions */
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
);
if
(
!
bmp
)
return
FALSE
;
if
(
!
bmp
)
return
FALSE
;
*
size
=
bmp
->
size
;
*
size
=
bmp
->
size
;
GDI_ReleaseObj
(
hbitmap
);
GDI_ReleaseObj
(
hbitmap
);
...
@@ -760,7 +759,7 @@ BOOL WINAPI SetBitmapDimensionEx(
...
@@ -760,7 +759,7 @@ BOOL WINAPI SetBitmapDimensionEx(
INT
y
,
/* [in] Bitmap height */
INT
y
,
/* [in] Bitmap height */
LPSIZE
prevSize
)
/* [out] Address of structure for orig dims */
LPSIZE
prevSize
)
/* [out] Address of structure for orig dims */
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
);
if
(
!
bmp
)
return
FALSE
;
if
(
!
bmp
)
return
FALSE
;
if
(
prevSize
)
*
prevSize
=
bmp
->
size
;
if
(
prevSize
)
*
prevSize
=
bmp
->
size
;
bmp
->
size
.
cx
=
x
;
bmp
->
size
.
cx
=
x
;
...
...
dlls/gdi32/brush.c
View file @
5811a2cc
...
@@ -104,8 +104,8 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
...
@@ -104,8 +104,8 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
BRUSHOBJ
*
ptr
;
BRUSHOBJ
*
ptr
;
HBRUSH
hbrush
;
HBRUSH
hbrush
;
if
(
!
(
ptr
=
GDI_AllocObject
(
sizeof
(
BRUSHOBJ
),
BRUSH_MAGIC
,
if
(
!
(
ptr
=
GDI_AllocObject
(
sizeof
(
BRUSHOBJ
),
OBJ_BRUSH
,
(
HGDIOBJ
*
)
&
hbrush
,
&
brush_funcs
)))
(
HGDIOBJ
*
)
&
hbrush
,
&
brush_funcs
)))
return
0
;
return
0
;
ptr
->
logbrush
.
lbStyle
=
brush
->
lbStyle
;
ptr
->
logbrush
.
lbStyle
=
brush
->
lbStyle
;
ptr
->
logbrush
.
lbColor
=
brush
->
lbColor
;
ptr
->
logbrush
.
lbColor
=
brush
->
lbColor
;
ptr
->
logbrush
.
lbHatch
=
brush
->
lbHatch
;
ptr
->
logbrush
.
lbHatch
=
brush
->
lbHatch
;
...
@@ -378,7 +378,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -378,7 +378,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
return
0
;
return
0
;
}
}
if
((
brush
=
GDI_GetObjPtr
(
handle
,
BRUSH_MAGIC
)))
if
((
brush
=
GDI_GetObjPtr
(
handle
,
OBJ_BRUSH
)))
{
{
if
(
brush
->
logbrush
.
lbStyle
==
BS_PATTERN
)
if
(
brush
->
logbrush
.
lbStyle
==
BS_PATTERN
)
BITMAP_SetOwnerDC
(
(
HBITMAP
)
brush
->
logbrush
.
lbHatch
,
dc
);
BITMAP_SetOwnerDC
(
(
HBITMAP
)
brush
->
logbrush
.
lbHatch
,
dc
);
...
@@ -407,7 +407,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -407,7 +407,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
*/
*/
static
BOOL
BRUSH_DeleteObject
(
HGDIOBJ
handle
)
static
BOOL
BRUSH_DeleteObject
(
HGDIOBJ
handle
)
{
{
BRUSHOBJ
*
brush
=
GDI_GetObjPtr
(
handle
,
BRUSH_MAGIC
);
BRUSHOBJ
*
brush
=
GDI_GetObjPtr
(
handle
,
OBJ_BRUSH
);
if
(
!
brush
)
return
FALSE
;
if
(
!
brush
)
return
FALSE
;
switch
(
brush
->
logbrush
.
lbStyle
)
switch
(
brush
->
logbrush
.
lbStyle
)
...
@@ -428,7 +428,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
...
@@ -428,7 +428,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
*/
*/
static
INT
BRUSH_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
static
INT
BRUSH_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
{
{
BRUSHOBJ
*
brush
=
GDI_GetObjPtr
(
handle
,
BRUSH_MAGIC
);
BRUSHOBJ
*
brush
=
GDI_GetObjPtr
(
handle
,
OBJ_BRUSH
);
if
(
!
brush
)
return
0
;
if
(
!
brush
)
return
0
;
if
(
buffer
)
if
(
buffer
)
...
@@ -465,7 +465,7 @@ BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor )
...
@@ -465,7 +465,7 @@ BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor )
BOOL16
res
=
FALSE
;
BOOL16
res
=
FALSE
;
TRACE
(
"(hBrush %04x, newColor %08x)
\n
"
,
hBrush
,
newColor
);
TRACE
(
"(hBrush %04x, newColor %08x)
\n
"
,
hBrush
,
newColor
);
if
(
!
(
brushPtr
=
GDI_GetObjPtr
(
HBRUSH_32
(
hBrush
),
BRUSH_MAGIC
)))
if
(
!
(
brushPtr
=
GDI_GetObjPtr
(
HBRUSH_32
(
hBrush
),
OBJ_BRUSH
)))
return
FALSE
;
return
FALSE
;
if
(
brushPtr
->
logbrush
.
lbStyle
==
BS_SOLID
)
if
(
brushPtr
->
logbrush
.
lbStyle
==
BS_SOLID
)
...
...
dlls/gdi32/clipping.c
View file @
5811a2cc
...
@@ -85,7 +85,7 @@ static inline void create_default_clip_region( DC * dc )
...
@@ -85,7 +85,7 @@ static inline void create_default_clip_region( DC * dc )
{
{
UINT
width
,
height
;
UINT
width
,
height
;
if
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
==
MEMORY_DC_MAGI
C
)
if
(
dc
->
header
.
type
==
OBJ_MEMD
C
)
{
{
BITMAP
bitmap
;
BITMAP
bitmap
;
...
...
dlls/gdi32/dc.c
View file @
5811a2cc
...
@@ -53,13 +53,13 @@ static const struct gdi_obj_funcs dc_funcs =
...
@@ -53,13 +53,13 @@ static const struct gdi_obj_funcs dc_funcs =
static
inline
DC
*
get_dc_obj
(
HDC
hdc
)
static
inline
DC
*
get_dc_obj
(
HDC
hdc
)
{
{
DC
*
dc
=
GDI_GetObjPtr
(
hdc
,
MAGIC_DONTCARE
);
DC
*
dc
=
GDI_GetObjPtr
(
hdc
,
0
);
if
(
!
dc
)
return
NULL
;
if
(
!
dc
)
return
NULL
;
if
((
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
DC_MAGI
C
)
&&
if
((
dc
->
header
.
type
!=
OBJ_D
C
)
&&
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
MEMORY_DC_MAGI
C
)
&&
(
dc
->
header
.
type
!=
OBJ_MEMD
C
)
&&
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
METAFILE_DC_MAGI
C
)
&&
(
dc
->
header
.
type
!=
OBJ_METAD
C
)
&&
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
ENHMETAFILE_DC_MAGI
C
))
(
dc
->
header
.
type
!=
OBJ_ENHMETAD
C
))
{
{
GDI_ReleaseObj
(
hdc
);
GDI_ReleaseObj
(
hdc
);
SetLastError
(
ERROR_INVALID_HANDLE
);
SetLastError
(
ERROR_INVALID_HANDLE
);
...
@@ -161,7 +161,7 @@ BOOL free_dc_ptr( DC *dc )
...
@@ -161,7 +161,7 @@ BOOL free_dc_ptr( DC *dc )
{
{
assert
(
dc
->
refcount
==
1
);
assert
(
dc
->
refcount
==
1
);
/* grab the gdi lock again */
/* grab the gdi lock again */
if
(
!
GDI_GetObjPtr
(
dc
->
hSelf
,
MAGIC_DONTCARE
))
return
FALSE
;
/* shouldn't happen */
if
(
!
GDI_GetObjPtr
(
dc
->
hSelf
,
0
))
return
FALSE
;
/* shouldn't happen */
return
GDI_FreeObject
(
dc
->
hSelf
,
dc
);
return
GDI_FreeObject
(
dc
->
hSelf
,
dc
);
}
}
...
@@ -332,7 +332,7 @@ static HDC GetDCState( HDC hdc )
...
@@ -332,7 +332,7 @@ static HDC GetDCState( HDC hdc )
HGDIOBJ
handle
;
HGDIOBJ
handle
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
0
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
0
;
if
(
!
(
newdc
=
GDI_AllocObject
(
sizeof
(
DC
),
GDIMAGIC
(
dc
->
header
.
wMagic
)
,
&
handle
,
&
dc_funcs
)))
if
(
!
(
newdc
=
GDI_AllocObject
(
sizeof
(
DC
),
dc
->
header
.
type
,
&
handle
,
&
dc_funcs
)))
{
{
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
return
0
;
return
0
;
...
@@ -673,7 +673,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
...
@@ -673,7 +673,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
ERR
(
"no driver found for %s
\n
"
,
debugstr_w
(
buf
)
);
ERR
(
"no driver found for %s
\n
"
,
debugstr_w
(
buf
)
);
return
0
;
return
0
;
}
}
if
(
!
(
dc
=
alloc_dc_ptr
(
funcs
,
DC_MAGI
C
)))
goto
error
;
if
(
!
(
dc
=
alloc_dc_ptr
(
funcs
,
OBJ_D
C
)))
goto
error
;
hdc
=
dc
->
hSelf
;
hdc
=
dc
->
hSelf
;
dc
->
hBitmap
=
GetStockObject
(
DEFAULT_BITMAP
);
dc
->
hBitmap
=
GetStockObject
(
DEFAULT_BITMAP
);
...
@@ -789,7 +789,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
...
@@ -789,7 +789,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
if
(
!
funcs
&&
!
(
funcs
=
DRIVER_load_driver
(
displayW
)))
return
0
;
if
(
!
funcs
&&
!
(
funcs
=
DRIVER_load_driver
(
displayW
)))
return
0
;
if
(
!
(
dc
=
alloc_dc_ptr
(
funcs
,
MEMORY_DC_MAGI
C
)))
goto
error
;
if
(
!
(
dc
=
alloc_dc_ptr
(
funcs
,
OBJ_MEMD
C
)))
goto
error
;
TRACE
(
"(%p): returning %p
\n
"
,
hdc
,
dc
->
hSelf
);
TRACE
(
"(%p): returning %p
\n
"
,
hdc
,
dc
->
hSelf
);
...
...
dlls/gdi32/dib.c
View file @
5811a2cc
...
@@ -235,7 +235,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
...
@@ -235,7 +235,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
dwRop
==
SRCCOPY
)
dwRop
==
SRCCOPY
)
{
{
BITMAPOBJ
*
bmp
;
BITMAPOBJ
*
bmp
;
if
((
bmp
=
GDI_GetObjPtr
(
hBitmap
,
BITMAP_MAGIC
)))
if
((
bmp
=
GDI_GetObjPtr
(
hBitmap
,
OBJ_BITMAP
)))
{
{
if
(
bmp
->
bitmap
.
bmBitsPixel
==
bpp
&&
if
(
bmp
->
bitmap
.
bmBitsPixel
==
bpp
&&
bmp
->
bitmap
.
bmWidth
==
widthSrc
&&
bmp
->
bitmap
.
bmWidth
==
widthSrc
&&
...
@@ -344,7 +344,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
...
@@ -344,7 +344,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
update_dc
(
dc
);
update_dc
(
dc
);
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
)))
if
(
!
(
bitmap
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
)))
{
{
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
return
0
;
return
0
;
...
@@ -411,7 +411,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA
...
@@ -411,7 +411,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
0
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
0
;
if
((
bitmap
=
GDI_GetObjPtr
(
dc
->
hBitmap
,
BITMAP_MAGIC
)))
if
((
bitmap
=
GDI_GetObjPtr
(
dc
->
hBitmap
,
OBJ_BITMAP
)))
{
{
/* Check if currently selected bitmap is a DIB */
/* Check if currently selected bitmap is a DIB */
if
(
bitmap
->
color_table
)
if
(
bitmap
->
color_table
)
...
@@ -448,7 +448,7 @@ UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *col
...
@@ -448,7 +448,7 @@ UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *col
result
=
dc
->
funcs
->
pGetDIBColorTable
(
dc
->
physDev
,
startpos
,
entries
,
colors
);
result
=
dc
->
funcs
->
pGetDIBColorTable
(
dc
->
physDev
,
startpos
,
entries
,
colors
);
else
else
{
{
BITMAPOBJ
*
bitmap
=
GDI_GetObjPtr
(
dc
->
hBitmap
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bitmap
=
GDI_GetObjPtr
(
dc
->
hBitmap
,
OBJ_BITMAP
);
if
(
bitmap
)
if
(
bitmap
)
{
{
/* Check if currently selected bitmap is a DIB */
/* Check if currently selected bitmap is a DIB */
...
@@ -609,7 +609,7 @@ INT WINAPI GetDIBits(
...
@@ -609,7 +609,7 @@ INT WINAPI GetDIBits(
return
0
;
return
0
;
}
}
update_dc
(
dc
);
update_dc
(
dc
);
if
(
!
(
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
)))
if
(
!
(
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
)))
{
{
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
return
0
;
return
0
;
...
@@ -1153,7 +1153,7 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us
...
@@ -1153,7 +1153,7 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us
hbitmap
=
CreateDIBSection
(
HDC_32
(
hdc
),
bmi
,
usage
,
&
bits32
,
section
,
offset
);
hbitmap
=
CreateDIBSection
(
HDC_32
(
hdc
),
bmi
,
usage
,
&
bits32
,
section
,
offset
);
if
(
hbitmap
)
if
(
hbitmap
)
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
);
if
(
bmp
&&
bmp
->
dib
&&
bits32
)
if
(
bmp
&&
bmp
->
dib
&&
bits32
)
{
{
const
BITMAPINFOHEADER
*
bi
=
&
bmi
->
bmiHeader
;
const
BITMAPINFOHEADER
*
bi
=
&
bmi
->
bmiHeader
;
...
@@ -1385,7 +1385,7 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
...
@@ -1385,7 +1385,7 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
ret
=
CreateBitmap
(
dib
->
dsBm
.
bmWidth
,
dib
->
dsBm
.
bmHeight
,
1
,
ret
=
CreateBitmap
(
dib
->
dsBm
.
bmWidth
,
dib
->
dsBm
.
bmHeight
,
1
,
(
bpp
==
1
)
?
1
:
GetDeviceCaps
(
hdc
,
BITSPIXEL
),
NULL
);
(
bpp
==
1
)
?
1
:
GetDeviceCaps
(
hdc
,
BITSPIXEL
),
NULL
);
if
(
ret
&&
((
bmp
=
GDI_GetObjPtr
(
ret
,
BITMAP_MAGIC
))))
if
(
ret
&&
((
bmp
=
GDI_GetObjPtr
(
ret
,
OBJ_BITMAP
))))
{
{
bmp
->
dib
=
dib
;
bmp
->
dib
=
dib
;
bmp
->
funcs
=
dc
->
funcs
;
bmp
->
funcs
=
dc
->
funcs
;
...
...
dlls/gdi32/enhmetafile.c
View file @
5811a2cc
...
@@ -261,9 +261,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
...
@@ -261,9 +261,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
return
0
;
return
0
;
}
}
metaObj
=
GDI_AllocObject
(
sizeof
(
ENHMETAFILEOBJ
),
metaObj
=
GDI_AllocObject
(
sizeof
(
ENHMETAFILEOBJ
),
OBJ_ENHMETAFILE
,
(
HGDIOBJ
*
)
&
hmf
,
NULL
);
ENHMETAFILE_MAGIC
,
(
HGDIOBJ
*
)
&
hmf
,
NULL
);
if
(
metaObj
)
if
(
metaObj
)
{
{
metaObj
->
emh
=
emh
;
metaObj
->
emh
=
emh
;
...
@@ -278,7 +276,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
...
@@ -278,7 +276,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
*/
*/
static
BOOL
EMF_Delete_HENHMETAFILE
(
HENHMETAFILE
hmf
)
static
BOOL
EMF_Delete_HENHMETAFILE
(
HENHMETAFILE
hmf
)
{
{
ENHMETAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
ENHMETAFILE_MAGIC
);
ENHMETAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
OBJ_ENHMETAFILE
);
if
(
!
metaObj
)
return
FALSE
;
if
(
!
metaObj
)
return
FALSE
;
...
@@ -297,7 +295,7 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
...
@@ -297,7 +295,7 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
static
ENHMETAHEADER
*
EMF_GetEnhMetaHeader
(
HENHMETAFILE
hmf
)
static
ENHMETAHEADER
*
EMF_GetEnhMetaHeader
(
HENHMETAFILE
hmf
)
{
{
ENHMETAHEADER
*
ret
=
NULL
;
ENHMETAHEADER
*
ret
=
NULL
;
ENHMETAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
ENHMETAFILE_MAGIC
);
ENHMETAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
OBJ_ENHMETAFILE
);
TRACE
(
"hmf %p -> enhmetaObj %p
\n
"
,
hmf
,
metaObj
);
TRACE
(
"hmf %p -> enhmetaObj %p
\n
"
,
hmf
,
metaObj
);
if
(
metaObj
)
if
(
metaObj
)
{
{
...
...
dlls/gdi32/enhmfdrv/init.c
View file @
5811a2cc
...
@@ -315,7 +315,7 @@ HDC WINAPI CreateEnhMetaFileW(
...
@@ -315,7 +315,7 @@ HDC WINAPI CreateEnhMetaFileW(
TRACE
(
"%s
\n
"
,
debugstr_w
(
filename
)
);
TRACE
(
"%s
\n
"
,
debugstr_w
(
filename
)
);
if
(
!
(
dc
=
alloc_dc_ptr
(
&
EMFDRV_Funcs
,
ENHMETAFILE_DC_MAGI
C
)))
return
0
;
if
(
!
(
dc
=
alloc_dc_ptr
(
&
EMFDRV_Funcs
,
OBJ_ENHMETAD
C
)))
return
0
;
physDev
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
physDev
));
physDev
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
physDev
));
if
(
!
physDev
)
{
if
(
!
physDev
)
{
...
@@ -438,7 +438,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
...
@@ -438,7 +438,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
TRACE
(
"(%p)
\n
"
,
hdc
);
TRACE
(
"(%p)
\n
"
,
hdc
);
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
NULL
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
NULL
;
if
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
ENHMETAFILE_DC_MAGI
C
)
if
(
dc
->
header
.
type
!=
OBJ_ENHMETAD
C
)
{
{
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
return
NULL
;
return
NULL
;
...
...
dlls/gdi32/font.c
View file @
5811a2cc
...
@@ -345,8 +345,8 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
...
@@ -345,8 +345,8 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
if
(
!
plf
)
return
0
;
if
(
!
plf
)
return
0
;
if
(
!
(
fontPtr
=
GDI_AllocObject
(
sizeof
(
FONTOBJ
),
FONT_MAGIC
,
(
HGDIOBJ
*
)
&
hFont
,
if
(
!
(
fontPtr
=
GDI_AllocObject
(
sizeof
(
FONTOBJ
),
OBJ_FONT
,
(
HGDIOBJ
*
)
&
hFont
,
&
font_funcs
)))
&
font_funcs
)))
return
0
;
return
0
;
fontPtr
->
logfont
=
*
plf
;
fontPtr
->
logfont
=
*
plf
;
...
@@ -486,7 +486,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -486,7 +486,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
if
(
GetDeviceCaps
(
dc
->
hSelf
,
TEXTCAPS
)
&
TC_VA_ABLE
)
if
(
GetDeviceCaps
(
dc
->
hSelf
,
TEXTCAPS
)
&
TC_VA_ABLE
)
{
{
FONTOBJ
*
font
=
GDI_GetObjPtr
(
handle
,
FONT_MAGIC
);
/* to grab the GDI lock (FIXME) */
FONTOBJ
*
font
=
GDI_GetObjPtr
(
handle
,
OBJ_FONT
);
/* to grab the GDI lock (FIXME) */
dc
->
gdiFont
=
WineEngCreateFontInstance
(
dc
,
handle
);
dc
->
gdiFont
=
WineEngCreateFontInstance
(
dc
,
handle
);
if
(
font
)
GDI_ReleaseObj
(
handle
);
if
(
font
)
GDI_ReleaseObj
(
handle
);
}
}
...
@@ -516,7 +516,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -516,7 +516,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
*/
*/
static
INT
FONT_GetObjectA
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
static
INT
FONT_GetObjectA
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
{
{
FONTOBJ
*
font
=
GDI_GetObjPtr
(
handle
,
FONT_MAGIC
);
FONTOBJ
*
font
=
GDI_GetObjPtr
(
handle
,
OBJ_FONT
);
LOGFONTA
lfA
;
LOGFONTA
lfA
;
if
(
!
font
)
return
0
;
if
(
!
font
)
return
0
;
...
@@ -536,7 +536,7 @@ static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -536,7 +536,7 @@ static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
*/
*/
static
INT
FONT_GetObjectW
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
static
INT
FONT_GetObjectW
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
{
{
FONTOBJ
*
font
=
GDI_GetObjPtr
(
handle
,
FONT_MAGIC
);
FONTOBJ
*
font
=
GDI_GetObjPtr
(
handle
,
OBJ_FONT
);
if
(
!
font
)
return
0
;
if
(
!
font
)
return
0
;
if
(
buffer
)
if
(
buffer
)
...
@@ -555,7 +555,7 @@ static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -555,7 +555,7 @@ static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
*/
*/
static
BOOL
FONT_DeleteObject
(
HGDIOBJ
handle
)
static
BOOL
FONT_DeleteObject
(
HGDIOBJ
handle
)
{
{
FONTOBJ
*
obj
=
GDI_GetObjPtr
(
handle
,
FONT_MAGIC
);
/* to grab the GDI lock (FIXME) */
FONTOBJ
*
obj
=
GDI_GetObjPtr
(
handle
,
OBJ_FONT
);
/* to grab the GDI lock (FIXME) */
if
(
!
obj
)
return
FALSE
;
if
(
!
obj
)
return
FALSE
;
WineEngDestroyFontInstance
(
handle
);
WineEngDestroyFontInstance
(
handle
);
return
GDI_FreeObject
(
handle
,
obj
);
return
GDI_FreeObject
(
handle
,
obj
);
...
@@ -838,7 +838,7 @@ INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
...
@@ -838,7 +838,7 @@ INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
if
(
dc
->
gdiFont
)
if
(
dc
->
gdiFont
)
ret
=
WineEngGetTextFace
(
dc
->
gdiFont
,
count
,
name
);
ret
=
WineEngGetTextFace
(
dc
->
gdiFont
,
count
,
name
);
else
if
((
font
=
GDI_GetObjPtr
(
dc
->
hFont
,
FONT_MAGIC
)))
else
if
((
font
=
GDI_GetObjPtr
(
dc
->
hFont
,
OBJ_FONT
)))
{
{
INT
n
=
strlenW
(
font
->
logfont
.
lfFaceName
)
+
1
;
INT
n
=
strlenW
(
font
->
logfont
.
lfFaceName
)
+
1
;
if
(
name
)
if
(
name
)
...
...
dlls/gdi32/gdi_private.h
View file @
5811a2cc
...
@@ -42,33 +42,6 @@ typedef struct {
...
@@ -42,33 +42,6 @@ typedef struct {
/* extra stock object: default 1x1 bitmap for memory DCs */
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
#define DEFAULT_BITMAP (STOCK_LAST+1)
/* GDI objects magic numbers */
#define FIRST_MAGIC 0x4f47
#define PEN_MAGIC 0x4f47
#define BRUSH_MAGIC 0x4f48
#define FONT_MAGIC 0x4f49
#define PALETTE_MAGIC 0x4f4a
#define BITMAP_MAGIC 0x4f4b
#define REGION_MAGIC 0x4f4c
#define DC_MAGIC 0x4f4d
#define DISABLED_DC_MAGIC 0x4f4e
#define META_DC_MAGIC 0x4f4f
#define METAFILE_MAGIC 0x4f50
#define METAFILE_DC_MAGIC 0x4f51
#define ENHMETAFILE_MAGIC 0x4f52
#define ENHMETAFILE_DC_MAGIC 0x4f53
#define MEMORY_DC_MAGIC 0x4f54
#define EXT_PEN_MAGIC 0x4f55
#define LAST_MAGIC 0x4f55
#define MAGIC_DONTCARE 0xffff
/* GDI constants for making objects private/system (naming undoc. !) */
#define OBJECT_PRIVATE 0x2000
#define OBJECT_NOSYSTEM 0x8000
#define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
struct
gdi_obj_funcs
struct
gdi_obj_funcs
{
{
HGDIOBJ
(
*
pSelectObject
)(
HGDIOBJ
handle
,
HDC
hdc
);
HGDIOBJ
(
*
pSelectObject
)(
HGDIOBJ
handle
,
HDC
hdc
);
...
@@ -86,7 +59,8 @@ struct hdc_list
...
@@ -86,7 +59,8 @@ struct hdc_list
typedef
struct
tagGDIOBJHDR
typedef
struct
tagGDIOBJHDR
{
{
WORD
wMagic
;
WORD
type
;
WORD
system
:
1
;
DWORD
dwCount
;
DWORD
dwCount
;
const
struct
gdi_obj_funcs
*
funcs
;
const
struct
gdi_obj_funcs
*
funcs
;
struct
hdc_list
*
hdcs
;
struct
hdc_list
*
hdcs
;
...
...
dlls/gdi32/gdiobj.c
View file @
5811a2cc
...
@@ -444,14 +444,8 @@ static const struct DefaultFontInfo default_fonts[] =
...
@@ -444,14 +444,8 @@ static const struct DefaultFontInfo default_fonts[] =
*/
*/
void
CDECL
__wine_make_gdi_object_system
(
HGDIOBJ
handle
,
BOOL
set
)
void
CDECL
__wine_make_gdi_object_system
(
HGDIOBJ
handle
,
BOOL
set
)
{
{
GDIOBJHDR
*
ptr
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
);
GDIOBJHDR
*
ptr
=
GDI_GetObjPtr
(
handle
,
0
);
ptr
->
system
=
!!
set
;
/* touch the "system" bit of the wMagic field of a GDIOBJHDR */
if
(
set
)
ptr
->
wMagic
&=
~
OBJECT_NOSYSTEM
;
else
ptr
->
wMagic
|=
OBJECT_NOSYSTEM
;
GDI_ReleaseObj
(
handle
);
GDI_ReleaseObj
(
handle
);
}
}
...
@@ -532,7 +526,7 @@ BOOL GDI_inc_ref_count( HGDIOBJ handle )
...
@@ -532,7 +526,7 @@ BOOL GDI_inc_ref_count( HGDIOBJ handle )
{
{
GDIOBJHDR
*
header
;
GDIOBJHDR
*
header
;
if
((
header
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
)))
if
((
header
=
GDI_GetObjPtr
(
handle
,
0
)))
{
{
header
->
dwCount
++
;
header
->
dwCount
++
;
GDI_ReleaseObj
(
handle
);
GDI_ReleaseObj
(
handle
);
...
@@ -550,7 +544,7 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
...
@@ -550,7 +544,7 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
{
{
GDIOBJHDR
*
header
;
GDIOBJHDR
*
header
;
if
((
header
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
)))
if
((
header
=
GDI_GetObjPtr
(
handle
,
0
)))
{
{
if
(
header
->
dwCount
)
header
->
dwCount
--
;
if
(
header
->
dwCount
)
header
->
dwCount
--
;
if
(
header
->
dwCount
!=
0x80000000
)
GDI_ReleaseObj
(
handle
);
if
(
header
->
dwCount
!=
0x80000000
)
GDI_ReleaseObj
(
handle
);
...
@@ -666,14 +660,15 @@ static inline GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle )
...
@@ -666,14 +660,15 @@ static inline GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle )
/***********************************************************************
/***********************************************************************
* GDI_AllocObject
* GDI_AllocObject
*/
*/
void
*
GDI_AllocObject
(
WORD
size
,
WORD
magic
,
HGDIOBJ
*
handle
,
const
struct
gdi_obj_funcs
*
funcs
)
void
*
GDI_AllocObject
(
WORD
size
,
WORD
type
,
HGDIOBJ
*
handle
,
const
struct
gdi_obj_funcs
*
funcs
)
{
{
GDIOBJHDR
*
obj
=
NULL
;
GDIOBJHDR
*
obj
=
NULL
;
_EnterSysLevel
(
&
GDI_level
);
_EnterSysLevel
(
&
GDI_level
);
if
(
!
(
obj
=
alloc_large_heap
(
size
,
handle
)))
goto
error
;
if
(
!
(
obj
=
alloc_large_heap
(
size
,
handle
)))
goto
error
;
obj
->
wMagic
=
magic
|
OBJECT_NOSYSTEM
;
obj
->
type
=
type
;
obj
->
system
=
0
;
obj
->
dwCount
=
0
;
obj
->
dwCount
=
0
;
obj
->
funcs
=
funcs
;
obj
->
funcs
=
funcs
;
obj
->
hdcs
=
NULL
;
obj
->
hdcs
=
NULL
;
...
@@ -723,7 +718,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
...
@@ -723,7 +718,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
GDIOBJHDR
*
object
=
ptr
;
GDIOBJHDR
*
object
=
ptr
;
int
i
;
int
i
;
object
->
wMagic
=
0
;
/* Mark it as invalid */
object
->
type
=
0
;
/* Mark it as invalid */
object
->
funcs
=
NULL
;
object
->
funcs
=
NULL
;
i
=
((
ULONG_PTR
)
handle
>>
2
)
-
FIRST_LARGE_HANDLE
;
i
=
((
ULONG_PTR
)
handle
>>
2
)
-
FIRST_LARGE_HANDLE
;
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
)
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
)
...
@@ -745,7 +740,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
...
@@ -745,7 +740,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
* Return NULL if the object has the wrong magic number.
* Return NULL if the object has the wrong magic number.
* The object must be released with GDI_ReleaseObj.
* The object must be released with GDI_ReleaseObj.
*/
*/
void
*
GDI_GetObjPtr
(
HGDIOBJ
handle
,
WORD
magic
)
void
*
GDI_GetObjPtr
(
HGDIOBJ
handle
,
WORD
type
)
{
{
GDIOBJHDR
*
ptr
=
NULL
;
GDIOBJHDR
*
ptr
=
NULL
;
int
i
;
int
i
;
...
@@ -756,7 +751,7 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
...
@@ -756,7 +751,7 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
)
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
)
{
{
ptr
=
large_handles
[
i
];
ptr
=
large_handles
[
i
];
if
(
ptr
&&
(
magic
!=
MAGIC_DONTCARE
)
&&
(
GDIMAGIC
(
ptr
->
wMagic
)
!=
magic
)
)
ptr
=
NULL
;
if
(
ptr
&&
type
&&
ptr
->
type
!=
type
)
ptr
=
NULL
;
}
}
if
(
!
ptr
)
if
(
!
ptr
)
...
@@ -814,10 +809,9 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
...
@@ -814,10 +809,9 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
if
(
HIWORD
(
obj
))
return
FALSE
;
if
(
HIWORD
(
obj
))
return
FALSE
;
if
(
!
(
header
=
GDI_GetObjPtr
(
obj
,
MAGIC_DONTCARE
)))
return
FALSE
;
if
(
!
(
header
=
GDI_GetObjPtr
(
obj
,
0
)))
return
FALSE
;
if
(
!
(
header
->
wMagic
&
OBJECT_NOSYSTEM
)
if
(
header
->
system
)
&&
(
header
->
wMagic
>=
FIRST_MAGIC
)
&&
(
header
->
wMagic
<=
LAST_MAGIC
))
{
{
TRACE
(
"Preserving system object %p
\n
"
,
obj
);
TRACE
(
"Preserving system object %p
\n
"
,
obj
);
GDI_ReleaseObj
(
obj
);
GDI_ReleaseObj
(
obj
);
...
@@ -837,7 +831,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
...
@@ -837,7 +831,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
{
{
GDI_ReleaseObj
(
obj
);
/* release the GDI lock */
GDI_ReleaseObj
(
obj
);
/* release the GDI lock */
dc
->
funcs
->
pDeleteObject
(
dc
->
physDev
,
obj
);
dc
->
funcs
->
pDeleteObject
(
dc
->
physDev
,
obj
);
header
=
GDI_GetObjPtr
(
obj
,
MAGIC_DONTCARE
);
/* and grab it again */
header
=
GDI_GetObjPtr
(
obj
,
0
);
/* and grab it again */
}
}
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
}
}
...
@@ -877,10 +871,9 @@ BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc)
...
@@ -877,10 +871,9 @@ BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc)
TRACE
(
"obj %p hdc %p
\n
"
,
obj
,
hdc
);
TRACE
(
"obj %p hdc %p
\n
"
,
obj
,
hdc
);
if
(
!
(
header
=
GDI_GetObjPtr
(
obj
,
MAGIC_DONTCARE
)))
return
FALSE
;
if
(
!
(
header
=
GDI_GetObjPtr
(
obj
,
0
)))
return
FALSE
;
if
(
!
(
header
->
wMagic
&
OBJECT_NOSYSTEM
)
&&
if
(
header
->
system
)
(
header
->
wMagic
>=
FIRST_MAGIC
)
&&
(
header
->
wMagic
<=
LAST_MAGIC
))
{
{
GDI_ReleaseObj
(
obj
);
GDI_ReleaseObj
(
obj
);
return
FALSE
;
return
FALSE
;
...
@@ -911,10 +904,9 @@ BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc)
...
@@ -911,10 +904,9 @@ BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc)
TRACE
(
"obj %p hdc %p
\n
"
,
obj
,
hdc
);
TRACE
(
"obj %p hdc %p
\n
"
,
obj
,
hdc
);
if
(
!
(
header
=
GDI_GetObjPtr
(
obj
,
MAGIC_DONTCARE
)))
return
FALSE
;
if
(
!
(
header
=
GDI_GetObjPtr
(
obj
,
0
)))
return
FALSE
;
if
(
!
(
header
->
wMagic
&
OBJECT_NOSYSTEM
)
&&
if
(
header
->
system
)
(
header
->
wMagic
>=
FIRST_MAGIC
)
&&
(
header
->
wMagic
<=
LAST_MAGIC
))
{
{
GDI_ReleaseObj
(
obj
);
GDI_ReleaseObj
(
obj
);
return
FALSE
;
return
FALSE
;
...
@@ -962,7 +954,7 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -962,7 +954,7 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
TRACE
(
"%p %d %p
\n
"
,
handle
,
count
,
buffer
);
TRACE
(
"%p %d %p
\n
"
,
handle
,
count
,
buffer
);
if
(
!
(
ptr
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
)))
return
0
;
if
(
!
(
ptr
=
GDI_GetObjPtr
(
handle
,
0
)))
return
0
;
funcs
=
ptr
->
funcs
;
funcs
=
ptr
->
funcs
;
GDI_ReleaseObj
(
handle
);
GDI_ReleaseObj
(
handle
);
...
@@ -984,7 +976,7 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -984,7 +976,7 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
INT
result
=
0
;
INT
result
=
0
;
TRACE
(
"%p %d %p
\n
"
,
handle
,
count
,
buffer
);
TRACE
(
"%p %d %p
\n
"
,
handle
,
count
,
buffer
);
if
(
!
(
ptr
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
)))
return
0
;
if
(
!
(
ptr
=
GDI_GetObjPtr
(
handle
,
0
)))
return
0
;
funcs
=
ptr
->
funcs
;
funcs
=
ptr
->
funcs
;
GDI_ReleaseObj
(
handle
);
GDI_ReleaseObj
(
handle
);
...
@@ -1002,64 +994,16 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -1002,64 +994,16 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
DWORD
WINAPI
GetObjectType
(
HGDIOBJ
handle
)
DWORD
WINAPI
GetObjectType
(
HGDIOBJ
handle
)
{
{
GDIOBJHDR
*
ptr
;
GDIOBJHDR
*
ptr
;
INT
result
=
0
;
DWORD
result
;
TRACE
(
"%p
\n
"
,
handle
);
if
(
!
(
ptr
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
)))
if
(
!
(
ptr
=
GDI_GetObjPtr
(
handle
,
0
)))
{
{
SetLastError
(
ERROR_INVALID_HANDLE
);
SetLastError
(
ERROR_INVALID_HANDLE
);
return
0
;
return
0
;
}
}
result
=
ptr
->
type
;
switch
(
GDIMAGIC
(
ptr
->
wMagic
))
{
case
PEN_MAGIC
:
result
=
OBJ_PEN
;
break
;
case
EXT_PEN_MAGIC
:
result
=
OBJ_EXTPEN
;
break
;
case
BRUSH_MAGIC
:
result
=
OBJ_BRUSH
;
break
;
case
BITMAP_MAGIC
:
result
=
OBJ_BITMAP
;
break
;
case
FONT_MAGIC
:
result
=
OBJ_FONT
;
break
;
case
PALETTE_MAGIC
:
result
=
OBJ_PAL
;
break
;
case
REGION_MAGIC
:
result
=
OBJ_REGION
;
break
;
case
DC_MAGIC
:
result
=
OBJ_DC
;
break
;
case
META_DC_MAGIC
:
result
=
OBJ_METADC
;
break
;
case
METAFILE_MAGIC
:
result
=
OBJ_METAFILE
;
break
;
case
METAFILE_DC_MAGIC
:
result
=
OBJ_METADC
;
break
;
case
ENHMETAFILE_MAGIC
:
result
=
OBJ_ENHMETAFILE
;
break
;
case
ENHMETAFILE_DC_MAGIC
:
result
=
OBJ_ENHMETADC
;
break
;
case
MEMORY_DC_MAGIC
:
result
=
OBJ_MEMDC
;
break
;
default:
FIXME
(
"Magic %04x not implemented
\n
"
,
GDIMAGIC
(
ptr
->
wMagic
)
);
break
;
}
GDI_ReleaseObj
(
handle
);
GDI_ReleaseObj
(
handle
);
TRACE
(
"%p -> %u
\n
"
,
handle
,
result
);
return
result
;
return
result
;
}
}
...
@@ -1134,7 +1078,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
...
@@ -1134,7 +1078,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
TRACE
(
"(%p,%p)
\n
"
,
hdc
,
hObj
);
TRACE
(
"(%p,%p)
\n
"
,
hdc
,
hObj
);
header
=
GDI_GetObjPtr
(
hObj
,
MAGIC_DONTCARE
);
header
=
GDI_GetObjPtr
(
hObj
,
0
);
if
(
header
)
if
(
header
)
{
{
const
struct
gdi_obj_funcs
*
funcs
=
header
->
funcs
;
const
struct
gdi_obj_funcs
*
funcs
=
header
->
funcs
;
...
@@ -1151,7 +1095,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
...
@@ -1151,7 +1095,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
BOOL
WINAPI
UnrealizeObject
(
HGDIOBJ
obj
)
BOOL
WINAPI
UnrealizeObject
(
HGDIOBJ
obj
)
{
{
BOOL
result
=
FALSE
;
BOOL
result
=
FALSE
;
GDIOBJHDR
*
header
=
GDI_GetObjPtr
(
obj
,
MAGIC_DONTCARE
);
GDIOBJHDR
*
header
=
GDI_GetObjPtr
(
obj
,
0
);
if
(
header
)
if
(
header
)
{
{
...
@@ -1259,21 +1203,10 @@ void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
...
@@ -1259,21 +1203,10 @@ void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
* What does that mean ?
* What does that mean ?
* Some little docu can be found in "Undocumented Windows",
* Some little docu can be found in "Undocumented Windows",
* but this is basically useless.
* but this is basically useless.
* At least we know that this flags the GDI object's wMagic
* with 0x2000 (OBJECT_PRIVATE), so we just do it.
* But Wine doesn't react on that yet.
*/
*/
void
WINAPI
MakeObjectPrivate16
(
HGDIOBJ16
handle16
,
BOOL16
private
)
void
WINAPI
MakeObjectPrivate16
(
HGDIOBJ16
handle16
,
BOOL16
private
)
{
{
HGDIOBJ
handle
=
HGDIOBJ_32
(
handle16
);
FIXME
(
"stub: %x %u
\n
"
,
handle16
,
private
);
GDIOBJHDR
*
ptr
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
);
if
(
!
ptr
)
{
ERR
(
"invalid GDI object %p !
\n
"
,
handle
);
return
;
}
ptr
->
wMagic
|=
OBJECT_PRIVATE
;
GDI_ReleaseObj
(
handle
);
}
}
...
...
dlls/gdi32/metafile.c
View file @
5811a2cc
...
@@ -108,8 +108,7 @@ static int MF_AddHandle(HANDLETABLE *ht, UINT htlen, HGDIOBJ hobj)
...
@@ -108,8 +108,7 @@ static int MF_AddHandle(HANDLETABLE *ht, UINT htlen, HGDIOBJ hobj)
HMETAFILE
MF_Create_HMETAFILE
(
METAHEADER
*
mh
)
HMETAFILE
MF_Create_HMETAFILE
(
METAHEADER
*
mh
)
{
{
HMETAFILE
hmf
=
0
;
HMETAFILE
hmf
=
0
;
METAFILEOBJ
*
metaObj
=
GDI_AllocObject
(
sizeof
(
METAFILEOBJ
),
METAFILE_MAGIC
,
METAFILEOBJ
*
metaObj
=
GDI_AllocObject
(
sizeof
(
METAFILEOBJ
),
OBJ_METAFILE
,
(
HGDIOBJ
*
)
&
hmf
,
NULL
);
(
HGDIOBJ
*
)
&
hmf
,
NULL
);
if
(
metaObj
)
if
(
metaObj
)
{
{
metaObj
->
mh
=
mh
;
metaObj
->
mh
=
mh
;
...
@@ -126,7 +125,7 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
...
@@ -126,7 +125,7 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
static
METAHEADER
*
MF_GetMetaHeader
(
HMETAFILE
hmf
)
static
METAHEADER
*
MF_GetMetaHeader
(
HMETAFILE
hmf
)
{
{
METAHEADER
*
ret
=
NULL
;
METAHEADER
*
ret
=
NULL
;
METAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
METAFILE_MAGIC
);
METAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
OBJ_METAFILE
);
if
(
metaObj
)
if
(
metaObj
)
{
{
ret
=
metaObj
->
mh
;
ret
=
metaObj
->
mh
;
...
@@ -164,7 +163,7 @@ static POINT *convert_points( UINT count, POINT16 *pt16 )
...
@@ -164,7 +163,7 @@ static POINT *convert_points( UINT count, POINT16 *pt16 )
BOOL
WINAPI
DeleteMetaFile
(
HMETAFILE
hmf
)
BOOL
WINAPI
DeleteMetaFile
(
HMETAFILE
hmf
)
{
{
METAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
METAFILE_MAGIC
);
METAFILEOBJ
*
metaObj
=
GDI_GetObjPtr
(
hmf
,
OBJ_METAFILE
);
if
(
!
metaObj
)
return
FALSE
;
if
(
!
metaObj
)
return
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
metaObj
->
mh
);
HeapFree
(
GetProcessHeap
(),
0
,
metaObj
->
mh
);
GDI_FreeObject
(
hmf
,
metaObj
);
GDI_FreeObject
(
hmf
,
metaObj
);
...
...
dlls/gdi32/mfdrv/init.c
View file @
5811a2cc
...
@@ -166,7 +166,7 @@ static DC *MFDRV_AllocMetaFile(void)
...
@@ -166,7 +166,7 @@ static DC *MFDRV_AllocMetaFile(void)
DC
*
dc
;
DC
*
dc
;
METAFILEDRV_PDEVICE
*
physDev
;
METAFILEDRV_PDEVICE
*
physDev
;
if
(
!
(
dc
=
alloc_dc_ptr
(
&
MFDRV_Funcs
,
METAFILE_DC_MAGI
C
)))
return
NULL
;
if
(
!
(
dc
=
alloc_dc_ptr
(
&
MFDRV_Funcs
,
OBJ_METAD
C
)))
return
NULL
;
physDev
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
physDev
));
physDev
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
physDev
));
if
(
!
physDev
)
if
(
!
physDev
)
...
@@ -308,7 +308,7 @@ static DC *MFDRV_CloseMetaFile( HDC hdc )
...
@@ -308,7 +308,7 @@ static DC *MFDRV_CloseMetaFile( HDC hdc )
TRACE
(
"(%p)
\n
"
,
hdc
);
TRACE
(
"(%p)
\n
"
,
hdc
);
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
NULL
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
NULL
;
if
(
GDIMAGIC
(
dc
->
header
.
wMagic
)
!=
METAFILE_DC_MAGI
C
)
if
(
dc
->
header
.
type
!=
OBJ_METAD
C
)
{
{
release_dc_ptr
(
dc
);
release_dc_ptr
(
dc
);
return
NULL
;
return
NULL
;
...
...
dlls/gdi32/palette.c
View file @
5811a2cc
...
@@ -150,8 +150,7 @@ HPALETTE WINAPI CreatePalette(
...
@@ -150,8 +150,7 @@ HPALETTE WINAPI CreatePalette(
size
=
sizeof
(
LOGPALETTE
)
+
(
palette
->
palNumEntries
-
1
)
*
sizeof
(
PALETTEENTRY
);
size
=
sizeof
(
LOGPALETTE
)
+
(
palette
->
palNumEntries
-
1
)
*
sizeof
(
PALETTEENTRY
);
if
(
!
(
palettePtr
=
GDI_AllocObject
(
size
+
sizeof
(
int
*
)
+
sizeof
(
GDIOBJHDR
),
if
(
!
(
palettePtr
=
GDI_AllocObject
(
size
+
sizeof
(
int
*
)
+
sizeof
(
GDIOBJHDR
),
PALETTE_MAGIC
,
(
HGDIOBJ
*
)
&
hpalette
,
OBJ_PAL
,
(
HGDIOBJ
*
)
&
hpalette
,
&
palette_funcs
)))
return
0
;
&
palette_funcs
)))
return
0
;
memcpy
(
&
palettePtr
->
logpalette
,
palette
,
size
);
memcpy
(
&
palettePtr
->
logpalette
,
palette
,
size
);
palettePtr
->
funcs
=
NULL
;
palettePtr
->
funcs
=
NULL
;
GDI_ReleaseObj
(
hpalette
);
GDI_ReleaseObj
(
hpalette
);
...
@@ -278,7 +277,7 @@ UINT WINAPI GetPaletteEntries(
...
@@ -278,7 +277,7 @@ UINT WINAPI GetPaletteEntries(
TRACE
(
"hpal = %p, count=%i
\n
"
,
hpalette
,
count
);
TRACE
(
"hpal = %p, count=%i
\n
"
,
hpalette
,
count
);
palPtr
=
GDI_GetObjPtr
(
hpalette
,
PALETTE_MAGIC
);
palPtr
=
GDI_GetObjPtr
(
hpalette
,
OBJ_PAL
);
if
(
!
palPtr
)
return
0
;
if
(
!
palPtr
)
return
0
;
/* NOTE: not documented but test show this to be the case */
/* NOTE: not documented but test show this to be the case */
...
@@ -328,7 +327,7 @@ UINT WINAPI SetPaletteEntries(
...
@@ -328,7 +327,7 @@ UINT WINAPI SetPaletteEntries(
TRACE
(
"hpal=%p,start=%i,count=%i
\n
"
,
hpalette
,
start
,
count
);
TRACE
(
"hpal=%p,start=%i,count=%i
\n
"
,
hpalette
,
start
,
count
);
if
(
hpalette
==
GetStockObject
(
DEFAULT_PALETTE
))
return
0
;
if
(
hpalette
==
GetStockObject
(
DEFAULT_PALETTE
))
return
0
;
palPtr
=
GDI_GetObjPtr
(
hpalette
,
PALETTE_MAGIC
);
palPtr
=
GDI_GetObjPtr
(
hpalette
,
OBJ_PAL
);
if
(
!
palPtr
)
return
0
;
if
(
!
palPtr
)
return
0
;
numEntries
=
palPtr
->
logpalette
.
palNumEntries
;
numEntries
=
palPtr
->
logpalette
.
palNumEntries
;
...
@@ -359,7 +358,7 @@ BOOL WINAPI ResizePalette(
...
@@ -359,7 +358,7 @@ BOOL WINAPI ResizePalette(
HPALETTE
hPal
,
/* [in] Handle of logical palette */
HPALETTE
hPal
,
/* [in] Handle of logical palette */
UINT
cEntries
)
/* [in] Number of entries in logical palette */
UINT
cEntries
)
/* [in] Number of entries in logical palette */
{
{
PALETTEOBJ
*
palPtr
=
GDI_GetObjPtr
(
hPal
,
PALETTE_MAGIC
);
PALETTEOBJ
*
palPtr
=
GDI_GetObjPtr
(
hPal
,
OBJ_PAL
);
UINT
cPrevEnt
,
prevVer
;
UINT
cPrevEnt
,
prevVer
;
int
prevsize
,
size
=
sizeof
(
LOGPALETTE
)
+
(
cEntries
-
1
)
*
sizeof
(
PALETTEENTRY
);
int
prevsize
,
size
=
sizeof
(
LOGPALETTE
)
+
(
cEntries
-
1
)
*
sizeof
(
PALETTEENTRY
);
...
@@ -409,7 +408,7 @@ BOOL WINAPI AnimatePalette(
...
@@ -409,7 +408,7 @@ BOOL WINAPI AnimatePalette(
UINT
pal_entries
;
UINT
pal_entries
;
const
PALETTEENTRY
*
pptr
=
PaletteColors
;
const
PALETTEENTRY
*
pptr
=
PaletteColors
;
palPtr
=
GDI_GetObjPtr
(
hPal
,
PALETTE_MAGIC
);
palPtr
=
GDI_GetObjPtr
(
hPal
,
OBJ_PAL
);
if
(
!
palPtr
)
return
0
;
if
(
!
palPtr
)
return
0
;
pal_entries
=
palPtr
->
logpalette
.
palNumEntries
;
pal_entries
=
palPtr
->
logpalette
.
palNumEntries
;
...
@@ -536,7 +535,7 @@ UINT WINAPI GetNearestPaletteIndex(
...
@@ -536,7 +535,7 @@ UINT WINAPI GetNearestPaletteIndex(
HPALETTE
hpalette
,
/* [in] Handle of logical color palette */
HPALETTE
hpalette
,
/* [in] Handle of logical color palette */
COLORREF
color
)
/* [in] Color to be matched */
COLORREF
color
)
/* [in] Color to be matched */
{
{
PALETTEOBJ
*
palObj
=
GDI_GetObjPtr
(
hpalette
,
PALETTE_MAGIC
);
PALETTEOBJ
*
palObj
=
GDI_GetObjPtr
(
hpalette
,
OBJ_PAL
);
UINT
index
=
0
;
UINT
index
=
0
;
if
(
palObj
)
if
(
palObj
)
...
@@ -632,7 +631,7 @@ COLORREF WINAPI GetNearestColor(
...
@@ -632,7 +631,7 @@ COLORREF WINAPI GetNearestColor(
*/
*/
static
INT
PALETTE_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
static
INT
PALETTE_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
{
{
PALETTEOBJ
*
palette
=
GDI_GetObjPtr
(
handle
,
PALETTE_MAGIC
);
PALETTEOBJ
*
palette
=
GDI_GetObjPtr
(
handle
,
OBJ_PAL
);
if
(
!
palette
)
return
0
;
if
(
!
palette
)
return
0
;
...
@@ -652,7 +651,7 @@ static INT PALETTE_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -652,7 +651,7 @@ static INT PALETTE_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
*/
*/
static
BOOL
PALETTE_UnrealizeObject
(
HGDIOBJ
handle
)
static
BOOL
PALETTE_UnrealizeObject
(
HGDIOBJ
handle
)
{
{
PALETTEOBJ
*
palette
=
GDI_GetObjPtr
(
handle
,
PALETTE_MAGIC
);
PALETTEOBJ
*
palette
=
GDI_GetObjPtr
(
handle
,
OBJ_PAL
);
if
(
palette
)
if
(
palette
)
{
{
...
@@ -677,7 +676,7 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
...
@@ -677,7 +676,7 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
PALETTEOBJ
*
obj
;
PALETTEOBJ
*
obj
;
PALETTE_UnrealizeObject
(
handle
);
PALETTE_UnrealizeObject
(
handle
);
if
(
!
(
obj
=
GDI_GetObjPtr
(
handle
,
PALETTE_MAGIC
)))
return
FALSE
;
if
(
!
(
obj
=
GDI_GetObjPtr
(
handle
,
OBJ_PAL
)))
return
FALSE
;
return
GDI_FreeObject
(
handle
,
obj
);
return
GDI_FreeObject
(
handle
,
obj
);
}
}
...
@@ -732,7 +731,7 @@ UINT WINAPI GDIRealizePalette( HDC hdc )
...
@@ -732,7 +731,7 @@ UINT WINAPI GDIRealizePalette( HDC hdc )
{
{
if
(
dc
->
funcs
->
pRealizePalette
)
if
(
dc
->
funcs
->
pRealizePalette
)
{
{
PALETTEOBJ
*
palPtr
=
GDI_GetObjPtr
(
dc
->
hPalette
,
PALETTE_MAGIC
);
PALETTEOBJ
*
palPtr
=
GDI_GetObjPtr
(
dc
->
hPalette
,
OBJ_PAL
);
if
(
palPtr
)
if
(
palPtr
)
{
{
realized
=
dc
->
funcs
->
pRealizePalette
(
dc
->
physDev
,
dc
->
hPalette
,
realized
=
dc
->
funcs
->
pRealizePalette
(
dc
->
physDev
,
dc
->
hPalette
,
...
...
dlls/gdi32/pen.c
View file @
5811a2cc
...
@@ -87,8 +87,7 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
...
@@ -87,8 +87,7 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
if
(
hpen
)
return
hpen
;
if
(
hpen
)
return
hpen
;
}
}
if
(
!
(
penPtr
=
GDI_AllocObject
(
sizeof
(
PENOBJ
),
PEN_MAGIC
,
(
HGDIOBJ
*
)
&
hpen
,
if
(
!
(
penPtr
=
GDI_AllocObject
(
sizeof
(
PENOBJ
),
OBJ_PEN
,
(
HGDIOBJ
*
)
&
hpen
,
&
pen_funcs
)))
return
0
;
&
pen_funcs
)))
return
0
;
if
(
pen
->
lopnStyle
==
PS_USERSTYLE
||
pen
->
lopnStyle
==
PS_ALTERNATE
)
if
(
pen
->
lopnStyle
==
PS_USERSTYLE
||
pen
->
lopnStyle
==
PS_ALTERNATE
)
penPtr
->
logpen
.
elpPenStyle
=
PS_SOLID
;
penPtr
->
logpen
.
elpPenStyle
=
PS_SOLID
;
else
else
...
@@ -199,8 +198,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
...
@@ -199,8 +198,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
if
(
!
(
penPtr
=
GDI_AllocObject
(
sizeof
(
PENOBJ
)
+
if
(
!
(
penPtr
=
GDI_AllocObject
(
sizeof
(
PENOBJ
)
+
style_count
*
sizeof
(
DWORD
)
-
sizeof
(
penPtr
->
logpen
.
elpStyleEntry
),
style_count
*
sizeof
(
DWORD
)
-
sizeof
(
penPtr
->
logpen
.
elpStyleEntry
),
EXT_PEN_MAGIC
,
(
HGDIOBJ
*
)
&
hpen
,
OBJ_EXTPEN
,
(
HGDIOBJ
*
)
&
hpen
,
&
pen_funcs
)))
return
0
;
&
pen_funcs
)))
return
0
;
penPtr
->
logpen
.
elpPenStyle
=
style
;
penPtr
->
logpen
.
elpPenStyle
=
style
;
penPtr
->
logpen
.
elpWidth
=
abs
(
width
);
penPtr
->
logpen
.
elpWidth
=
abs
(
width
);
...
@@ -256,7 +254,7 @@ static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
...
@@ -256,7 +254,7 @@ static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
*/
*/
static
BOOL
PEN_DeleteObject
(
HGDIOBJ
handle
)
static
BOOL
PEN_DeleteObject
(
HGDIOBJ
handle
)
{
{
PENOBJ
*
pen
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
);
PENOBJ
*
pen
=
GDI_GetObjPtr
(
handle
,
0
);
if
(
!
pen
)
return
FALSE
;
if
(
!
pen
)
return
FALSE
;
return
GDI_FreeObject
(
handle
,
pen
);
return
GDI_FreeObject
(
handle
,
pen
);
...
@@ -268,14 +266,14 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle )
...
@@ -268,14 +266,14 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle )
*/
*/
static
INT
PEN_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
static
INT
PEN_GetObject
(
HGDIOBJ
handle
,
INT
count
,
LPVOID
buffer
)
{
{
PENOBJ
*
pen
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
);
PENOBJ
*
pen
=
GDI_GetObjPtr
(
handle
,
0
);
INT
ret
=
0
;
INT
ret
=
0
;
if
(
!
pen
)
return
0
;
if
(
!
pen
)
return
0
;
switch
(
GDIMAGIC
(
pen
->
header
.
wMagic
)
)
switch
(
pen
->
header
.
type
)
{
{
case
PEN_MAGIC
:
case
OBJ_PEN
:
{
{
LOGPEN
*
lp
;
LOGPEN
*
lp
;
...
@@ -300,7 +298,7 @@ static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
...
@@ -300,7 +298,7 @@ static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
break
;
break
;
}
}
case
EXT_PEN_MAGIC
:
case
OBJ_EXTPEN
:
ret
=
sizeof
(
EXTLOGPEN
)
+
pen
->
logpen
.
elpNumEntries
*
sizeof
(
DWORD
)
-
sizeof
(
pen
->
logpen
.
elpStyleEntry
);
ret
=
sizeof
(
EXTLOGPEN
)
+
pen
->
logpen
.
elpNumEntries
*
sizeof
(
DWORD
)
-
sizeof
(
pen
->
logpen
.
elpStyleEntry
);
if
(
buffer
)
if
(
buffer
)
{
{
...
...
dlls/gdi32/region.c
View file @
5811a2cc
...
@@ -513,8 +513,7 @@ static HRGN REGION_CreateRegion( INT n )
...
@@ -513,8 +513,7 @@ static HRGN REGION_CreateRegion( INT n )
HRGN
hrgn
;
HRGN
hrgn
;
RGNOBJ
*
obj
;
RGNOBJ
*
obj
;
if
(
!
(
obj
=
GDI_AllocObject
(
sizeof
(
RGNOBJ
),
REGION_MAGIC
,
(
HGDIOBJ
*
)
&
hrgn
,
if
(
!
(
obj
=
GDI_AllocObject
(
sizeof
(
RGNOBJ
),
OBJ_REGION
,
(
HGDIOBJ
*
)
&
hrgn
,
&
region_funcs
)))
return
0
;
&
region_funcs
)))
return
0
;
if
(
!
(
obj
->
rgn
=
REGION_AllocWineRegion
(
n
)))
{
if
(
!
(
obj
->
rgn
=
REGION_AllocWineRegion
(
n
)))
{
GDI_FreeObject
(
hrgn
,
obj
);
GDI_FreeObject
(
hrgn
,
obj
);
return
0
;
return
0
;
...
@@ -537,7 +536,7 @@ static void REGION_DestroyWineRegion( WINEREGION* pReg )
...
@@ -537,7 +536,7 @@ static void REGION_DestroyWineRegion( WINEREGION* pReg )
*/
*/
static
BOOL
REGION_DeleteObject
(
HGDIOBJ
handle
)
static
BOOL
REGION_DeleteObject
(
HGDIOBJ
handle
)
{
{
RGNOBJ
*
rgn
=
GDI_GetObjPtr
(
handle
,
REGION_MAGIC
);
RGNOBJ
*
rgn
=
GDI_GetObjPtr
(
handle
,
OBJ_REGION
);
if
(
!
rgn
)
return
FALSE
;
if
(
!
rgn
)
return
FALSE
;
REGION_DestroyWineRegion
(
rgn
->
rgn
);
REGION_DestroyWineRegion
(
rgn
->
rgn
);
...
@@ -602,7 +601,7 @@ static void REGION_OffsetRegion( WINEREGION *rgn, WINEREGION *srcrgn,
...
@@ -602,7 +601,7 @@ static void REGION_OffsetRegion( WINEREGION *rgn, WINEREGION *srcrgn,
*/
*/
INT
WINAPI
OffsetRgn
(
HRGN
hrgn
,
INT
x
,
INT
y
)
INT
WINAPI
OffsetRgn
(
HRGN
hrgn
,
INT
x
,
INT
y
)
{
{
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
);
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
);
INT
ret
;
INT
ret
;
TRACE
(
"%p %d,%d
\n
"
,
hrgn
,
x
,
y
);
TRACE
(
"%p %d,%d
\n
"
,
hrgn
,
x
,
y
);
...
@@ -637,7 +636,7 @@ INT WINAPI OffsetRgn( HRGN hrgn, INT x, INT y )
...
@@ -637,7 +636,7 @@ INT WINAPI OffsetRgn( HRGN hrgn, INT x, INT y )
*/
*/
INT
WINAPI
GetRgnBox
(
HRGN
hrgn
,
LPRECT
rect
)
INT
WINAPI
GetRgnBox
(
HRGN
hrgn
,
LPRECT
rect
)
{
{
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
);
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
);
if
(
obj
)
if
(
obj
)
{
{
INT
ret
;
INT
ret
;
...
@@ -728,7 +727,7 @@ BOOL WINAPI SetRectRgn( HRGN hrgn, INT left, INT top,
...
@@ -728,7 +727,7 @@ BOOL WINAPI SetRectRgn( HRGN hrgn, INT left, INT top,
TRACE
(
"%p %d,%d-%d,%d
\n
"
,
hrgn
,
left
,
top
,
right
,
bottom
);
TRACE
(
"%p %d,%d-%d,%d
\n
"
,
hrgn
,
left
,
top
,
right
,
bottom
);
if
(
!
(
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
)))
return
FALSE
;
if
(
!
(
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
)))
return
FALSE
;
if
(
left
>
right
)
{
INT
tmp
=
left
;
left
=
right
;
right
=
tmp
;
}
if
(
left
>
right
)
{
INT
tmp
=
left
;
left
=
right
;
right
=
tmp
;
}
if
(
top
>
bottom
)
{
INT
tmp
=
top
;
top
=
bottom
;
bottom
=
tmp
;
}
if
(
top
>
bottom
)
{
INT
tmp
=
top
;
top
=
bottom
;
bottom
=
tmp
;
}
...
@@ -801,7 +800,7 @@ HRGN WINAPI CreateRoundRectRgn( INT left, INT top,
...
@@ -801,7 +800,7 @@ HRGN WINAPI CreateRoundRectRgn( INT left, INT top,
d
=
(
ellipse_height
<
128
)
?
((
3
*
ellipse_height
)
>>
2
)
:
64
;
d
=
(
ellipse_height
<
128
)
?
((
3
*
ellipse_height
)
>>
2
)
:
64
;
if
(
!
(
hrgn
=
REGION_CreateRegion
(
d
)))
return
0
;
if
(
!
(
hrgn
=
REGION_CreateRegion
(
d
)))
return
0
;
if
(
!
(
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
)))
return
0
;
if
(
!
(
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
)))
return
0
;
TRACE
(
"(%d,%d-%d,%d %dx%d): ret=%p
\n
"
,
TRACE
(
"(%d,%d-%d,%d %dx%d): ret=%p
\n
"
,
left
,
top
,
right
,
bottom
,
ellipse_width
,
ellipse_height
,
hrgn
);
left
,
top
,
right
,
bottom
,
ellipse_width
,
ellipse_height
,
hrgn
);
...
@@ -952,7 +951,7 @@ HRGN WINAPI CreateEllipticRgnIndirect( const RECT *rect )
...
@@ -952,7 +951,7 @@ HRGN WINAPI CreateEllipticRgnIndirect( const RECT *rect )
DWORD
WINAPI
GetRegionData
(
HRGN
hrgn
,
DWORD
count
,
LPRGNDATA
rgndata
)
DWORD
WINAPI
GetRegionData
(
HRGN
hrgn
,
DWORD
count
,
LPRGNDATA
rgndata
)
{
{
DWORD
size
;
DWORD
size
;
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
);
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
);
TRACE
(
" %p count = %d, rgndata = %p
\n
"
,
hrgn
,
count
,
rgndata
);
TRACE
(
" %p count = %d, rgndata = %p
\n
"
,
hrgn
,
count
,
rgndata
);
...
@@ -1066,7 +1065,7 @@ HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA*
...
@@ -1066,7 +1065,7 @@ HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA*
if
(
(
hrgn
=
REGION_CreateRegion
(
rgndata
->
rdh
.
nCount
))
)
if
(
(
hrgn
=
REGION_CreateRegion
(
rgndata
->
rdh
.
nCount
))
)
{
{
RECT
*
pCurRect
,
*
pEndRect
;
RECT
*
pCurRect
,
*
pEndRect
;
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
);
RGNOBJ
*
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
);
if
(
obj
)
{
if
(
obj
)
{
pEndRect
=
(
RECT
*
)
rgndata
->
Buffer
+
rgndata
->
rdh
.
nCount
;
pEndRect
=
(
RECT
*
)
rgndata
->
Buffer
+
rgndata
->
rdh
.
nCount
;
...
@@ -1105,7 +1104,7 @@ BOOL WINAPI PtInRegion( HRGN hrgn, INT x, INT y )
...
@@ -1105,7 +1104,7 @@ BOOL WINAPI PtInRegion( HRGN hrgn, INT x, INT y )
RGNOBJ
*
obj
;
RGNOBJ
*
obj
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
if
((
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
)))
if
((
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
)))
{
{
int
i
;
int
i
;
...
@@ -1140,7 +1139,7 @@ BOOL WINAPI RectInRegion( HRGN hrgn, const RECT *rect )
...
@@ -1140,7 +1139,7 @@ BOOL WINAPI RectInRegion( HRGN hrgn, const RECT *rect )
RGNOBJ
*
obj
;
RGNOBJ
*
obj
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
if
((
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
)))
if
((
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
)))
{
{
RECT
*
pCurRect
,
*
pRectEnd
;
RECT
*
pCurRect
,
*
pRectEnd
;
...
@@ -1190,9 +1189,9 @@ BOOL WINAPI EqualRgn( HRGN hrgn1, HRGN hrgn2 )
...
@@ -1190,9 +1189,9 @@ BOOL WINAPI EqualRgn( HRGN hrgn1, HRGN hrgn2 )
RGNOBJ
*
obj1
,
*
obj2
;
RGNOBJ
*
obj1
,
*
obj2
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
if
((
obj1
=
GDI_GetObjPtr
(
hrgn1
,
REGION_MAGIC
)))
if
((
obj1
=
GDI_GetObjPtr
(
hrgn1
,
OBJ_REGION
)))
{
{
if
((
obj2
=
GDI_GetObjPtr
(
hrgn2
,
REGION_MAGIC
)))
if
((
obj2
=
GDI_GetObjPtr
(
hrgn2
,
OBJ_REGION
)))
{
{
int
i
;
int
i
;
...
@@ -1250,12 +1249,12 @@ static void REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
...
@@ -1250,12 +1249,12 @@ static void REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
BOOL
REGION_FrameRgn
(
HRGN
hDest
,
HRGN
hSrc
,
INT
x
,
INT
y
)
BOOL
REGION_FrameRgn
(
HRGN
hDest
,
HRGN
hSrc
,
INT
x
,
INT
y
)
{
{
BOOL
bRet
;
BOOL
bRet
;
RGNOBJ
*
srcObj
=
GDI_GetObjPtr
(
hSrc
,
REGION_MAGIC
);
RGNOBJ
*
srcObj
=
GDI_GetObjPtr
(
hSrc
,
OBJ_REGION
);
if
(
!
srcObj
)
return
FALSE
;
if
(
!
srcObj
)
return
FALSE
;
if
(
srcObj
->
rgn
->
numRects
!=
0
)
if
(
srcObj
->
rgn
->
numRects
!=
0
)
{
{
RGNOBJ
*
destObj
=
GDI_GetObjPtr
(
hDest
,
REGION_MAGIC
);
RGNOBJ
*
destObj
=
GDI_GetObjPtr
(
hDest
,
OBJ_REGION
);
WINEREGION
*
tmprgn
=
REGION_AllocWineRegion
(
srcObj
->
rgn
->
numRects
);
WINEREGION
*
tmprgn
=
REGION_AllocWineRegion
(
srcObj
->
rgn
->
numRects
);
REGION_OffsetRegion
(
destObj
->
rgn
,
srcObj
->
rgn
,
-
x
,
0
);
REGION_OffsetRegion
(
destObj
->
rgn
,
srcObj
->
rgn
,
-
x
,
0
);
...
@@ -1308,13 +1307,13 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
...
@@ -1308,13 +1307,13 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
*/
*/
INT
WINAPI
CombineRgn
(
HRGN
hDest
,
HRGN
hSrc1
,
HRGN
hSrc2
,
INT
mode
)
INT
WINAPI
CombineRgn
(
HRGN
hDest
,
HRGN
hSrc1
,
HRGN
hSrc2
,
INT
mode
)
{
{
RGNOBJ
*
destObj
=
GDI_GetObjPtr
(
hDest
,
REGION_MAGIC
);
RGNOBJ
*
destObj
=
GDI_GetObjPtr
(
hDest
,
OBJ_REGION
);
INT
result
=
ERROR
;
INT
result
=
ERROR
;
TRACE
(
" %p,%p -> %p mode=%x
\n
"
,
hSrc1
,
hSrc2
,
hDest
,
mode
);
TRACE
(
" %p,%p -> %p mode=%x
\n
"
,
hSrc1
,
hSrc2
,
hDest
,
mode
);
if
(
destObj
)
if
(
destObj
)
{
{
RGNOBJ
*
src1Obj
=
GDI_GetObjPtr
(
hSrc1
,
REGION_MAGIC
);
RGNOBJ
*
src1Obj
=
GDI_GetObjPtr
(
hSrc1
,
OBJ_REGION
);
if
(
src1Obj
)
if
(
src1Obj
)
{
{
...
@@ -1328,7 +1327,7 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
...
@@ -1328,7 +1327,7 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
}
}
else
else
{
{
RGNOBJ
*
src2Obj
=
GDI_GetObjPtr
(
hSrc2
,
REGION_MAGIC
);
RGNOBJ
*
src2Obj
=
GDI_GetObjPtr
(
hSrc2
,
OBJ_REGION
);
if
(
src2Obj
)
if
(
src2Obj
)
{
{
...
@@ -2788,7 +2787,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
...
@@ -2788,7 +2787,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
if
(
!
(
hrgn
=
REGION_CreateRegion
(
nbpolygons
)))
if
(
!
(
hrgn
=
REGION_CreateRegion
(
nbpolygons
)))
return
0
;
return
0
;
obj
=
GDI_GetObjPtr
(
hrgn
,
REGION_MAGIC
);
obj
=
GDI_GetObjPtr
(
hrgn
,
OBJ_REGION
);
region
=
obj
->
rgn
;
region
=
obj
->
rgn
;
/* special case a rectangle */
/* special case a rectangle */
...
...
dlls/gdi32/wing.c
View file @
5811a2cc
...
@@ -144,7 +144,7 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
...
@@ -144,7 +144,7 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
*/
*/
SEGPTR
WINAPI
WinGGetDIBPointer16
(
HBITMAP16
hWinGBitmap
,
BITMAPINFO
*
bmpi
)
SEGPTR
WINAPI
WinGGetDIBPointer16
(
HBITMAP16
hWinGBitmap
,
BITMAPINFO
*
bmpi
)
{
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
HBITMAP_32
(
hWinGBitmap
),
BITMAP_MAGIC
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
HBITMAP_32
(
hWinGBitmap
),
OBJ_BITMAP
);
SEGPTR
res
=
0
;
SEGPTR
res
=
0
;
TRACE
(
"(%d,%p)
\n
"
,
hWinGBitmap
,
bmpi
);
TRACE
(
"(%d,%p)
\n
"
,
hWinGBitmap
,
bmpi
);
...
...
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