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
0d24ebfc
Commit
0d24ebfc
authored
Oct 18, 2007
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 19, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Remove the coloruse == -1 special case. Add…
winex11.drv: Remove the coloruse == -1 special case. Add X11DRV_DIB_GetColorCount() for computing a bitmap's number of colors.
parent
7475ecac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
43 deletions
+59
-43
dib.c
dlls/winex11.drv/dib.c
+59
-43
No files found.
dlls/winex11.drv/dib.c
View file @
0d24ebfc
...
@@ -257,6 +257,34 @@ static int DIB_GetBitmapInfoEx( const BITMAPINFOHEADER *header, LONG *width,
...
@@ -257,6 +257,34 @@ static int DIB_GetBitmapInfoEx( const BITMAPINFOHEADER *header, LONG *width,
/***********************************************************************
/***********************************************************************
* X11DRV_DIB_GetColorCount
*
* Computes the number of colors for the bitmap palette.
* Should not be called for a >8-bit deep bitmap.
*/
static
unsigned
int
X11DRV_DIB_GetColorCount
(
const
BITMAPINFO
*
info
)
{
unsigned
int
colors
;
BOOL
core_info
=
info
->
bmiHeader
.
biSize
==
sizeof
(
BITMAPCOREHEADER
);
if
(
core_info
)
{
colors
=
1
<<
((
const
BITMAPCOREINFO
*
)
info
)
->
bmciHeader
.
bcBitCount
;
}
else
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
!
colors
)
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
}
if
(
colors
>
256
)
{
ERR
(
"called with >256 colors!
\n
"
);
colors
=
0
;
}
return
colors
;
}
/***********************************************************************
* DIB_GetBitmapInfo
* DIB_GetBitmapInfo
*
*
* Get the info from a bitmap header.
* Get the info from a bitmap header.
...
@@ -343,15 +371,10 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
...
@@ -343,15 +371,10 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
}
}
else
/* DIB_PAL_COLORS */
else
/* DIB_PAL_COLORS */
{
{
if
(
colorPtr
)
{
const
WORD
*
index
=
(
const
WORD
*
)
colorPtr
;
const
WORD
*
index
=
(
const
WORD
*
)
colorPtr
;
for
(
i
=
start
;
i
<
end
;
i
++
,
index
++
)
for
(
i
=
start
;
i
<
end
;
i
++
,
index
++
)
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
physDev
,
PALETTEINDEX
(
*
index
)
);
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
physDev
,
PALETTEINDEX
(
*
index
)
);
}
else
{
for
(
i
=
start
;
i
<
end
;
i
++
)
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
physDev
,
PALETTEINDEX
(
i
)
);
}
}
}
return
colorMapping
;
return
colorMapping
;
...
@@ -366,40 +389,21 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
...
@@ -366,40 +389,21 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
static
int
*
X11DRV_DIB_BuildColorMap
(
X11DRV_PDEVICE
*
physDev
,
WORD
coloruse
,
WORD
depth
,
static
int
*
X11DRV_DIB_BuildColorMap
(
X11DRV_PDEVICE
*
physDev
,
WORD
coloruse
,
WORD
depth
,
const
BITMAPINFO
*
info
,
int
*
nColors
)
const
BITMAPINFO
*
info
,
int
*
nColors
)
{
{
unsigned
int
colors
;
BOOL
isInfo
;
BOOL
isInfo
;
const
void
*
colorPtr
;
const
void
*
colorPtr
;
int
*
colorMapping
;
int
*
colorMapping
;
isInfo
=
info
->
bmiHeader
.
biSize
!=
sizeof
(
BITMAPCOREHEADER
);
if
(
isInfo
)
*
nColors
=
X11DRV_DIB_GetColorCount
(
info
);
{
if
(
!*
nColors
)
return
NULL
;
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
!
colors
)
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
}
else
{
colors
=
1
<<
((
const
BITMAPCOREHEADER
*
)
info
)
->
bcBitCount
;
}
colorPtr
=
(
const
BYTE
*
)
info
+
(
WORD
)
info
->
bmiHeader
.
biSize
;
isInfo
=
info
->
bmiHeader
.
biSize
!=
sizeof
(
BITMAPCOREHEADER
);
colorPtr
=
(
const
BYTE
*
)
info
+
(
WORD
)
info
->
bmiHeader
.
biSize
;
if
(
colors
>
256
)
if
(
!
(
colorMapping
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
nColors
*
sizeof
(
int
)
)))
{
ERR
(
"called with >256 colors!
\n
"
);
return
NULL
;
}
/* just so CopyDIBSection doesn't have to create an identity palette */
if
(
coloruse
==
(
WORD
)
-
1
)
colorPtr
=
NULL
;
if
(
!
(
colorMapping
=
HeapAlloc
(
GetProcessHeap
(),
0
,
colors
*
sizeof
(
int
)
)))
return
NULL
;
return
NULL
;
*
nColors
=
colors
;
return
X11DRV_DIB_GenColorMap
(
physDev
,
colorMapping
,
coloruse
,
depth
,
return
X11DRV_DIB_GenColorMap
(
physDev
,
colorMapping
,
coloruse
,
depth
,
isInfo
,
colorPtr
,
0
,
c
olors
);
isInfo
,
colorPtr
,
0
,
*
nC
olors
);
}
}
/***********************************************************************
/***********************************************************************
...
@@ -4199,7 +4203,9 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
...
@@ -4199,7 +4203,9 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
{
{
DIBSECTION
dib
;
DIBSECTION
dib
;
X_PHYSBITMAP
*
physBitmap
;
X_PHYSBITMAP
*
physBitmap
;
int
nColorMap
=
0
,
*
colorMap
=
NULL
,
aColorMap
=
FALSE
;
unsigned
int
nColorMap
;
int
*
x11ColorMap
;
int
freeColorMap
;
TRACE
(
"(%p,%p,%d,%d,%d,%d,%d,%d)
\n
"
,
physDevSrc
->
hdc
,
physDevDst
->
hdc
,
TRACE
(
"(%p,%p,%d,%d,%d,%d,%d,%d)
\n
"
,
physDevSrc
->
hdc
,
physDevDst
->
hdc
,
xSrc
,
ySrc
,
xDest
,
yDest
,
width
,
height
);
xSrc
,
ySrc
,
xDest
,
yDest
,
width
,
height
);
...
@@ -4228,24 +4234,34 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
...
@@ -4228,24 +4234,34 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
* use the DIB colormap instead - this is necessary in some
* use the DIB colormap instead - this is necessary in some
* cases since we need to do depth conversion in some places
* cases since we need to do depth conversion in some places
* where real Windows can just copy data straight over */
* where real Windows can just copy data straight over */
c
olorMap
=
physBitmap
->
colorMap
;
x11C
olorMap
=
physBitmap
->
colorMap
;
nColorMap
=
physBitmap
->
nColorMap
;
nColorMap
=
physBitmap
->
nColorMap
;
freeColorMap
=
FALSE
;
}
else
{
}
else
{
colorMap
=
X11DRV_DIB_BuildColorMap
(
physDevSrc
,
(
WORD
)
-
1
,
const
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
&
dib
.
dsBmih
;
dib
.
dsBm
.
bmBitsPixel
,
int
i
;
(
BITMAPINFO
*
)
&
dib
.
dsBmih
,
&
nColorMap
);
nColorMap
=
X11DRV_DIB_GetColorCount
(
info
);
if
(
colorMap
)
aColorMap
=
TRUE
;
x11ColorMap
=
HeapAlloc
(
GetProcessHeap
(),
0
,
nColorMap
*
sizeof
(
int
));
for
(
i
=
0
;
i
<
nColorMap
;
i
++
)
x11ColorMap
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
physDevSrc
,
PALETTEINDEX
(
i
));
freeColorMap
=
TRUE
;
}
}
}
}
else
{
nColorMap
=
0
;
x11ColorMap
=
NULL
;
freeColorMap
=
FALSE
;
}
/* perform the copy */
/* perform the copy */
X11DRV_DIB_DoCopyDIBSection
(
physBitmap
,
FALSE
,
c
olorMap
,
nColorMap
,
X11DRV_DIB_DoCopyDIBSection
(
physBitmap
,
FALSE
,
x11C
olorMap
,
nColorMap
,
physDevDst
->
drawable
,
physDevDst
->
gc
,
xSrc
,
ySrc
,
physDevDst
->
drawable
,
physDevDst
->
gc
,
xSrc
,
ySrc
,
physDevDst
->
dc_rect
.
left
+
xDest
,
physDevDst
->
dc_rect
.
top
+
yDest
,
physDevDst
->
dc_rect
.
left
+
xDest
,
physDevDst
->
dc_rect
.
top
+
yDest
,
width
,
height
);
width
,
height
);
/* free color mapping */
/* free color mapping */
if
(
a
ColorMap
)
if
(
free
ColorMap
)
HeapFree
(
GetProcessHeap
(),
0
,
c
olorMap
);
HeapFree
(
GetProcessHeap
(),
0
,
x11C
olorMap
);
}
}
}
}
...
...
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