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
46cbdd0e
Commit
46cbdd0e
authored
Sep 15, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Implement the CreateBitmap entry point in the XRender driver.
parent
54b37b8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
81 deletions
+88
-81
bitmap.c
dlls/winex11.drv/bitmap.c
+43
-37
x11drv.h
dlls/winex11.drv/x11drv.h
+2
-0
xrender.c
dlls/winex11.drv/xrender.c
+43
-44
No files found.
dlls/winex11.drv/bitmap.c
View file @
46cbdd0e
...
@@ -122,6 +122,41 @@ HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
...
@@ -122,6 +122,41 @@ HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
}
}
/***********************************************************************
* X11DRV_create_phys_bitmap
*/
BOOL
X11DRV_create_phys_bitmap
(
HBITMAP
hbitmap
,
const
BITMAP
*
bitmap
,
int
depth
,
int
true_color
,
const
ColorShifts
*
shifts
)
{
X_PHYSBITMAP
*
physBitmap
;
if
(
!
(
physBitmap
=
X11DRV_init_phys_bitmap
(
hbitmap
)))
return
FALSE
;
physBitmap
->
pixmap_depth
=
depth
;
physBitmap
->
trueColor
=
true_color
;
if
(
true_color
)
physBitmap
->
pixmap_color_shifts
=
*
shifts
;
wine_tsx11_lock
();
physBitmap
->
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
bitmap
->
bmWidth
,
bitmap
->
bmHeight
,
physBitmap
->
pixmap_depth
);
if
(
physBitmap
->
pixmap
)
{
GC
gc
=
get_bitmap_gc
(
depth
);
XSetFunction
(
gdi_display
,
gc
,
GXclear
);
XFillRectangle
(
gdi_display
,
physBitmap
->
pixmap
,
gc
,
0
,
0
,
bitmap
->
bmWidth
,
bitmap
->
bmHeight
);
XSetFunction
(
gdi_display
,
gc
,
GXcopy
);
}
wine_tsx11_unlock
();
if
(
!
physBitmap
->
pixmap
)
{
WARN
(
"Can't create Pixmap
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
physBitmap
);
return
FALSE
;
}
return
TRUE
;
}
/****************************************************************************
/****************************************************************************
* CreateBitmap (X11DRV.@)
* CreateBitmap (X11DRV.@)
*
*
...
@@ -131,7 +166,6 @@ HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
...
@@ -131,7 +166,6 @@ HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
*/
*/
BOOL
X11DRV_CreateBitmap
(
PHYSDEV
dev
,
HBITMAP
hbitmap
)
BOOL
X11DRV_CreateBitmap
(
PHYSDEV
dev
,
HBITMAP
hbitmap
)
{
{
X_PHYSBITMAP
*
physBitmap
;
BITMAP
bitmap
;
BITMAP
bitmap
;
if
(
!
GetObjectW
(
hbitmap
,
sizeof
(
bitmap
),
&
bitmap
))
return
FALSE
;
if
(
!
GetObjectW
(
hbitmap
,
sizeof
(
bitmap
),
&
bitmap
))
return
FALSE
;
...
@@ -146,50 +180,22 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap )
...
@@ -146,50 +180,22 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap )
bitmap
.
bmPlanes
,
bitmap
.
bmBitsPixel
);
bitmap
.
bmPlanes
,
bitmap
.
bmBitsPixel
);
return
FALSE
;
return
FALSE
;
}
}
if
(
hbitmap
==
BITMAP_stock_phys_bitmap
.
hbitmap
)
{
ERR
(
"called for stock bitmap, please report
\n
"
);
return
FALSE
;
}
TRACE
(
"(%p) %dx%d %d bpp
\n
"
,
hbitmap
,
bitmap
.
bmWidth
,
bitmap
.
bmHeight
,
bitmap
.
bmBitsPixel
);
TRACE
(
"(%p) %dx%d %d bpp
\n
"
,
hbitmap
,
bitmap
.
bmWidth
,
bitmap
.
bmHeight
,
bitmap
.
bmBitsPixel
);
if
(
!
(
physBitmap
=
X11DRV_init_phys_bitmap
(
hbitmap
)))
return
FALSE
;
if
(
bitmap
.
bmBitsPixel
==
1
)
if
(
!
X11DRV_XRender_SetPhysBitmapDepth
(
physBitmap
,
bitmap
.
bmBitsPixel
,
NULL
))
{
{
if
(
bitmap
.
bmBitsPixel
==
1
)
if
(
hbitmap
==
BITMAP_stock_phys_bitmap
.
hbitmap
)
{
physBitmap
->
pixmap_depth
=
1
;
physBitmap
->
trueColor
=
FALSE
;
}
else
{
{
physBitmap
->
pixmap_depth
=
screen_depth
;
ERR
(
"called for stock bitmap, please report
\n
"
);
physBitmap
->
pixmap_color_shifts
=
X11DRV_PALETTE_default_shifts
;
return
FALSE
;
physBitmap
->
trueColor
=
(
visual
->
class
==
TrueColor
||
visual
->
class
==
DirectColor
);
}
}
return
X11DRV_create_phys_bitmap
(
hbitmap
,
&
bitmap
,
1
,
FALSE
,
NULL
);
}
}
wine_tsx11_lock
();
return
X11DRV_create_phys_bitmap
(
hbitmap
,
&
bitmap
,
screen_depth
,
/* Create the pixmap */
(
visual
->
class
==
TrueColor
||
visual
->
class
==
DirectColor
),
physBitmap
->
pixmap
=
XCreatePixmap
(
gdi_display
,
root_window
,
&
X11DRV_PALETTE_default_shifts
);
bitmap
.
bmWidth
,
bitmap
.
bmHeight
,
physBitmap
->
pixmap_depth
);
if
(
physBitmap
->
pixmap
)
{
GC
gc
=
get_bitmap_gc
(
physBitmap
->
pixmap_depth
);
XSetFunction
(
gdi_display
,
gc
,
GXclear
);
XFillRectangle
(
gdi_display
,
physBitmap
->
pixmap
,
gc
,
0
,
0
,
bitmap
.
bmWidth
,
bitmap
.
bmHeight
);
XSetFunction
(
gdi_display
,
gc
,
GXcopy
);
}
wine_tsx11_unlock
();
if
(
!
physBitmap
->
pixmap
)
{
WARN
(
"Can't create Pixmap
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
physBitmap
);
return
FALSE
;
}
return
TRUE
;
}
}
...
...
dlls/winex11.drv/x11drv.h
View file @
46cbdd0e
...
@@ -274,6 +274,8 @@ extern HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc) DECLSPEC_H
...
@@ -274,6 +274,8 @@ extern HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc) DECLSPEC_H
extern
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
)
DECLSPEC_HIDDEN
;
extern
Pixmap
X11DRV_DIB_CreatePixmapFromDIB
(
HGLOBAL
hPackedDIB
,
HDC
hdc
)
DECLSPEC_HIDDEN
;
extern
X_PHYSBITMAP
*
X11DRV_get_phys_bitmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
X_PHYSBITMAP
*
X11DRV_get_phys_bitmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
X_PHYSBITMAP
*
X11DRV_init_phys_bitmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
X_PHYSBITMAP
*
X11DRV_init_phys_bitmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
BOOL
X11DRV_create_phys_bitmap
(
HBITMAP
hbitmap
,
const
BITMAP
*
bitmap
,
int
depth
,
int
true_color
,
const
ColorShifts
*
shifts
)
DECLSPEC_HIDDEN
;
extern
Pixmap
X11DRV_get_pixmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
Pixmap
X11DRV_get_pixmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
RGNDATA
*
X11DRV_GetRegionData
(
HRGN
hrgn
,
HDC
hdc_lptodp
)
DECLSPEC_HIDDEN
;
extern
RGNDATA
*
X11DRV_GetRegionData
(
HRGN
hrgn
,
HDC
hdc_lptodp
)
DECLSPEC_HIDDEN
;
...
...
dlls/winex11.drv/xrender.c
View file @
46cbdd0e
...
@@ -1185,6 +1185,31 @@ static INT xrenderdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID
...
@@ -1185,6 +1185,31 @@ static INT xrenderdrv_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID
*/
*/
static
BOOL
xrenderdrv_CreateBitmap
(
PHYSDEV
dev
,
HBITMAP
hbitmap
)
static
BOOL
xrenderdrv_CreateBitmap
(
PHYSDEV
dev
,
HBITMAP
hbitmap
)
{
{
XRenderPictFormat
*
pict_format
=
NULL
;
ColorShifts
shifts
;
BITMAP
bitmap
;
if
(
!
GetObjectW
(
hbitmap
,
sizeof
(
bitmap
),
&
bitmap
))
return
FALSE
;
if
(
bitmap
.
bmPlanes
==
1
&&
bitmap
.
bmBitsPixel
==
screen_bpp
)
{
switch
(
bitmap
.
bmBitsPixel
)
{
case
16
:
pict_format
=
pict_formats
[
WXR_FORMAT_R5G6B5
];
break
;
case
24
:
pict_format
=
pict_formats
[
WXR_FORMAT_R8G8B8
];
break
;
case
32
:
pict_format
=
pict_formats
[
WXR_FORMAT_A8R8G8B8
];
break
;
}
}
if
(
pict_format
)
{
X11DRV_PALETTE_ComputeColorShifts
(
&
shifts
,
pict_format
->
direct
.
redMask
<<
pict_format
->
direct
.
red
,
pict_format
->
direct
.
greenMask
<<
pict_format
->
direct
.
green
,
pict_format
->
direct
.
blueMask
<<
pict_format
->
direct
.
blue
);
return
X11DRV_create_phys_bitmap
(
hbitmap
,
&
bitmap
,
pict_format
->
depth
,
TRUE
,
&
shifts
);
}
dev
=
GET_NEXT_PHYSDEV
(
dev
,
pCreateBitmap
);
dev
=
GET_NEXT_PHYSDEV
(
dev
,
pCreateBitmap
);
return
dev
->
funcs
->
pCreateBitmap
(
dev
,
hbitmap
);
return
dev
->
funcs
->
pCreateBitmap
(
dev
,
hbitmap
);
}
}
...
@@ -1253,8 +1278,12 @@ static void xrenderdrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_r
...
@@ -1253,8 +1278,12 @@ static void xrenderdrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_r
BOOL
X11DRV_XRender_SetPhysBitmapDepth
(
X_PHYSBITMAP
*
physBitmap
,
int
bits_pixel
,
const
DIBSECTION
*
dib
)
BOOL
X11DRV_XRender_SetPhysBitmapDepth
(
X_PHYSBITMAP
*
physBitmap
,
int
bits_pixel
,
const
DIBSECTION
*
dib
)
{
{
XRenderPictFormat
*
pict_format
=
NULL
;
XRenderPictFormat
*
pict_format
;
ColorShifts
shifts
;
ColorShifts
shifts
;
const
DWORD
*
bitfields
;
static
const
DWORD
bitfields_32
[
3
]
=
{
0xff0000
,
0x00ff00
,
0x0000ff
};
static
const
DWORD
bitfields_16
[
3
]
=
{
0x7c00
,
0x03e0
,
0x001f
};
/* When XRender is not around we can only use the screen_depth and when needed we perform depth conversion
/* When XRender is not around we can only use the screen_depth and when needed we perform depth conversion
* in software. Further we also return the screen depth for paletted formats or TrueColor formats with a low
* in software. Further we also return the screen depth for paletted formats or TrueColor formats with a low
...
@@ -1262,52 +1291,22 @@ BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, int bits_pixel,
...
@@ -1262,52 +1291,22 @@ BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, int bits_pixel,
if
(
!
X11DRV_XRender_Installed
||
bits_pixel
<=
8
)
if
(
!
X11DRV_XRender_Installed
||
bits_pixel
<=
8
)
return
FALSE
;
return
FALSE
;
if
(
dib
)
if
(
dib
->
dsBmih
.
biCompression
==
BI_BITFIELDS
)
{
bitfields
=
dib
->
dsBitfields
;
const
DWORD
*
bitfields
;
else
if
(
bits_pixel
==
24
||
bits_pixel
==
32
)
static
const
DWORD
bitfields_32
[
3
]
=
{
0xff0000
,
0x00ff00
,
0x0000ff
};
bitfields
=
bitfields_32
;
static
const
DWORD
bitfields_16
[
3
]
=
{
0x7c00
,
0x03e0
,
0x001f
};
if
(
dib
->
dsBmih
.
biCompression
==
BI_BITFIELDS
)
bitfields
=
dib
->
dsBitfields
;
else
if
(
bits_pixel
==
24
||
bits_pixel
==
32
)
bitfields
=
bitfields_32
;
else
bitfields
=
bitfields_16
;
X11DRV_PALETTE_ComputeColorShifts
(
&
shifts
,
bitfields
[
0
],
bitfields
[
1
],
bitfields
[
2
]);
pict_format
=
pict_formats
[
get_xrender_format_from_color_shifts
(
dib
->
dsBm
.
bmBitsPixel
,
&
shifts
)];
/* Common formats should be in our picture format table. */
if
(
!
pict_format
)
{
TRACE
(
"Unhandled dibsection format bpp=%d, redMask=%x, greenMask=%x, blueMask=%x
\n
"
,
dib
->
dsBm
.
bmBitsPixel
,
bitfields
[
0
],
bitfields
[
1
],
bitfields
[
2
]);
return
FALSE
;
}
}
else
else
{
bitfields
=
bitfields_16
;
int
red_mask
,
green_mask
,
blue_mask
;
/* We are dealing with a DDB */
switch
(
bits_pixel
)
{
case
16
:
pict_format
=
pict_formats
[
WXR_FORMAT_R5G6B5
];
break
;
case
24
:
pict_format
=
pict_formats
[
WXR_FORMAT_R8G8B8
];
break
;
case
32
:
pict_format
=
pict_formats
[
WXR_FORMAT_A8R8G8B8
];
break
;
}
if
(
!
pict_format
)
X11DRV_PALETTE_ComputeColorShifts
(
&
shifts
,
bitfields
[
0
],
bitfields
[
1
],
bitfields
[
2
]);
{
pict_format
=
pict_formats
[
get_xrender_format_from_color_shifts
(
dib
->
dsBm
.
bmBitsPixel
,
&
shifts
)];
TRACE
(
"Unhandled DDB bits_pixel=%d
\n
"
,
bits_pixel
);
return
FALSE
;
}
red_mask
=
pict_format
->
direct
.
redMask
<<
pict_format
->
direct
.
red
;
/* Common formats should be in our picture format table. */
green_mask
=
pict_format
->
direct
.
greenMask
<<
pict_format
->
direct
.
green
;
if
(
!
pict_format
)
blue_mask
=
pict_format
->
direct
.
blueMask
<<
pict_format
->
direct
.
blue
;
{
X11DRV_PALETTE_ComputeColorShifts
(
&
shifts
,
red_mask
,
green_mask
,
blue_mask
);
TRACE
(
"Unhandled dibsection format bpp=%d, redMask=%x, greenMask=%x, blueMask=%x
\n
"
,
dib
->
dsBm
.
bmBitsPixel
,
bitfields
[
0
],
bitfields
[
1
],
bitfields
[
2
]);
return
FALSE
;
}
}
physBitmap
->
pixmap_depth
=
pict_format
->
depth
;
physBitmap
->
pixmap_depth
=
pict_format
->
depth
;
...
...
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