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
4396a79e
Commit
4396a79e
authored
Oct 24, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a DC hook flag to reset the DC state.
parent
77c1856d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
34 deletions
+80
-34
dc.c
dlls/gdi32/dc.c
+77
-17
dc.c
dlls/gdi32/tests/dc.c
+0
-3
painting.c
dlls/user32/painting.c
+2
-14
gdi_driver.h
include/wine/gdi_driver.h
+1
-0
No files found.
dlls/gdi32/dc.c
View file @
4396a79e
...
...
@@ -71,28 +71,20 @@ static inline DC *get_dc_obj( HDC hdc )
/***********************************************************************
*
alloc_dc_ptr
*
set_initial_dc_state
*/
DC
*
alloc_dc_ptr
(
WORD
magi
c
)
static
void
set_initial_dc_state
(
DC
*
d
c
)
{
DC
*
dc
;
if
(
!
(
dc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
dc
)
)))
return
NULL
;
dc
->
nulldrv
.
funcs
=
&
null_driver
;
dc
->
physDev
=
&
dc
->
nulldrv
;
dc
->
module
=
gdi32_module
;
dc
->
thread
=
GetCurrentThreadId
();
dc
->
refcount
=
1
;
dc
->
wndOrgX
=
0
;
dc
->
wndOrgY
=
0
;
dc
->
wndExtX
=
1
;
dc
->
wndExtY
=
1
;
dc
->
vportOrgX
=
0
;
dc
->
vportOrgY
=
0
;
dc
->
vportExtX
=
1
;
dc
->
vportExtY
=
1
;
dc
->
miterLimit
=
10
.
0
f
;
/* 10.0 is the default, from MSDN */
dc
->
hPen
=
GDI_inc_ref_count
(
GetStockObject
(
BLACK_PEN
));
dc
->
hBrush
=
GDI_inc_ref_count
(
GetStockObject
(
WHITE_BRUSH
));
dc
->
hFont
=
GDI_inc_ref_count
(
GetStockObject
(
SYSTEM_FONT
));
dc
->
hPalette
=
GetStockObject
(
DEFAULT_PALETTE
);
dc
->
layout
=
0
;
dc
->
font_code_page
=
CP_ACP
;
dc
->
ROPmode
=
R2_COPYPEN
;
dc
->
polyFillMode
=
ALTERNATE
;
...
...
@@ -103,9 +95,17 @@ DC *alloc_dc_ptr( WORD magic )
dc
->
dcBrushColor
=
RGB
(
255
,
255
,
255
);
dc
->
dcPenColor
=
RGB
(
0
,
0
,
0
);
dc
->
textColor
=
RGB
(
0
,
0
,
0
);
dc
->
brushOrgX
=
0
;
dc
->
brushOrgY
=
0
;
dc
->
mapperFlags
=
0
;
dc
->
textAlign
=
TA_LEFT
|
TA_TOP
|
TA_NOUPDATECP
;
dc
->
charExtra
=
0
;
dc
->
breakExtra
=
0
;
dc
->
breakRem
=
0
;
dc
->
MapMode
=
MM_TEXT
;
dc
->
GraphicsMode
=
GM_COMPATIBLE
;
dc
->
CursPosX
=
0
;
dc
->
CursPosY
=
0
;
dc
->
ArcDirection
=
AD_COUNTERCLOCKWISE
;
dc
->
xformWorld2Wnd
.
eM11
=
1
.
0
f
;
dc
->
xformWorld2Wnd
.
eM12
=
0
.
0
f
;
...
...
@@ -118,6 +118,28 @@ DC *alloc_dc_ptr( WORD magic )
dc
->
vport2WorldValid
=
TRUE
;
reset_bounds
(
&
dc
->
bounds
);
}
/***********************************************************************
* alloc_dc_ptr
*/
DC
*
alloc_dc_ptr
(
WORD
magic
)
{
DC
*
dc
;
if
(
!
(
dc
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
dc
)
)))
return
NULL
;
dc
->
nulldrv
.
funcs
=
&
null_driver
;
dc
->
physDev
=
&
dc
->
nulldrv
;
dc
->
module
=
gdi32_module
;
dc
->
thread
=
GetCurrentThreadId
();
dc
->
refcount
=
1
;
dc
->
hPen
=
GDI_inc_ref_count
(
GetStockObject
(
BLACK_PEN
));
dc
->
hBrush
=
GDI_inc_ref_count
(
GetStockObject
(
WHITE_BRUSH
));
dc
->
hFont
=
GDI_inc_ref_count
(
GetStockObject
(
SYSTEM_FONT
));
dc
->
hPalette
=
GetStockObject
(
DEFAULT_PALETTE
);
set_initial_dc_state
(
dc
);
if
(
!
(
dc
->
hSelf
=
alloc_gdi_handle
(
dc
,
magic
,
&
dc_funcs
)))
{
...
...
@@ -520,6 +542,44 @@ BOOL nulldrv_RestoreDC( PHYSDEV dev, INT level )
/***********************************************************************
* reset_dc_state
*/
static
BOOL
reset_dc_state
(
HDC
hdc
)
{
DC
*
dc
,
*
dcs
,
*
next
;
if
(
!
(
dc
=
get_dc_ptr
(
hdc
)))
return
FALSE
;
set_initial_dc_state
(
dc
);
SetBkColor
(
hdc
,
RGB
(
255
,
255
,
255
));
SetTextColor
(
hdc
,
RGB
(
0
,
0
,
0
));
SelectObject
(
hdc
,
GetStockObject
(
WHITE_BRUSH
));
SelectObject
(
hdc
,
GetStockObject
(
SYSTEM_FONT
));
SelectObject
(
hdc
,
GetStockObject
(
BLACK_PEN
));
SetVirtualResolution
(
hdc
,
0
,
0
,
0
,
0
);
GDISelectPalette
(
hdc
,
GetStockObject
(
DEFAULT_PALETTE
),
FALSE
);
SetBoundsRect
(
hdc
,
NULL
,
DCB_DISABLE
);
AbortPath
(
hdc
);
if
(
dc
->
hClipRgn
)
DeleteObject
(
dc
->
hClipRgn
);
if
(
dc
->
hMetaRgn
)
DeleteObject
(
dc
->
hMetaRgn
);
dc
->
hClipRgn
=
0
;
dc
->
hMetaRgn
=
0
;
update_dc_clipping
(
dc
);
for
(
dcs
=
dc
->
saved_dc
;
dcs
;
dcs
=
next
)
{
next
=
dcs
->
saved_dc
;
free_dc_state
(
dcs
);
}
dc
->
saved_dc
=
NULL
;
dc
->
saveLevel
=
0
;
release_dc_ptr
(
dc
);
return
TRUE
;
}
/***********************************************************************
* SaveDC (GDI32.@)
*/
INT
WINAPI
SaveDC
(
HDC
hdc
)
...
...
@@ -1217,8 +1277,6 @@ WORD WINAPI SetHookFlags( HDC hdc, WORD flags )
if
(
!
dc
)
return
0
;
/* "Undocumented Windows" info is slightly confusing. */
TRACE
(
"hDC %p, flags %04x
\n
"
,
hdc
,
flags
);
if
(
flags
&
DCHF_INVALIDATEVISRGN
)
...
...
@@ -1227,6 +1285,8 @@ WORD WINAPI SetHookFlags( HDC hdc, WORD flags )
ret
=
InterlockedExchange
(
&
dc
->
dirty
,
0
);
GDI_ReleaseObj
(
hdc
);
if
(
flags
&
DCHF_RESETDC
)
ret
=
reset_dc_state
(
hdc
);
return
ret
;
}
...
...
dlls/gdi32/tests/dc.c
View file @
4396a79e
...
...
@@ -124,10 +124,7 @@ static void test_savedc_2(void)
rc_clip
.
left
,
rc_clip
.
top
,
rc_clip
.
right
,
rc_clip
.
bottom
);
ret
=
SaveDC
(
hdc
);
todo_wine
{
ok
(
ret
==
1
,
"ret = %d
\n
"
,
ret
);
}
ret
=
IntersectClipRect
(
hdc
,
0
,
0
,
50
,
50
);
if
(
ret
==
COMPLEXREGION
)
...
...
dlls/user32/painting.c
View file @
4396a79e
...
...
@@ -178,16 +178,6 @@ static void update_visible_region( struct dce *dce )
/***********************************************************************
* reset_dce_attrs
*/
static
void
reset_dce_attrs
(
struct
dce
*
dce
)
{
RestoreDC
(
dce
->
hdc
,
1
);
/* initial save level is always 1 */
SaveDC
(
dce
->
hdc
);
/* save the state again for next time */
}
/***********************************************************************
* release_dce
*/
static
void
release_dce
(
struct
dce
*
dce
)
...
...
@@ -235,8 +225,6 @@ static struct dce *alloc_dce(void)
HeapFree
(
GetProcessHeap
(),
0
,
dce
);
return
0
;
}
SaveDC
(
dce
->
hdc
);
dce
->
hwnd
=
0
;
dce
->
clip_rgn
=
0
;
dce
->
flags
=
0
;
...
...
@@ -352,7 +340,7 @@ void free_dce( struct dce *dce, HWND hwnd )
if
(
!--
dce
->
count
)
{
/* turn it into a cache entry */
reset_dce_attrs
(
dce
);
SetHookFlags
(
dce
->
hdc
,
DCHF_RESETDC
);
release_dce
(
dce
);
dce
->
flags
|=
DCX_CACHE
;
}
...
...
@@ -470,7 +458,7 @@ static INT release_dc( HWND hwnd, HDC hdc, BOOL end_paint )
dce
=
(
struct
dce
*
)
GetDCHook
(
hdc
,
NULL
);
if
(
dce
&&
dce
->
count
)
{
if
(
!
(
dce
->
flags
&
DCX_NORESETATTRS
))
reset_dce_attrs
(
dce
);
if
(
!
(
dce
->
flags
&
DCX_NORESETATTRS
))
SetHookFlags
(
dce
->
hdc
,
DCHF_RESETDC
);
if
(
end_paint
||
(
dce
->
flags
&
DCX_CACHE
))
delete_clip_rgn
(
dce
);
if
(
dce
->
flags
&
DCX_CACHE
)
dce
->
count
=
0
;
ret
=
TRUE
;
...
...
include/wine/gdi_driver.h
View file @
4396a79e
...
...
@@ -265,6 +265,7 @@ static inline ULONG window_surface_release( struct window_surface *surface )
#define DCHC_DELETEDC 0x0002
#define DCHF_INVALIDATEVISRGN 0x0001
#define DCHF_VALIDATEVISRGN 0x0002
#define DCHF_RESETDC 0x0004
/* Wine extension */
typedef
BOOL
(
CALLBACK
*
DCHOOKPROC
)(
HDC
,
WORD
,
DWORD_PTR
,
LPARAM
);
...
...
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