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
91d19b4b
Commit
91d19b4b
authored
Dec 08, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a helper to build a color table from the DIB_PAL_COLORS bitmap info.
parent
71199eab
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
31 deletions
+31
-31
dib.c
dlls/gdi32/dib.c
+26
-16
dc.c
dlls/gdi32/dibdrv/dc.c
+2
-12
dibdrv.h
dlls/gdi32/dibdrv/dibdrv.h
+1
-1
objects.c
dlls/gdi32/dibdrv/objects.c
+1
-2
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-0
No files found.
dlls/gdi32/dib.c
View file @
91d19b4b
...
...
@@ -233,6 +233,28 @@ static int fill_color_table_from_palette( BITMAPINFO *info, HDC hdc )
return
colors
;
}
int
fill_color_table_from_pal_colors
(
HDC
hdc
,
const
BITMAPINFO
*
info
,
RGBQUAD
*
color_table
)
{
PALETTEENTRY
entries
[
256
];
HPALETTE
palette
;
const
WORD
*
index
=
(
const
WORD
*
)
info
->
bmiColors
;
int
i
,
count
,
colors
=
get_dib_num_of_colors
(
info
);
if
(
!
colors
)
return
0
;
if
(
!
(
palette
=
GetCurrentObject
(
hdc
,
OBJ_PAL
)))
return
0
;
if
(
!
(
count
=
GetPaletteEntries
(
palette
,
0
,
colors
,
entries
)))
return
0
;
for
(
i
=
0
;
i
<
colors
;
i
++
,
index
++
)
{
PALETTEENTRY
*
entry
=
&
entries
[
*
index
%
count
];
color_table
[
i
].
rgbRed
=
entry
->
peRed
;
color_table
[
i
].
rgbGreen
=
entry
->
peGreen
;
color_table
[
i
].
rgbBlue
=
entry
->
peBlue
;
color_table
[
i
].
rgbReserved
=
0
;
}
return
colors
;
}
static
void
*
get_pixel_ptr
(
const
BITMAPINFO
*
info
,
void
*
bits
,
int
x
,
int
y
)
{
const
int
width
=
info
->
bmiHeader
.
biWidth
,
height
=
info
->
bmiHeader
.
biHeight
;
...
...
@@ -1383,11 +1405,10 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header,
}
/* Copy/synthesize RGB palette from BITMAPINFO */
static
void
DIB_CopyColorTable
(
DC
*
dc
,
BITMAPOBJ
*
bmp
,
WORD
coloruse
,
const
BITMAPINFO
*
info
)
static
void
DIB_CopyColorTable
(
HDC
h
dc
,
BITMAPOBJ
*
bmp
,
WORD
coloruse
,
const
BITMAPINFO
*
info
)
{
unsigned
int
colors
,
i
;
unsigned
int
colors
=
get_dib_num_of_colors
(
info
)
;
colors
=
get_dib_num_of_colors
(
info
);
if
(
!
(
bmp
->
color_table
=
HeapAlloc
(
GetProcessHeap
(),
0
,
colors
*
sizeof
(
RGBQUAD
)
)))
return
;
bmp
->
nb_colors
=
colors
;
...
...
@@ -1397,18 +1418,7 @@ static void DIB_CopyColorTable( DC *dc, BITMAPOBJ *bmp, WORD coloruse, const BIT
}
else
{
PALETTEENTRY
entries
[
256
];
const
WORD
*
index
=
(
const
WORD
*
)
info
->
bmiColors
;
UINT
count
=
GetPaletteEntries
(
dc
->
hPalette
,
0
,
colors
,
entries
);
for
(
i
=
0
;
i
<
colors
;
i
++
,
index
++
)
{
PALETTEENTRY
*
entry
=
&
entries
[
*
index
%
count
];
bmp
->
color_table
[
i
].
rgbRed
=
entry
->
peRed
;
bmp
->
color_table
[
i
].
rgbGreen
=
entry
->
peGreen
;
bmp
->
color_table
[
i
].
rgbBlue
=
entry
->
peBlue
;
bmp
->
color_table
[
i
].
rgbReserved
=
0
;
}
fill_color_table_from_pal_colors
(
hdc
,
info
,
bmp
->
color_table
);
}
}
...
...
@@ -1521,7 +1531,7 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
bmp
->
dib
=
dib
;
bmp
->
funcs
=
physdev
->
funcs
;
/* create local copy of DIB palette */
if
(
info
->
bmiHeader
.
biBitCount
<=
8
)
DIB_CopyColorTable
(
dc
,
bmp
,
usage
,
info
);
if
(
info
->
bmiHeader
.
biBitCount
<=
8
)
DIB_CopyColorTable
(
h
dc
,
bmp
,
usage
,
info
);
GDI_ReleaseObj
(
ret
);
if
(
!
physdev
->
funcs
->
pCreateDIBSection
(
physdev
,
ret
,
info
,
usage
))
...
...
dlls/gdi32/dibdrv/dc.c
View file @
91d19b4b
...
...
@@ -162,7 +162,7 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
return
TRUE
;
}
BOOL
init_dib_info_from_brush
(
dib_info
*
dib
,
const
BITMAPINFO
*
bi
,
void
*
bits
,
UINT
usage
,
H
PALETTE
palette
)
BOOL
init_dib_info_from_brush
(
dib_info
*
dib
,
const
BITMAPINFO
*
bi
,
void
*
bits
,
UINT
usage
,
H
DC
hdc
)
{
DWORD
*
masks
=
(
bi
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
?
(
DWORD
*
)
bi
->
bmiColors
:
NULL
;
RGBQUAD
*
color_table
=
NULL
,
pal_table
[
256
];
...
...
@@ -172,17 +172,7 @@ BOOL init_dib_info_from_brush(dib_info *dib, const BITMAPINFO *bi, void *bits, U
{
if
(
usage
==
DIB_PAL_COLORS
)
{
PALETTEENTRY
entries
[
256
];
const
WORD
*
index
=
(
const
WORD
*
)
bi
->
bmiColors
;
UINT
i
,
count
=
GetPaletteEntries
(
palette
,
0
,
num_colors
,
entries
);
for
(
i
=
0
;
i
<
num_colors
;
i
++
,
index
++
)
{
PALETTEENTRY
*
entry
=
&
entries
[
*
index
%
count
];
pal_table
[
i
].
rgbRed
=
entry
->
peRed
;
pal_table
[
i
].
rgbGreen
=
entry
->
peGreen
;
pal_table
[
i
].
rgbBlue
=
entry
->
peBlue
;
pal_table
[
i
].
rgbReserved
=
0
;
}
fill_color_table_from_pal_colors
(
hdc
,
bi
,
pal_table
);
color_table
=
pal_table
;
}
else
color_table
=
(
RGBQUAD
*
)
bi
->
bmiColors
;
...
...
dlls/gdi32/dibdrv/dibdrv.h
View file @
91d19b4b
...
...
@@ -224,7 +224,7 @@ extern void get_rop_codes(INT rop, struct rop_codes *codes) DECLSPEC_HIDDEN;
extern
void
calc_and_xor_masks
(
INT
rop
,
DWORD
color
,
DWORD
*
and
,
DWORD
*
xor
)
DECLSPEC_HIDDEN
;
extern
void
update_brush_rop
(
dibdrv_physdev
*
pdev
,
INT
rop
)
DECLSPEC_HIDDEN
;
extern
void
reset_dash_origin
(
dibdrv_physdev
*
pdev
)
DECLSPEC_HIDDEN
;
extern
BOOL
init_dib_info_from_brush
(
dib_info
*
dib
,
const
BITMAPINFO
*
bi
,
void
*
bits
,
UINT
usage
,
H
PALETTE
pal
)
DECLSPEC_HIDDEN
;
extern
BOOL
init_dib_info_from_brush
(
dib_info
*
dib
,
const
BITMAPINFO
*
bi
,
void
*
bits
,
UINT
usage
,
H
DC
hdc
)
DECLSPEC_HIDDEN
;
extern
BOOL
init_dib_info_from_bitmapinfo
(
dib_info
*
dib
,
const
BITMAPINFO
*
info
,
void
*
bits
,
enum
dib_info_flags
flags
)
DECLSPEC_HIDDEN
;
extern
BOOL
init_dib_info_from_bitmapobj
(
dib_info
*
dib
,
BITMAPOBJ
*
bmp
,
enum
dib_info_flags
flags
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdi32/dibdrv/objects.c
View file @
91d19b4b
...
...
@@ -1338,9 +1338,8 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RE
if
(
pdev
->
brush_pattern_usage
==
DIB_PAL_COLORS
)
{
dib_info
pattern
;
HPALETTE
pal
=
GetCurrentObject
(
pdev
->
dev
.
hdc
,
OBJ_PAL
);
if
(
!
init_dib_info_from_brush
(
&
pattern
,
pdev
->
brush_pattern_info
,
pdev
->
brush_pattern_bits
,
DIB_PAL_COLORS
,
p
al
))
pdev
->
brush_pattern_bits
,
DIB_PAL_COLORS
,
p
dev
->
dev
.
hdc
))
return
FALSE
;
select_pattern_brush
(
pdev
,
&
pattern
);
free_dib_info
(
&
pattern
);
...
...
dlls/gdi32/gdi_private.h
View file @
91d19b4b
...
...
@@ -235,6 +235,7 @@ extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
/* dib.c */
extern
int
bitmap_info_size
(
const
BITMAPINFO
*
info
,
WORD
coloruse
)
DECLSPEC_HIDDEN
;
extern
int
fill_color_table_from_pal_colors
(
HDC
hdc
,
const
BITMAPINFO
*
info
,
RGBQUAD
*
color_table
)
DECLSPEC_HIDDEN
;
extern
void
fill_default_color_table
(
BITMAPINFO
*
info
)
DECLSPEC_HIDDEN
;
extern
void
get_ddb_bitmapinfo
(
BITMAPOBJ
*
bmp
,
BITMAPINFO
*
info
)
DECLSPEC_HIDDEN
;
extern
BITMAPINFO
*
copy_packed_dib
(
const
BITMAPINFO
*
src_info
,
UINT
usage
)
DECLSPEC_HIDDEN
;
...
...
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