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
65e4d345
Commit
65e4d345
authored
Mar 28, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged X11DRV_BITMAP_CreateBitmapHeaderFromPixmap into
X11DRV_DIB_CreateDIBFromPixmap and simplified the code a bit.
parent
6c42be25
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
106 deletions
+46
-106
bitmap.c
dlls/x11drv/bitmap.c
+0
-50
clipboard.c
dlls/x11drv/clipboard.c
+1
-1
dib.c
dlls/x11drv/dib.c
+44
-52
x11drv.h
dlls/x11drv/x11drv.h
+1
-3
No files found.
dlls/x11drv/bitmap.c
View file @
65e4d345
...
@@ -433,56 +433,6 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap )
...
@@ -433,56 +433,6 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap )
return
TRUE
;
return
TRUE
;
}
}
/**************************************************************************
* X11DRV_BITMAP_CreateBitmapHeaderFromPixmap
*
* Allocates an HBITMAP which references the Pixmap passed in.
* Note: This function makes the bitmap an owner of the Pixmap so subsequently
* calling DeleteObject on this will free the Pixmap as well.
*/
HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap
(
HDC
hdc
,
Pixmap
pixmap
)
{
HDC
hdcMem
;
Pixmap
old_pixmap
;
HBITMAP
hBmp
=
0
,
old
;
Window
root
;
int
x
,
y
;
/* Unused */
unsigned
border_width
;
/* Unused */
unsigned
int
depth
,
width
,
height
;
/* Get the Pixmap dimensions and bit depth */
wine_tsx11_lock
();
if
(
!
XGetGeometry
(
gdi_display
,
pixmap
,
&
root
,
&
x
,
&
y
,
&
width
,
&
height
,
&
border_width
,
&
depth
))
depth
=
0
;
wine_tsx11_unlock
();
if
(
!
depth
)
goto
END
;
TRACE
(
"
\t
Pixmap properties: width=%d, height=%d, depth=%d
\n
"
,
width
,
height
,
depth
);
/*
* Create an HBITMAP with the same dimensions and BPP as the pixmap,
* and make it a container for the pixmap passed.
*/
hBmp
=
CreateBitmap
(
width
,
height
,
1
,
depth
,
NULL
);
/* force bitmap to be owned by a screen DC */
hdcMem
=
CreateCompatibleDC
(
hdc
);
old
=
SelectObject
(
hdcMem
,
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
);
END:
TRACE
(
"
\t
Returning HBITMAP %p
\n
"
,
hBmp
);
return
hBmp
;
}
/***********************************************************************
/***********************************************************************
* X11DRV_set_pixmap
* X11DRV_set_pixmap
...
...
dlls/x11drv/clipboard.c
View file @
65e4d345
...
@@ -1216,7 +1216,7 @@ HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(LPBYTE lpdata, UINT cBytes)
...
@@ -1216,7 +1216,7 @@ HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(LPBYTE lpdata, UINT cBytes)
HWND
hwnd
=
GetOpenClipboardWindow
();
HWND
hwnd
=
GetOpenClipboardWindow
();
HDC
hdc
=
GetDC
(
hwnd
);
HDC
hdc
=
GetDC
(
hwnd
);
hTargetImage
=
X11DRV_DIB_CreateDIBFromPixmap
(
*
pPixmap
,
hdc
,
TRUE
);
hTargetImage
=
X11DRV_DIB_CreateDIBFromPixmap
(
*
pPixmap
,
hdc
);
ReleaseDC
(
hwnd
,
hdc
);
ReleaseDC
(
hwnd
,
hdc
);
...
...
dlls/x11drv/dib.c
View file @
65e4d345
...
@@ -5048,21 +5048,46 @@ HGLOBAL X11DRV_DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp)
...
@@ -5048,21 +5048,46 @@ HGLOBAL X11DRV_DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp)
* X11DRV_DIB_CreateDIBFromPixmap
* X11DRV_DIB_CreateDIBFromPixmap
*
*
* Allocates a packed DIB and copies the Pixmap data into it.
* Allocates a packed DIB and copies the Pixmap data into it.
*
If bDeletePixmap is TRUE, t
he Pixmap passed in is deleted after the conversion.
*
T
he Pixmap passed in is deleted after the conversion.
*/
*/
HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap
(
Pixmap
pixmap
,
HDC
hdc
,
BOOL
bDeletePixmap
)
HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap
(
Pixmap
pixmap
,
HDC
hdc
)
{
{
HBITMAP
hBmp
=
0
;
HDC
hdcMem
;
BITMAPOBJ
*
pBmp
=
NULL
;
Pixmap
old_pixmap
;
HBITMAP
hBmp
=
0
,
old
;
HGLOBAL
hPackedDIB
=
0
;
HGLOBAL
hPackedDIB
=
0
;
Window
root
;
int
x
,
y
;
/* Unused */
unsigned
border_width
;
/* Unused */
unsigned
int
depth
,
width
,
height
;
/* Allocates an HBITMAP which references the Pixmap passed to us */
/* Get the Pixmap dimensions and bit depth */
hBmp
=
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap
(
hdc
,
pixmap
);
wine_tsx11_lock
();
if
(
!
hBmp
)
if
(
!
XGetGeometry
(
gdi_display
,
pixmap
,
&
root
,
&
x
,
&
y
,
&
width
,
&
height
,
{
&
border_width
,
&
depth
))
depth
=
0
;
TRACE
(
"
\t
Could not create bitmap header for Pixmap
\n
"
);
wine_tsx11_unlock
();
goto
END
;
if
(
!
depth
)
return
0
;
}
TRACE
(
"
\t
Pixmap properties: width=%d, height=%d, depth=%d
\n
"
,
width
,
height
,
depth
);
/*
* Create an HBITMAP with the same dimensions and BPP as the pixmap,
* and make it a container for the pixmap passed.
*/
hBmp
=
CreateBitmap
(
width
,
height
,
1
,
depth
,
NULL
);
/* force bitmap to be owned by a screen DC */
hdcMem
=
CreateCompatibleDC
(
hdc
);
old
=
SelectObject
(
hdcMem
,
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
);
/*
/*
* Create a packed DIB from the Pixmap wrapper bitmap created above.
* Create a packed DIB from the Pixmap wrapper bitmap created above.
...
@@ -5071,22 +5096,11 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixma
...
@@ -5071,22 +5096,11 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixma
*/
*/
hPackedDIB
=
X11DRV_DIB_CreateDIBFromBitmap
(
hdc
,
hBmp
);
hPackedDIB
=
X11DRV_DIB_CreateDIBFromBitmap
(
hdc
,
hBmp
);
/* Get a pointer to the BITMAPOBJ structure */
pBmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hBmp
,
BITMAP_MAGIC
);
/* We can now get rid of the HBITMAP wrapper we created earlier.
/* We can now get rid of the HBITMAP wrapper we created earlier.
* Note: Simply calling DeleteObject will free the embedded Pixmap as well.
* Note: Simply calling DeleteObject will free the embedded Pixmap as well.
*/
*/
if
(
!
bDeletePixmap
)
{
/* Clear the physBitmap to prevent the Pixmap from being deleted by DeleteObject */
X11DRV_set_pixmap
(
hBmp
,
0
);
pBmp
->
funcs
=
NULL
;
}
GDI_ReleaseObj
(
hBmp
);
DeleteObject
(
hBmp
);
DeleteObject
(
hBmp
);
END:
TRACE
(
"
\t
Returning packed DIB %p
\n
"
,
hPackedDIB
);
TRACE
(
"
\t
Returning packed DIB %p
\n
"
,
hPackedDIB
);
return
hPackedDIB
;
return
hPackedDIB
;
}
}
...
@@ -5099,46 +5113,24 @@ END:
...
@@ -5099,46 +5113,24 @@ END:
*/
*/
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
)
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
)
{
{
Pixmap
pixmap
=
None
;
Pixmap
pixmap
;
HBITMAP
hBmp
=
0
;
HBITMAP
hBmp
;
BITMAPOBJ
*
pBmp
=
NULL
;
LPBITMAPINFO
pbmi
;
LPBYTE
pPackedDIB
=
NULL
;
LPBITMAPINFO
pbmi
=
NULL
;
LPBITMAPINFOHEADER
pbmiHeader
=
NULL
;
LPBYTE
pbits
=
NULL
;
/* Get a pointer to the packed DIB's data */
pPackedDIB
=
(
LPBYTE
)
GlobalLock
(
hPackedDIB
);
pbmiHeader
=
(
LPBITMAPINFOHEADER
)
pPackedDIB
;
pbmi
=
(
LPBITMAPINFO
)
pPackedDIB
;
pbits
=
(
LPBYTE
)(
pPackedDIB
+
X11DRV_DIB_BitmapInfoSize
(
(
LPBITMAPINFO
)
pbmiHeader
,
DIB_RGB_COLORS
));
/* Create a DDB from the DIB */
/* Create a DDB from the DIB */
hBmp
=
CreateDIBitmap
(
hdc
,
pbmi
=
GlobalLock
(
hPackedDIB
);
pbmiHeader
,
hBmp
=
CreateDIBitmap
(
hdc
,
&
pbmi
->
bmiHeader
,
CBM_INIT
,
CBM_INIT
,
(
LPBYTE
)
pbmi
+
X11DRV_DIB_BitmapInfoSize
(
pbmi
,
DIB_RGB_COLORS
),
(
LPVOID
)
pbits
,
pbmi
,
DIB_RGB_COLORS
);
pbmi
,
DIB_RGB_COLORS
);
GlobalUnlock
(
hPackedDIB
);
GlobalUnlock
(
hPackedDIB
);
TRACE
(
"CreateDIBitmap returned %p
\n
"
,
hBmp
);
/* Retrieve the internal Pixmap from the DDB */
pBmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hBmp
,
BITMAP_MAGIC
);
/* clear the physBitmap so that we can steal its pixmap */
/* clear the physBitmap so that we can steal its pixmap */
pixmap
=
X11DRV_set_pixmap
(
hBmp
,
0
);
pixmap
=
X11DRV_set_pixmap
(
hBmp
,
0
);
pBmp
->
funcs
=
NULL
;
/* Delete the DDB we created earlier now that we have stolen its pixmap */
/* Delete the DDB we created earlier now that we have stolen its pixmap */
GDI_ReleaseObj
(
hBmp
);
DeleteObject
(
hBmp
);
DeleteObject
(
hBmp
);
TRACE
(
"
\t
Returning Pixmap %ld
\n
"
,
pixmap
);
TRACE
(
"Returning Pixmap %ld
\n
"
,
pixmap
);
return
pixmap
;
return
pixmap
;
}
}
dlls/x11drv/x11drv.h
View file @
65e4d345
...
@@ -202,11 +202,9 @@ extern void X11DRV_BITMAP_Init(void);
...
@@ -202,11 +202,9 @@ extern void X11DRV_BITMAP_Init(void);
extern
void
X11DRV_FONT_Init
(
int
log_pixels_x
,
int
log_pixels_y
);
extern
void
X11DRV_FONT_Init
(
int
log_pixels_x
,
int
log_pixels_y
);
extern
int
X11DRV_DIB_BitmapInfoSize
(
const
BITMAPINFO
*
info
,
WORD
coloruse
);
extern
int
X11DRV_DIB_BitmapInfoSize
(
const
BITMAPINFO
*
info
,
WORD
coloruse
);
extern
XImage
*
X11DRV_BITMAP_GetXImage
(
const
struct
tagBITMAPOBJ
*
bmp
);
extern
XImage
*
X11DRV_DIB_CreateXImage
(
int
width
,
int
height
,
int
depth
);
extern
XImage
*
X11DRV_DIB_CreateXImage
(
int
width
,
int
height
,
int
depth
);
extern
HBITMAP
X11DRV_BITMAP_CreateBitmapHeaderFromPixmap
(
HDC
hdc
,
Pixmap
pixmap
);
extern
HGLOBAL
X11DRV_DIB_CreateDIBFromBitmap
(
HDC
hdc
,
HBITMAP
hBmp
);
extern
HGLOBAL
X11DRV_DIB_CreateDIBFromBitmap
(
HDC
hdc
,
HBITMAP
hBmp
);
extern
HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap
(
Pixmap
pixmap
,
HDC
hdc
,
BOOL
bDeletePixmap
);
extern
HGLOBAL
X11DRV_DIB_CreateDIBFromPixmap
(
Pixmap
pixmap
,
HDC
hdc
);
extern
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
);
extern
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
);
extern
Pixmap
X11DRV_set_pixmap
(
HBITMAP
hbitmap
,
Pixmap
pixmap
);
extern
Pixmap
X11DRV_set_pixmap
(
HBITMAP
hbitmap
,
Pixmap
pixmap
);
extern
Pixmap
X11DRV_get_pixmap
(
HBITMAP
hbitmap
);
extern
Pixmap
X11DRV_get_pixmap
(
HBITMAP
hbitmap
);
...
...
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