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
be835e2d
Commit
be835e2d
authored
Jul 20, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Verify that the color map matches in PutImage for 4 and 8 bpp.
parent
476a1fa1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
32 deletions
+57
-32
bitblt.c
dlls/winex11.drv/bitblt.c
+57
-32
No files found.
dlls/winex11.drv/bitblt.c
View file @
be835e2d
...
@@ -1659,6 +1659,60 @@ static void set_color_info( PHYSDEV dev, const ColorShifts *color_shifts, BITMAP
...
@@ -1659,6 +1659,60 @@ static void set_color_info( PHYSDEV dev, const ColorShifts *color_shifts, BITMAP
}
}
}
}
/* check if the specified color info is suitable for PutImage */
static
BOOL
matching_color_info
(
PHYSDEV
dev
,
const
ColorShifts
*
color_shifts
,
const
BITMAPINFO
*
info
)
{
DWORD
*
colors
=
(
DWORD
*
)((
char
*
)
info
+
info
->
bmiHeader
.
biSize
);
switch
(
info
->
bmiHeader
.
biBitCount
)
{
case
1
:
if
(
info
->
bmiHeader
.
biCompression
!=
BI_RGB
)
return
FALSE
;
return
!
info
->
bmiHeader
.
biClrUsed
;
/* color map not allowed */
case
4
:
case
8
:
{
RGBQUAD
*
rgb
=
(
RGBQUAD
*
)
colors
;
PALETTEENTRY
palette
[
256
];
UINT
i
,
count
;
if
(
info
->
bmiHeader
.
biCompression
!=
BI_RGB
)
return
FALSE
;
count
=
X11DRV_GetSystemPaletteEntries
(
dev
,
0
,
1
<<
info
->
bmiHeader
.
biBitCount
,
palette
);
if
(
count
!=
info
->
bmiHeader
.
biClrUsed
)
return
FALSE
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
rgb
[
i
].
rgbRed
!=
palette
[
i
].
peRed
||
rgb
[
i
].
rgbGreen
!=
palette
[
i
].
peGreen
||
rgb
[
i
].
rgbBlue
!=
palette
[
i
].
peBlue
)
return
FALSE
;
}
return
TRUE
;
}
case
16
:
if
(
info
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
return
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
==
colors
[
0
]
&&
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
==
colors
[
1
]
&&
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
==
colors
[
2
]);
if
(
info
->
bmiHeader
.
biCompression
==
BI_RGB
)
return
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
==
0x7c00
&&
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
==
0x03e0
&&
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
==
0x001f
);
break
;
case
32
:
if
(
info
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
return
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
==
colors
[
0
]
&&
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
==
colors
[
1
]
&&
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
==
colors
[
2
]);
/* fall through */
case
24
:
if
(
info
->
bmiHeader
.
biCompression
==
BI_RGB
)
return
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
==
0xff0000
&&
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
==
0x00ff00
&&
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
==
0x0000ff
);
break
;
}
return
FALSE
;
}
/* copy the image bits, fixing up alignment and byte swapping as necessary */
/* copy the image bits, fixing up alignment and byte swapping as necessary */
static
DWORD
copy_image_bits
(
BITMAPINFO
*
info
,
const
ColorShifts
*
color_shifts
,
XImage
*
image
,
static
DWORD
copy_image_bits
(
BITMAPINFO
*
info
,
const
ColorShifts
*
color_shifts
,
XImage
*
image
,
const
struct
gdi_image_bits
*
src_bits
,
struct
gdi_image_bits
*
dst_bits
,
const
struct
gdi_image_bits
*
src_bits
,
struct
gdi_image_bits
*
dst_bits
,
...
@@ -1814,7 +1868,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const str
...
@@ -1814,7 +1868,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const str
{
{
X11DRV_PDEVICE
*
physdev
;
X11DRV_PDEVICE
*
physdev
;
X_PHYSBITMAP
*
bitmap
;
X_PHYSBITMAP
*
bitmap
;
DWORD
ret
=
ERROR_SUCCESS
;
DWORD
ret
;
XImage
*
image
;
XImage
*
image
;
int
depth
;
int
depth
;
struct
gdi_image_bits
dst_bits
;
struct
gdi_image_bits
dst_bits
;
...
@@ -1842,37 +1896,8 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const str
...
@@ -1842,37 +1896,8 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, const str
if
(
info
->
bmiHeader
.
biPlanes
!=
1
)
goto
update_format
;
if
(
info
->
bmiHeader
.
biPlanes
!=
1
)
goto
update_format
;
if
(
info
->
bmiHeader
.
biBitCount
!=
format
->
bits_per_pixel
)
goto
update_format
;
if
(
info
->
bmiHeader
.
biBitCount
!=
format
->
bits_per_pixel
)
goto
update_format
;
/* FIXME: could try to handle 1-bpp using XCopyPlane */
/* FIXME: could try to handle 1-bpp using XCopyPlane */
if
(
!
matching_color_info
(
dev
,
color_shifts
,
info
))
goto
update_format
;
if
(
info
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
if
(
!
bits
)
return
ERROR_SUCCESS
;
/* just querying the format */
{
DWORD
*
masks
=
(
DWORD
*
)((
char
*
)
info
+
info
->
bmiHeader
.
biSize
);
if
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
!=
masks
[
0
]
||
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
!=
masks
[
1
]
||
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
!=
masks
[
2
])
goto
update_format
;
}
else
if
(
info
->
bmiHeader
.
biCompression
==
BI_RGB
)
{
switch
(
info
->
bmiHeader
.
biBitCount
)
{
case
16
:
if
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
!=
0x7c00
||
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
!=
0x03e0
||
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
!=
0x001f
)
goto
update_format
;
break
;
case
24
:
case
32
:
if
(
color_shifts
->
logicalRed
.
max
<<
color_shifts
->
logicalRed
.
shift
!=
0xff0000
||
color_shifts
->
logicalGreen
.
max
<<
color_shifts
->
logicalGreen
.
shift
!=
0x00ff00
||
color_shifts
->
logicalBlue
.
max
<<
color_shifts
->
logicalBlue
.
shift
!=
0x0000ff
)
goto
update_format
;
break
;
}
}
else
goto
update_format
;
if
(
!
bits
)
return
ret
;
/* just querying the format */
wine_tsx11_lock
();
wine_tsx11_lock
();
image
=
XCreateImage
(
gdi_display
,
visual
,
depth
,
ZPixmap
,
0
,
NULL
,
image
=
XCreateImage
(
gdi_display
,
visual
,
depth
,
ZPixmap
,
0
,
NULL
,
...
...
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