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
04261475
Commit
04261475
authored
Apr 13, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an X context to associate the phys bitmap data to a bitmap handle
instead of directly accessing the bitmap structure.
parent
5673b00a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
68 deletions
+44
-68
bitmap.c
dlls/x11drv/bitmap.c
+44
-68
No files found.
dlls/x11drv/bitmap.c
View file @
04261475
...
...
@@ -23,12 +23,10 @@
#include <stdio.h>
#include <stdlib.h>
#include "gdi.h"
#include "windef.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "x11drv.h"
#include "wingdi.h"
#include "windef.h"
#include "wine/winuser16.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
x11drv
);
...
...
@@ -36,6 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
GC
BITMAP_monoGC
=
0
,
BITMAP_colorGC
=
0
;
X_PHYSBITMAP
BITMAP_stock_phys_bitmap
=
{
0
};
/* phys bitmap for the default stock bitmap */
static
XContext
bitmap_context
;
/* X context to associate a phys bitmap to a handle */
/***********************************************************************
* X11DRV_BITMAP_Init
*/
...
...
@@ -46,6 +46,7 @@ void X11DRV_BITMAP_Init(void)
/* Create the necessary GCs */
wine_tsx11_lock
();
bitmap_context
=
XUniqueContext
();
BITMAP_stock_phys_bitmap
.
pixmap_depth
=
1
;
BITMAP_stock_phys_bitmap
.
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
1
,
1
,
1
);
BITMAP_monoGC
=
XCreateGC
(
gdi_display
,
BITMAP_stock_phys_bitmap
.
pixmap
,
0
,
NULL
);
...
...
@@ -108,56 +109,45 @@ HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
BOOL
X11DRV_CreateBitmap
(
X11DRV_PDEVICE
*
physDev
,
HBITMAP
hbitmap
)
{
X_PHYSBITMAP
*
physBitmap
;
BOOL
ret
=
FALSE
;
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
BITMAP
bitmap
;
if
(
!
bmp
)
{
WARN
(
"Bad bitmap handle %p
\n
"
,
hbitmap
);
return
FALSE
;
}
if
(
!
GetObjectW
(
hbitmap
,
sizeof
(
bitmap
),
&
bitmap
))
return
FALSE
;
/* Check parameters */
if
(
b
mp
->
bitmap
.
bmPlanes
!=
1
)
goto
done
;
if
(
b
itmap
.
bmPlanes
!=
1
)
return
FALSE
;
if
((
b
mp
->
bitmap
.
bmBitsPixel
!=
1
)
&&
(
bmp
->
bitmap
.
bmBitsPixel
!=
screen_depth
))
if
((
b
itmap
.
bmBitsPixel
!=
1
)
&&
(
bitmap
.
bmBitsPixel
!=
screen_depth
))
{
ERR
(
"Trying to make bitmap with planes=%d, bpp=%d
\n
"
,
bmp
->
bitmap
.
bmPlanes
,
bmp
->
bitmap
.
bmBitsPixel
);
goto
done
;
bitmap
.
bmPlanes
,
bitmap
.
bmBitsPixel
);
return
FALSE
;
}
if
(
hbitmap
==
BITMAP_stock_phys_bitmap
.
hbitmap
)
{
ERR
(
"called for stock bitmap, please report
\n
"
);
goto
done
;
return
FALSE
;
}
TRACE
(
"(%p) %dx%d %d bpp
\n
"
,
hbitmap
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
bmp
->
bitmap
.
bmBitsPixel
);
TRACE
(
"(%p) %dx%d %d bpp
\n
"
,
hbitmap
,
bitmap
.
bmWidth
,
bitmap
.
bmHeight
,
bitmap
.
bmBitsPixel
);
if
(
!
(
physBitmap
=
X11DRV_init_phys_bitmap
(
hbitmap
)))
goto
done
;
if
(
!
(
physBitmap
=
X11DRV_init_phys_bitmap
(
hbitmap
)))
return
FALSE
;
/* Create the pixmap */
wine_tsx11_lock
();
physBitmap
->
pixmap_depth
=
bitmap
.
bmBitsPixel
;
physBitmap
->
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
bmp
->
bitmap
.
bmBitsPixel
);
bitmap
.
bmWidth
,
bitmap
.
bmHeight
,
bitmap
.
bmBitsPixel
);
wine_tsx11_unlock
();
if
(
!
physBitmap
->
pixmap
)
{
WARN
(
"Can't create Pixmap
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
physBitmap
);
goto
done
;
return
FALSE
;
}
bmp
->
physBitmap
=
physBitmap
;
ret
=
TRUE
;
if
(
bmp
->
bitmap
.
bmBits
)
/* Set bitmap bits */
X11DRV_SetBitmapBits
(
hbitmap
,
bmp
->
bitmap
.
bmBits
,
bmp
->
bitmap
.
bmHeight
*
bmp
->
bitmap
.
bmWidthBytes
);
done:
GDI_ReleaseObj
(
hbitmap
);
return
ret
;
if
(
bitmap
.
bmBits
)
/* Set bitmap bits */
X11DRV_SetBitmapBits
(
hbitmap
,
bitmap
.
bmBits
,
bitmap
.
bmHeight
*
bitmap
.
bmWidthBytes
);
return
TRUE
;
}
...
...
@@ -417,25 +407,20 @@ LONG X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count )
*/
BOOL
X11DRV_DeleteBitmap
(
HBITMAP
hbitmap
)
{
BITMAPOBJ
*
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
{
X_PHYSBITMAP
*
physBitmap
=
bmp
->
physBitmap
;
X_PHYSBITMAP
*
physBitmap
=
X11DRV_get_phys_bitmap
(
hbitmap
);
if
(
physBitmap
)
{
DIBSECTION
dib
;
if
(
physBitmap
)
{
DIBSECTION
dib
;
if
(
GetObjectW
(
hbitmap
,
sizeof
(
dib
),
&
dib
)
==
sizeof
(
dib
))
X11DRV_DIB_DeleteDIBSection
(
physBitmap
,
&
dib
);
if
(
GetObjectW
(
hbitmap
,
sizeof
(
dib
),
&
dib
)
==
sizeof
(
dib
))
X11DRV_DIB_DeleteDIBSection
(
physBitmap
,
&
dib
);
wine_tsx11_lock
();
if
(
physBitmap
->
pixmap
)
XFreePixmap
(
gdi_display
,
physBitmap
->
pixmap
);
wine_tsx11_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
physBitmap
);
bmp
->
physBitmap
=
NULL
;
}
GDI_ReleaseObj
(
hbitmap
);
wine_tsx11_lock
();
if
(
physBitmap
->
pixmap
)
XFreePixmap
(
gdi_display
,
physBitmap
->
pixmap
);
XDeleteContext
(
gdi_display
,
(
XID
)
hbitmap
,
bitmap_context
);
wine_tsx11_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
physBitmap
);
}
return
TRUE
;
}
...
...
@@ -448,13 +433,11 @@ BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap )
*/
X_PHYSBITMAP
*
X11DRV_get_phys_bitmap
(
HBITMAP
hbitmap
)
{
X_PHYSBITMAP
*
ret
=
NULL
;
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
{
ret
=
bmp
->
physBitmap
;
GDI_ReleaseObj
(
hbitmap
);
}
X_PHYSBITMAP
*
ret
;
wine_tsx11_lock
();
if
(
XFindContext
(
gdi_display
,
(
XID
)
hbitmap
,
bitmap_context
,
(
char
**
)
&
ret
))
ret
=
NULL
;
wine_tsx11_unlock
();
return
ret
;
}
...
...
@@ -462,25 +445,18 @@ X_PHYSBITMAP *X11DRV_get_phys_bitmap( HBITMAP hbitmap )
/***********************************************************************
* X11DRV_init_phys_bitmap
*
* Initialize the X physical bitmap info
if necessary
.
* Initialize the X physical bitmap info.
*/
X_PHYSBITMAP
*
X11DRV_init_phys_bitmap
(
HBITMAP
hbitmap
)
{
X_PHYSBITMAP
*
ret
=
NULL
;
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
BITMAP_MAGIC
);
if
(
bmp
)
X_PHYSBITMAP
*
ret
;
if
(
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ret
)
))
!=
NULL
)
{
if
(
!
(
ret
=
bmp
->
physBitmap
))
{
if
((
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ret
)
))
!=
NULL
)
{
ret
->
hbitmap
=
hbitmap
;
ret
->
pixmap
=
0
;
ret
->
pixmap_depth
=
bmp
->
bitmap
.
bmBitsPixel
;
bmp
->
physBitmap
=
ret
;
}
}
GDI_ReleaseObj
(
hbitmap
);
ret
->
hbitmap
=
hbitmap
;
wine_tsx11_lock
();
XSaveContext
(
gdi_display
,
(
XID
)
hbitmap
,
bitmap_context
,
(
char
*
)
ret
);
wine_tsx11_unlock
();
}
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