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
3460665c
Commit
3460665c
authored
Jul 28, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Jul 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add an inline helper to return the number of colour entries in a dib.
parent
fccd4e29
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
20 deletions
+12
-20
dib.c
dlls/gdi32/dib.c
+4
-12
dc.c
dlls/gdi32/dibdrv/dc.c
+2
-8
gdi_private.h
dlls/gdi32/gdi_private.h
+6
-0
No files found.
dlls/gdi32/dib.c
View file @
3460665c
...
...
@@ -91,10 +91,7 @@ int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
}
else
/* assume BITMAPINFOHEADER */
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
colors
>
256
)
colors
=
256
;
if
(
!
colors
&&
(
info
->
bmiHeader
.
biBitCount
<=
8
))
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
colors
=
get_dib_num_of_colors
(
info
);
if
(
info
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
masks
=
3
;
size
=
max
(
info
->
bmiHeader
.
biSize
,
sizeof
(
BITMAPINFOHEADER
)
+
masks
*
sizeof
(
DWORD
)
);
return
size
+
colors
*
((
coloruse
==
DIB_RGB_COLORS
)
?
sizeof
(
RGBQUAD
)
:
sizeof
(
WORD
));
...
...
@@ -212,9 +209,7 @@ static BOOL bitmapinfo_from_user_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *
static
int
fill_color_table_from_palette
(
BITMAPINFO
*
info
,
DC
*
dc
)
{
PALETTEENTRY
palEntry
[
256
];
int
i
,
colors
=
(
info
->
bmiHeader
.
biBitCount
>
8
)
?
0
:
1
<<
info
->
bmiHeader
.
biBitCount
;
if
(
info
->
bmiHeader
.
biClrUsed
)
colors
=
info
->
bmiHeader
.
biClrUsed
;
int
i
,
colors
=
get_dib_num_of_colors
(
info
);
if
(
!
colors
)
return
0
;
...
...
@@ -809,13 +804,11 @@ static int fill_query_info( BITMAPINFO *info, BITMAPOBJ *bmp )
*/
static
void
copy_color_info
(
BITMAPINFO
*
dst
,
const
BITMAPINFO
*
src
,
UINT
coloruse
)
{
unsigned
int
colors
=
src
->
bmiHeader
.
biBitCount
>
8
?
0
:
1
<<
src
->
bmiHeader
.
biBitCount
;
unsigned
int
colors
=
get_dib_num_of_colors
(
src
)
;
RGBQUAD
*
src_colors
=
(
RGBQUAD
*
)((
char
*
)
src
+
src
->
bmiHeader
.
biSize
);
assert
(
src
->
bmiHeader
.
biSize
>=
sizeof
(
BITMAPINFOHEADER
)
);
if
(
src
->
bmiHeader
.
biClrUsed
)
colors
=
src
->
bmiHeader
.
biClrUsed
;
if
(
dst
->
bmiHeader
.
biSize
==
sizeof
(
BITMAPCOREHEADER
))
{
BITMAPCOREINFO
*
core
=
(
BITMAPCOREINFO
*
)
dst
;
...
...
@@ -1219,8 +1212,7 @@ static void DIB_CopyColorTable( DC *dc, BITMAPOBJ *bmp, WORD coloruse, const BIT
}
else
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
!
colors
)
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
colors
=
get_dib_num_of_colors
(
info
);
}
if
(
colors
>
256
)
{
...
...
dlls/gdi32/dibdrv/dc.c
View file @
3460665c
...
...
@@ -163,7 +163,7 @@ BOOL init_dib_info_from_packed(dib_info *dib, const BITMAPINFOHEADER *bi, WORD u
DWORD
*
masks
=
NULL
;
RGBQUAD
*
color_table
=
NULL
,
pal_table
[
256
];
BYTE
*
ptr
=
(
BYTE
*
)
bi
+
bi
->
biSize
;
int
num_colors
=
bi
->
biClrUsed
;
int
num_colors
=
get_dib_num_of_colors
(
(
const
BITMAPINFO
*
)
bi
)
;
if
(
bi
->
biCompression
==
BI_BITFIELDS
)
{
...
...
@@ -171,7 +171,6 @@ BOOL init_dib_info_from_packed(dib_info *dib, const BITMAPINFOHEADER *bi, WORD u
ptr
+=
3
*
sizeof
(
DWORD
);
}
if
(
!
num_colors
&&
bi
->
biBitCount
<=
8
)
num_colors
=
1
<<
bi
->
biBitCount
;
if
(
num_colors
)
{
if
(
usage
==
DIB_PAL_COLORS
)
...
...
@@ -202,15 +201,10 @@ BOOL init_dib_info_from_packed(dib_info *dib, const BITMAPINFOHEADER *bi, WORD u
BOOL
init_dib_info_from_bitmapinfo
(
dib_info
*
dib
,
const
BITMAPINFO
*
info
,
void
*
bits
,
enum
dib_info_flags
flags
)
{
unsigned
int
colors
=
0
;
unsigned
int
colors
=
get_dib_num_of_colors
(
info
)
;
void
*
colorptr
=
(
char
*
)
&
info
->
bmiHeader
+
info
->
bmiHeader
.
biSize
;
const
DWORD
*
bitfields
=
(
info
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
?
(
DWORD
*
)
colorptr
:
NULL
;
if
(
info
->
bmiHeader
.
biBitCount
<=
8
)
{
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
if
(
info
->
bmiHeader
.
biClrUsed
)
colors
=
info
->
bmiHeader
.
biClrUsed
;
}
return
init_dib_info
(
dib
,
&
info
->
bmiHeader
,
bitfields
,
colors
?
colorptr
:
NULL
,
colors
,
bits
,
flags
);
}
...
...
dlls/gdi32/gdi_private.h
View file @
3460665c
...
...
@@ -564,6 +564,12 @@ static inline int get_dib_image_size( const BITMAPINFO *info )
*
abs
(
info
->
bmiHeader
.
biHeight
);
}
static
inline
int
get_dib_num_of_colors
(
const
BITMAPINFO
*
info
)
{
if
(
info
->
bmiHeader
.
biClrUsed
)
return
min
(
info
->
bmiHeader
.
biClrUsed
,
256
);
return
info
->
bmiHeader
.
biBitCount
>
8
?
0
:
1
<<
info
->
bmiHeader
.
biBitCount
;
}
extern
void
free_heap_bits
(
struct
gdi_image_bits
*
bits
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_GDI_PRIVATE_H */
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