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
78f9fae7
Commit
78f9fae7
authored
Aug 17, 2001
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create GDI stock objects as normal objects instead of using magic
handle values.
parent
e811f9c3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
75 deletions
+46
-75
font.c
dlls/wineps/font.c
+7
-1
objects.c
graphics/enhmetafiledrv/objects.c
+28
-34
xfont.c
graphics/x11drv/xfont.c
+6
-1
gdi.h
include/gdi.h
+4
-35
dc.c
objects/dc.c
+1
-1
gdiobj.c
objects/gdiobj.c
+0
-0
syscolor.c
windows/syscolor.c
+0
-3
No files found.
dlls/wineps/font.c
View file @
78f9fae7
...
...
@@ -18,9 +18,15 @@ DEFAULT_DEBUG_CHANNEL(psdrv);
*/
inline
static
BOOL
is_stock_font
(
HFONT
font
)
{
return
(
font
>=
FIRST_STOCK_FONT
&&
font
<=
LAST_STOCK_FONT
);
int
i
;
for
(
i
=
OEM_FIXED_FONT
;
i
<=
DEFAULT_GUI_FONT
;
i
++
)
{
if
(
i
!=
DEFAULT_PALETTE
&&
font
==
GetStockObject
(
i
))
return
TRUE
;
}
return
FALSE
;
}
/*******************************************************************************
* ScaleFont
*
...
...
graphics/enhmetafiledrv/objects.c
View file @
78f9fae7
...
...
@@ -101,25 +101,24 @@ static HBRUSH EMFDRV_BRUSH_SelectObject(DC *dc, HBRUSH hBrush )
EMRSELECTOBJECT
emr
;
DWORD
index
;
HBRUSH
hOldBrush
;
int
i
;
/* If the object is a stock brush object, do not need to create it.
* See definitions in wingdi.h for range of stock brushes.
* We do however have to handle setting the higher order bit to
* designate that this is a stock object.
*/
if
(
hBrush
>=
FIRST_STOCK_HANDLE
&&
hBrush
<=
FIRST_STOCK_HANDLE
+
HOLLOW_BRUSH
)
{
DWORD
brush_index
=
hBrush
-
FIRST_STOCK_HANDLE
;
index
=
brush_index
|
0x80000000
;
}
else
for
(
i
=
WHITE_BRUSH
;
i
<=
NULL_BRUSH
;
i
++
)
{
index
=
EMFDRV_CreateBrushIndirect
(
dc
,
hBrush
);
if
(
hBrush
==
GetStockObject
(
i
))
{
index
=
i
|
0x80000000
;
goto
found
;
}
}
if
(
!
index
)
return
FALSE
;
if
(
!
(
index
=
EMFDRV_CreateBrushIndirect
(
dc
,
hBrush
)))
return
0
;
found:
emr
.
emr
.
iType
=
EMR_SELECTOBJECT
;
emr
.
emr
.
nSize
=
sizeof
(
emr
);
emr
.
ihObject
=
index
;
...
...
@@ -180,6 +179,7 @@ static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont )
EMRSELECTOBJECT
emr
;
DWORD
index
;
HFONT
hOldFont
;
int
i
;
/* If the object is a stock font object, do not need to create it.
* See definitions in wingdi.h for range of stock fonts.
...
...
@@ -187,20 +187,16 @@ static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont )
* designate that this is a stock object.
*/
if
(
hFont
>=
STOCK_OEM_FIXED_FONT
&&
hFont
<=
STOCK_DEFAULT_GUI_FONT
&&
hFont
!=
STOCK_DEFAULT_PALETTE
)
for
(
i
=
OEM_FIXED_FONT
;
i
<=
DEFAULT_GUI_FONT
;
i
++
)
{
DWORD
font_index
=
hFont
-
FIRST_STOCK_HANDLE
;
index
=
font_index
|
0x80000000
;
if
(
i
!=
DEFAULT_PALETTE
&&
hFont
==
GetStockObject
(
i
))
{
index
=
i
|
0x80000000
;
goto
found
;
}
}
else
{
index
=
EMFDRV_CreateFontIndirect
(
dc
,
hFont
);
}
if
(
!
index
)
return
FALSE
;
if
(
!
(
index
=
EMFDRV_CreateFontIndirect
(
dc
,
hFont
)))
return
0
;
found:
emr
.
emr
.
iType
=
EMR_SELECTOBJECT
;
emr
.
emr
.
nSize
=
sizeof
(
emr
);
emr
.
ihObject
=
index
;
...
...
@@ -241,6 +237,7 @@ static HPEN EMFDRV_PEN_SelectObject(DC *dc, HPEN hPen )
EMRSELECTOBJECT
emr
;
DWORD
index
;
HPEN
hOldPen
;
int
i
;
/* If the object is a stock pen object, do not need to create it.
* See definitions in wingdi.h for range of stock pens.
...
...
@@ -248,19 +245,16 @@ static HPEN EMFDRV_PEN_SelectObject(DC *dc, HPEN hPen )
* designate that this is a stock object.
*/
if
(
hPen
>=
STOCK_WHITE_PEN
&&
hPen
<=
STOCK_NULL_PEN
)
for
(
i
=
WHITE_PEN
;
i
<=
NULL_PEN
;
i
++
)
{
DWORD
pen_index
=
hPen
-
FIRST_STOCK_HANDLE
;
index
=
pen_index
|
0x80000000
;
if
(
hPen
==
GetStockObject
(
i
))
{
index
=
i
|
0x80000000
;
goto
found
;
}
}
else
{
index
=
EMFDRV_CreatePenIndirect
(
dc
,
hPen
);
}
if
(
!
index
)
return
FALSE
;
if
(
!
(
index
=
EMFDRV_CreatePenIndirect
(
dc
,
hPen
)))
return
0
;
found:
emr
.
emr
.
iType
=
EMR_SELECTOBJECT
;
emr
.
emr
.
nSize
=
sizeof
(
emr
);
emr
.
ihObject
=
index
;
...
...
graphics/x11drv/xfont.c
View file @
78f9fae7
...
...
@@ -350,7 +350,12 @@ static Atom RAW_DESCENT;
*/
inline
static
BOOL
is_stock_font
(
HFONT
font
)
{
return
(
font
>=
FIRST_STOCK_FONT
&&
font
<=
LAST_STOCK_FONT
);
int
i
;
for
(
i
=
OEM_FIXED_FONT
;
i
<=
DEFAULT_GUI_FONT
;
i
++
)
{
if
(
i
!=
DEFAULT_PALETTE
&&
font
==
GetStockObject
(
i
))
return
TRUE
;
}
return
FALSE
;
}
...
...
include/gdi.h
View file @
78f9fae7
...
...
@@ -246,41 +246,10 @@ typedef struct tagDC_FUNCS
#define DC_DIRTY 0x0004
/* hVisRgn has to be updated */
#define DC_THUNKHOOK 0x0008
/* DC hook is in the 16-bit code */
/* Last 32 bytes are reserved for stock object handles */
#define GDI_HEAP_SIZE 0xffe0
/* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
#define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
/* Stock objects handles */
#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
#define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
#define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
#define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH))
#define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH))
#define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
#define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH))
#define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
#define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
#define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
#define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
#define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
#define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
#define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
#define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
#define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
#define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
#define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
#define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
extern
HBITMAP
hPseudoStockBitmap
;
#define GDI_HEAP_SIZE 0xffe0
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
/* Device <-> logical coords conversion */
...
...
objects/dc.c
View file @
78f9fae7
...
...
@@ -681,7 +681,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
dc
->
flags
=
DC_MEMORY
;
dc
->
bitsPerPixel
=
1
;
dc
->
hBitmap
=
hPseudoStockBitmap
;
dc
->
hBitmap
=
GetStockObject
(
DEFAULT_BITMAP
)
;
/* Copy the driver-specific physical device info into
* the new DC. The driver may use this read-only info
...
...
objects/gdiobj.c
View file @
78f9fae7
This diff is collapsed.
Click to expand it.
windows/syscolor.c
View file @
78f9fae7
...
...
@@ -98,9 +98,6 @@ static COLORREF SysColors[NUM_SYS_COLORS];
static
HBRUSH
SysColorBrushes
[
NUM_SYS_COLORS
];
static
HPEN
SysColorPens
[
NUM_SYS_COLORS
];
#define MAKE_SOLID(color) \
(PALETTEINDEX(GetNearestPaletteIndex(STOCK_DEFAULT_PALETTE,(color))))
/*************************************************************************
* SYSCOLOR_MakeObjectSystem
...
...
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