Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
5fd13261
Commit
5fd13261
authored
Mar 27, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added X11DRV_get_pixmap and X11DRV_set_pixmap functions to avoid
direct accesses to the physBitmap field of the bitmap structure.
parent
edcbd136
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
42 deletions
+58
-42
bitmap.c
dlls/x11drv/bitmap.c
+45
-27
brush.c
dlls/x11drv/brush.c
+4
-3
dib.c
dlls/x11drv/dib.c
+4
-5
window.c
dlls/x11drv/window.c
+2
-2
x11ddraw.c
dlls/x11drv/x11ddraw.c
+1
-4
x11drv.h
dlls/x11drv/x11drv.h
+2
-1
No files found.
dlls/x11drv/bitmap.c
View file @
5fd13261
...
...
@@ -80,7 +80,7 @@ HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
if
(
hbitmap
==
BITMAP_stock_bitmap
)
physDev
->
drawable
=
BITMAP_stock_pixmap
;
else
physDev
->
drawable
=
(
Pixmap
)
bmp
->
physBitmap
;
physDev
->
drawable
=
X11DRV_get_pixmap
(
hbitmap
)
;
/* Change GC depth if needed */
...
...
@@ -109,6 +109,7 @@ HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
*/
BOOL
X11DRV_CreateBitmap
(
X11DRV_PDEVICE
*
physDev
,
HBITMAP
hbitmap
)
{
Pixmap
pixmap
;
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
!
bmp
)
{
...
...
@@ -141,16 +142,16 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
/* Create the pixmap */
wine_tsx11_lock
();
bmp
->
physBitmap
=
(
void
*
)
XCreatePixmap
(
gdi_display
,
root_window
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
bmp
->
bitmap
.
bmBitsPixel
);
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
bmp
->
bitmap
.
bmBitsPixel
);
wine_tsx11_unlock
();
if
(
!
bmp
->
physBit
map
)
if
(
!
pix
map
)
{
WARN
(
"Can't create Pixmap
\n
"
);
GDI_ReleaseObj
(
hbitmap
);
return
FALSE
;
}
X11DRV_set_pixmap
(
hbitmap
,
pixmap
);
if
(
bmp
->
bitmap
.
bmBits
)
/* Set bitmap bits */
X11DRV_SetBitmapBits
(
hbitmap
,
bmp
->
bitmap
.
bmBits
,
...
...
@@ -172,6 +173,7 @@ LONG X11DRV_GetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count )
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
LONG
old_height
,
height
;
Pixmap
pixmap
=
X11DRV_get_pixmap
(
hbitmap
);
XImage
*
image
;
LPBYTE
tbuf
,
startline
;
int
h
,
w
;
...
...
@@ -187,8 +189,7 @@ LONG X11DRV_GetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count )
old_height
=
bmp
->
bitmap
.
bmHeight
;
height
=
bmp
->
bitmap
.
bmHeight
=
count
/
bmp
->
bitmap
.
bmWidthBytes
;
image
=
XGetImage
(
gdi_display
,
(
Pixmap
)
bmp
->
physBitmap
,
0
,
0
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
image
=
XGetImage
(
gdi_display
,
pixmap
,
0
,
0
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
AllPlanes
,
ZPixmap
);
bmp
->
bitmap
.
bmHeight
=
old_height
;
...
...
@@ -301,6 +302,7 @@ LONG X11DRV_GetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count )
LONG
X11DRV_SetBitmapBits
(
HBITMAP
hbitmap
,
const
void
*
bits
,
LONG
count
)
{
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
Pixmap
pixmap
=
X11DRV_get_pixmap
(
hbitmap
);
LONG
height
;
XImage
*
image
;
const
BYTE
*
sbuf
,
*
startline
;
...
...
@@ -404,7 +406,7 @@ LONG X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count )
FIXME
(
"Unhandled bits:%d
\n
"
,
bmp
->
bitmap
.
bmBitsPixel
);
}
XPutImage
(
gdi_display
,
(
Pixmap
)
bmp
->
physBit
map
,
BITMAP_GC
(
bmp
),
XPutImage
(
gdi_display
,
pix
map
,
BITMAP_GC
(
bmp
),
image
,
0
,
0
,
0
,
0
,
bmp
->
bitmap
.
bmWidth
,
height
);
XDestroyImage
(
image
);
/* frees image->data too */
wine_tsx11_unlock
();
...
...
@@ -420,10 +422,11 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap )
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
{
Pixmap
pixmap
;
if
(
bmp
->
dib
)
X11DRV_DIB_DeleteDIBSection
(
bmp
);
pixmap
=
X11DRV_set_pixmap
(
hbitmap
,
0
);
wine_tsx11_lock
();
if
(
bmp
->
physBitmap
)
XFreePixmap
(
gdi_display
,
(
Pixmap
)
bmp
->
physBitmap
);
bmp
->
physBitmap
=
NULL
;
if
(
pixmap
)
XFreePixmap
(
gdi_display
,
pixmap
);
wine_tsx11_unlock
();
GDI_ReleaseObj
(
hbitmap
);
}
...
...
@@ -440,8 +443,8 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap )
HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap
(
HDC
hdc
,
Pixmap
pixmap
)
{
HDC
hdcMem
;
Pixmap
old_pixmap
;
HBITMAP
hBmp
=
0
,
old
;
BITMAPOBJ
*
pBmp
=
NULL
;
Window
root
;
int
x
,
y
;
/* Unused */
unsigned
border_width
;
/* Unused */
...
...
@@ -467,11 +470,10 @@ HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(HDC hdc, Pixmap pixmap)
hdcMem
=
CreateCompatibleDC
(
hdc
);
old
=
SelectObject
(
hdcMem
,
hBmp
);
pBmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hBmp
,
BITMAP_MAGIC
);
if
(
pBmp
->
physBitmap
)
XFreePixmap
(
gdi_display
,
(
Pixmap
)
pBmp
->
physBitmap
);
pBmp
->
physBitmap
=
(
void
*
)
pixmap
;
GDI_ReleaseObj
(
hBmp
);
old_pixmap
=
X11DRV_set_pixmap
(
hBmp
,
pixmap
);
wine_tsx11_lock
();
if
(
old_pixmap
)
XFreePixmap
(
gdi_display
,
old_pixmap
);
wine_tsx11_unlock
();
SelectObject
(
hdcMem
,
old
);
DeleteDC
(
hdcMem
);
...
...
@@ -483,21 +485,37 @@ END:
/***********************************************************************
* X11DRV_
BITMAP_P
ixmap
* X11DRV_
set_p
ixmap
*
*
This function exists solely for x11 driver of the window system
.
*
Set the pixmap associated to a bitmap, and return the previous one
.
*/
Pixmap
X11DRV_
BITMAP_Pixmap
(
HBITMAP
hbitmap
)
Pixmap
X11DRV_
set_pixmap
(
HBITMAP
hbitmap
,
Pixmap
pixmap
)
{
Pixmap
pixmap
;
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
{
pixmap
=
(
Pixmap
)
bmp
->
physBitmap
;
GDI_ReleaseObj
(
hbitmap
);
Pixmap
ret
=
0
;
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
{
ret
=
(
Pixmap
)
bmp
->
physBitmap
;
bmp
->
physBitmap
=
(
void
*
)
pixmap
;
GDI_ReleaseObj
(
hbitmap
);
}
else
{
ERR
(
"handle %p returned no obj
\n
"
,
hbitmap
);
pixmap
=
0
;
return
ret
;
}
/***********************************************************************
* X11DRV_get_pixmap
*
* Retrieve the pixmap associated to a bitmap.
*/
Pixmap
X11DRV_get_pixmap
(
HBITMAP
hbitmap
)
{
Pixmap
pixmap
=
0
;
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
{
pixmap
=
(
Pixmap
)
bmp
->
physBitmap
;
GDI_ReleaseObj
(
hbitmap
);
}
return
pixmap
;
}
dlls/x11drv/brush.c
View file @
5fd13261
...
...
@@ -176,10 +176,11 @@ static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
static
BOOL
BRUSH_SelectPatternBrush
(
X11DRV_PDEVICE
*
physDev
,
HBITMAP
hbitmap
)
{
BOOL
ret
=
FALSE
;
Pixmap
pixmap
;
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
!
bmp
)
return
FALSE
;
if
(
!
bmp
->
physBitmap
)
goto
done
;
if
(
!
(
pixmap
=
X11DRV_get_pixmap
(
hbitmap
))
)
goto
done
;
wine_tsx11_lock
();
if
((
physDev
->
depth
==
1
)
&&
(
bmp
->
bitmap
.
bmBitsPixel
!=
1
))
...
...
@@ -188,7 +189,7 @@ static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
physDev
->
brush
.
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
1
);
/* FIXME: should probably convert to monochrome instead */
XCopyPlane
(
gdi_display
,
(
Pixmap
)
bmp
->
physBit
map
,
physDev
->
brush
.
pixmap
,
XCopyPlane
(
gdi_display
,
pix
map
,
physDev
->
brush
.
pixmap
,
BITMAP_monoGC
,
0
,
0
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
0
,
0
,
1
);
}
else
...
...
@@ -196,7 +197,7 @@ static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
physDev
->
brush
.
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
bmp
->
bitmap
.
bmBitsPixel
);
XCopyArea
(
gdi_display
,
(
Pixmap
)
bmp
->
physBit
map
,
physDev
->
brush
.
pixmap
,
XCopyArea
(
gdi_display
,
pix
map
,
physDev
->
brush
.
pixmap
,
BITMAP_GC
(
bmp
),
0
,
0
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
0
,
0
);
}
wine_tsx11_unlock
();
...
...
dlls/x11drv/dib.c
View file @
5fd13261
...
...
@@ -3881,7 +3881,7 @@ INT X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
descr
.
palentry
=
NULL
;
descr
.
lines
=
tmpheight
>=
0
?
lines
:
-
lines
;
descr
.
depth
=
bmp
->
bitmap
.
bmBitsPixel
;
descr
.
drawable
=
(
Pixmap
)
bmp
->
physBitmap
;
descr
.
drawable
=
X11DRV_get_pixmap
(
hbitmap
)
;
descr
.
gc
=
BITMAP_GC
(
bmp
);
descr
.
xSrc
=
0
;
descr
.
ySrc
=
0
;
...
...
@@ -4002,7 +4002,7 @@ INT X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
descr
.
image
=
NULL
;
descr
.
lines
=
lines
;
descr
.
depth
=
bmp
->
bitmap
.
bmBitsPixel
;
descr
.
drawable
=
(
Pixmap
)
bmp
->
physBitmap
;
descr
.
drawable
=
X11DRV_get_pixmap
(
hbitmap
)
;
descr
.
gc
=
BITMAP_GC
(
bmp
);
descr
.
width
=
bmp
->
bitmap
.
bmWidth
;
descr
.
height
=
bmp
->
bitmap
.
bmHeight
;
...
...
@@ -5080,7 +5080,7 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixma
if
(
!
bDeletePixmap
)
{
/* Clear the physBitmap to prevent the Pixmap from being deleted by DeleteObject */
pBmp
->
physBitmap
=
NULL
;
X11DRV_set_pixmap
(
hBmp
,
0
)
;
pBmp
->
funcs
=
NULL
;
}
GDI_ReleaseObj
(
hBmp
);
...
...
@@ -5131,9 +5131,8 @@ Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
pBmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hBmp
,
BITMAP_MAGIC
);
pixmap
=
(
Pixmap
)
pBmp
->
physBitmap
;
/* clear the physBitmap so that we can steal its pixmap */
p
Bmp
->
physBitmap
=
NULL
;
p
ixmap
=
X11DRV_set_pixmap
(
hBmp
,
0
)
;
pBmp
->
funcs
=
NULL
;
/* Delete the DDB we created earlier now that we have stolen its pixmap */
...
...
dlls/x11drv/window.c
View file @
5fd13261
...
...
@@ -336,8 +336,8 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data,
data
->
hWMIconBitmap
=
ii
.
hbmColor
;
data
->
hWMIconMask
=
ii
.
hbmMask
;
hints
->
icon_pixmap
=
X11DRV_
BITMAP_P
ixmap
(
data
->
hWMIconBitmap
);
hints
->
icon_mask
=
X11DRV_
BITMAP_P
ixmap
(
data
->
hWMIconMask
);
hints
->
icon_pixmap
=
X11DRV_
get_p
ixmap
(
data
->
hWMIconBitmap
);
hints
->
icon_mask
=
X11DRV_
get_p
ixmap
(
data
->
hWMIconMask
);
destroy_icon_window
(
display
,
data
);
hints
->
flags
=
(
hints
->
flags
&
~
IconWindowHint
)
|
IconPixmapHint
|
IconMaskHint
;
}
...
...
dlls/x11drv/x11ddraw.c
View file @
5fd13261
...
...
@@ -51,10 +51,7 @@ static void SetPrimaryDIB(HBITMAP hBmp)
{
X11DRV_DD_PrimaryDIB
=
hBmp
;
if
(
hBmp
)
{
BITMAPOBJ
*
bmp
;
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hBmp
,
BITMAP_MAGIC
);
X11DRV_DD_PrimaryDrawable
=
(
Pixmap
)
bmp
->
physBitmap
;
GDI_ReleaseObj
(
hBmp
);
X11DRV_DD_PrimaryDrawable
=
X11DRV_get_pixmap
(
hBmp
);
}
else
{
X11DRV_DD_PrimaryDrawable
=
0
;
}
...
...
dlls/x11drv/x11drv.h
View file @
5fd13261
...
...
@@ -208,7 +208,8 @@ extern HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(HDC hdc, Pixmap pixmap
extern
HGLOBAL
X11DRV_DIB_CreateDIBFromBitmap
(
HDC
hdc
,
HBITMAP
hBmp
);
extern
HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap
(
Pixmap
pixmap
,
HDC
hdc
,
BOOL
bDeletePixmap
);
extern
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
);
extern
Pixmap
X11DRV_BITMAP_Pixmap
(
HBITMAP
);
extern
Pixmap
X11DRV_set_pixmap
(
HBITMAP
hbitmap
,
Pixmap
pixmap
);
extern
Pixmap
X11DRV_get_pixmap
(
HBITMAP
hbitmap
);
extern
RGNDATA
*
X11DRV_GetRegionData
(
HRGN
hrgn
,
HDC
hdc_lptodp
);
...
...
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