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
af6c0a09
Commit
af6c0a09
authored
Sep 27, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Move the object refcount handling to the SelectObject backend functions.
parent
a1e31397
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
19 deletions
+35
-19
bitmap.c
dlls/gdi32/bitmap.c
+2
-0
brush.c
dlls/gdi32/brush.c
+7
-3
font.c
dlls/gdi32/font.c
+2
-0
gdi_private.h
dlls/gdi32/gdi_private.h
+2
-0
gdiobj.c
dlls/gdi32/gdiobj.c
+13
-12
pen.c
dlls/gdi32/pen.c
+9
-4
No files found.
dlls/gdi32/bitmap.c
View file @
af6c0a09
...
...
@@ -593,9 +593,11 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
if
(
handle
)
{
dc
->
hBitmap
=
handle
;
GDI_inc_ref_count
(
handle
);
dc
->
dirty
=
0
;
SetRectRgn
(
dc
->
hVisRgn
,
0
,
0
,
bitmap
->
bitmap
.
bmWidth
,
bitmap
->
bitmap
.
bmHeight
);
DC_InitDC
(
dc
);
GDI_dec_ref_count
(
ret
);
}
else
ret
=
0
;
...
...
dlls/gdi32/brush.c
View file @
af6c0a09
...
...
@@ -381,10 +381,14 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
if
(
brush
->
logbrush
.
lbStyle
==
BS_PATTERN
)
BITMAP_SetOwnerDC
(
(
HBITMAP
)
brush
->
logbrush
.
lbHatch
,
dc
);
ret
=
dc
->
hBrush
;
if
(
dc
->
funcs
->
pSelectBrush
)
handle
=
dc
->
funcs
->
pSelectBrush
(
dc
->
physDev
,
handle
);
if
(
handle
)
dc
->
hBrush
=
handle
;
else
ret
=
0
;
if
(
handle
)
{
ret
=
dc
->
hBrush
;
dc
->
hBrush
=
handle
;
GDI_inc_ref_count
(
handle
);
GDI_dec_ref_count
(
ret
);
}
GDI_ReleaseObj
(
handle
);
}
release_dc_ptr
(
dc
);
...
...
dlls/gdi32/font.c
View file @
af6c0a09
...
...
@@ -608,6 +608,8 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
{
ret
=
dc
->
hFont
;
dc
->
hFont
=
handle
;
GDI_inc_ref_count
(
handle
);
GDI_dec_ref_count
(
ret
);
}
DC_ReleaseDCPtr
(
dc
);
return
ret
;
...
...
dlls/gdi32/gdi_private.h
View file @
af6c0a09
...
...
@@ -456,6 +456,8 @@ extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
extern
void
*
GDI_GetObjPtr
(
HGDIOBJ
,
WORD
);
extern
void
GDI_ReleaseObj
(
HGDIOBJ
);
extern
void
GDI_CheckNotLock
(
void
);
extern
BOOL
GDI_inc_ref_count
(
HGDIOBJ
handle
);
extern
BOOL
GDI_dec_ref_count
(
HGDIOBJ
handle
);
extern
BOOL
GDI_hdc_using_object
(
HGDIOBJ
obj
,
HDC
hdc
);
extern
BOOL
GDI_hdc_not_using_object
(
HGDIOBJ
obj
,
HDC
hdc
);
...
...
dlls/gdi32/gdiobj.c
View file @
af6c0a09
...
...
@@ -524,22 +524,29 @@ static DWORD get_dpi( void )
/***********************************************************************
* inc_ref_count
*
GDI_
inc_ref_count
*
* Increment the reference count of a GDI object.
*/
static
inline
void
inc_ref_count
(
GDIOBJHDR
*
header
)
BOOL
GDI_inc_ref_count
(
HGDIOBJ
handle
)
{
header
->
dwCount
++
;
GDIOBJHDR
*
header
;
if
((
header
=
GDI_GetObjPtr
(
handle
,
MAGIC_DONTCARE
)))
{
header
->
dwCount
++
;
GDI_ReleaseObj
(
handle
);
}
return
header
!=
NULL
;
}
/***********************************************************************
* dec_ref_count
*
GDI_
dec_ref_count
*
* Decrement the reference count of a GDI object.
*/
static
inline
void
dec_ref_count
(
HGDIOBJ
handle
)
BOOL
GDI_
dec_ref_count
(
HGDIOBJ
handle
)
{
GDIOBJHDR
*
header
;
...
...
@@ -556,6 +563,7 @@ static inline void dec_ref_count( HGDIOBJ handle )
DeleteObject
(
handle
);
}
}
return
header
!=
NULL
;
}
...
...
@@ -1149,14 +1157,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
if
(
header
)
{
if
(
header
->
funcs
&&
header
->
funcs
->
pSelectObject
)
{
ret
=
header
->
funcs
->
pSelectObject
(
hObj
,
hdc
);
if
(
ret
&&
ret
!=
hObj
&&
HandleToULong
(
ret
)
>
COMPLEXREGION
)
{
inc_ref_count
(
header
);
dec_ref_count
(
ret
);
}
}
GDI_ReleaseObj
(
hObj
);
}
}
...
...
dlls/gdi32/pen.c
View file @
af6c0a09
...
...
@@ -217,14 +217,19 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
*/
static
HGDIOBJ
PEN_SelectObject
(
HGDIOBJ
handle
,
HDC
hdc
)
{
HGDIOBJ
ret
;
HGDIOBJ
ret
=
0
;
DC
*
dc
=
DC_GetDCPtr
(
hdc
);
if
(
!
dc
)
return
0
;
ret
=
dc
->
hPen
;
if
(
dc
->
funcs
->
pSelectPen
)
handle
=
dc
->
funcs
->
pSelectPen
(
dc
->
physDev
,
handle
);
if
(
handle
)
dc
->
hPen
=
handle
;
else
ret
=
0
;
if
(
handle
)
{
ret
=
dc
->
hPen
;
dc
->
hPen
=
handle
;
GDI_inc_ref_count
(
handle
);
GDI_dec_ref_count
(
ret
);
}
DC_ReleaseDCPtr
(
dc
);
return
ret
;
}
...
...
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