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
0967de74
Commit
0967de74
authored
Oct 19, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Oct 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Introduce a unified function to perform COLORREF to pixel color mapping.
parent
67196377
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
dc.c
dlls/gdi32/dibdrv/dc.c
+4
-4
dibdrv.h
dlls/gdi32/dibdrv/dibdrv.h
+1
-1
objects.c
dlls/gdi32/dibdrv/objects.c
+11
-11
No files found.
dlls/gdi32/dibdrv/dc.c
View file @
0967de74
...
@@ -323,8 +323,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
...
@@ -323,8 +323,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
static
void
update_fg_colors
(
dibdrv_physdev
*
pdev
)
static
void
update_fg_colors
(
dibdrv_physdev
*
pdev
)
{
{
pdev
->
pen_color
=
get_
fg_color
(
pdev
,
pdev
->
pen_colorref
);
pdev
->
pen_color
=
get_
pixel_color
(
pdev
,
pdev
->
pen_colorref
,
TRUE
);
pdev
->
brush_color
=
get_
fg_color
(
pdev
,
pdev
->
brush_colorref
);
pdev
->
brush_color
=
get_
pixel_color
(
pdev
,
pdev
->
brush_colorref
,
TRUE
);
}
}
static
void
update_masks
(
dibdrv_physdev
*
pdev
,
INT
rop
)
static
void
update_masks
(
dibdrv_physdev
*
pdev
,
INT
rop
)
...
@@ -427,7 +427,7 @@ static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color )
...
@@ -427,7 +427,7 @@ static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color )
PHYSDEV
next
=
GET_NEXT_PHYSDEV
(
dev
,
pSetBkColor
);
PHYSDEV
next
=
GET_NEXT_PHYSDEV
(
dev
,
pSetBkColor
);
dibdrv_physdev
*
pdev
=
get_dibdrv_pdev
(
dev
);
dibdrv_physdev
*
pdev
=
get_dibdrv_pdev
(
dev
);
pdev
->
bkgnd_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
color
);
pdev
->
bkgnd_color
=
get_pixel_color
(
pdev
,
color
,
FALSE
);
if
(
GetBkMode
(
dev
->
hdc
)
==
OPAQUE
)
if
(
GetBkMode
(
dev
->
hdc
)
==
OPAQUE
)
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
bkgnd_color
,
&
pdev
->
bkgnd_and
,
&
pdev
->
bkgnd_xor
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
bkgnd_color
,
&
pdev
->
bkgnd_and
,
&
pdev
->
bkgnd_xor
);
...
@@ -488,7 +488,7 @@ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RG
...
@@ -488,7 +488,7 @@ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RG
if
(
pos
+
count
>
pdev
->
dib
.
color_table_size
)
count
=
pdev
->
dib
.
color_table_size
-
pos
;
if
(
pos
+
count
>
pdev
->
dib
.
color_table_size
)
count
=
pdev
->
dib
.
color_table_size
-
pos
;
memcpy
(
pdev
->
dib
.
color_table
+
pos
,
colors
,
count
*
sizeof
(
RGBQUAD
)
);
memcpy
(
pdev
->
dib
.
color_table
+
pos
,
colors
,
count
*
sizeof
(
RGBQUAD
)
);
pdev
->
bkgnd_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
GetBkColor
(
dev
->
hdc
)
);
pdev
->
bkgnd_color
=
get_pixel_color
(
pdev
,
GetBkColor
(
dev
->
hdc
),
FALSE
);
update_fg_colors
(
pdev
);
update_fg_colors
(
pdev
);
update_masks
(
pdev
,
GetROP2
(
dev
->
hdc
)
);
update_masks
(
pdev
,
GetROP2
(
dev
->
hdc
)
);
...
...
dlls/gdi32/dibdrv/dibdrv.h
View file @
0967de74
...
@@ -198,7 +198,7 @@ extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
...
@@ -198,7 +198,7 @@ extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
extern
void
free_pattern_brush
(
dibdrv_physdev
*
pdev
)
DECLSPEC_HIDDEN
;
extern
void
free_pattern_brush
(
dibdrv_physdev
*
pdev
)
DECLSPEC_HIDDEN
;
extern
void
copy_dib_color_info
(
dib_info
*
dst
,
const
dib_info
*
src
)
DECLSPEC_HIDDEN
;
extern
void
copy_dib_color_info
(
dib_info
*
dst
,
const
dib_info
*
src
)
DECLSPEC_HIDDEN
;
extern
BOOL
convert_dib
(
dib_info
*
dst
,
const
dib_info
*
src
)
DECLSPEC_HIDDEN
;
extern
BOOL
convert_dib
(
dib_info
*
dst
,
const
dib_info
*
src
)
DECLSPEC_HIDDEN
;
extern
DWORD
get_
fg_color
(
dibdrv_physdev
*
pdev
,
COLORREF
color
)
DECLSPEC_HIDDEN
;
extern
DWORD
get_
pixel_color
(
dibdrv_physdev
*
pdev
,
COLORREF
color
,
BOOL
mono_fixup
)
DECLSPEC_HIDDEN
;
extern
BOOL
brush_rects
(
dibdrv_physdev
*
pdev
,
int
num
,
const
RECT
*
rects
)
DECLSPEC_HIDDEN
;
extern
BOOL
brush_rects
(
dibdrv_physdev
*
pdev
,
int
num
,
const
RECT
*
rects
)
DECLSPEC_HIDDEN
;
extern
HRGN
add_extra_clipping_region
(
dibdrv_physdev
*
pdev
,
HRGN
rgn
)
DECLSPEC_HIDDEN
;
extern
HRGN
add_extra_clipping_region
(
dibdrv_physdev
*
pdev
,
HRGN
rgn
)
DECLSPEC_HIDDEN
;
extern
void
restore_clipping_region
(
dibdrv_physdev
*
pdev
,
HRGN
rgn
)
DECLSPEC_HIDDEN
;
extern
void
restore_clipping_region
(
dibdrv_physdev
*
pdev
,
HRGN
rgn
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdi32/dibdrv/objects.c
View file @
0967de74
...
@@ -124,7 +124,7 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b)
...
@@ -124,7 +124,7 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b)
}
}
/******************************************************************
/******************************************************************
* get_
fg
_color
* get_
pixel
_color
*
*
* 1 bit bitmaps map the fg/bg colors as follows:
* 1 bit bitmaps map the fg/bg colors as follows:
* If the fg colorref exactly matches one of the color table entries then
* If the fg colorref exactly matches one of the color table entries then
...
@@ -132,20 +132,20 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b)
...
@@ -132,20 +132,20 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b)
* Otherwise the bg color is mapped to the closest entry in the table and
* Otherwise the bg color is mapped to the closest entry in the table and
* the fg takes the other one.
* the fg takes the other one.
*/
*/
DWORD
get_
fg_color
(
dibdrv_physdev
*
pdev
,
COLORREF
fg
)
DWORD
get_
pixel_color
(
dibdrv_physdev
*
pdev
,
COLORREF
color
,
BOOL
mono_fixup
)
{
{
RGBQUAD
fg_quad
;
RGBQUAD
fg_quad
;
if
(
pdev
->
dib
.
bit_count
!=
1
)
if
(
pdev
->
dib
.
bit_count
!=
1
||
!
mono_fixup
)
return
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
fg
);
return
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
color
);
fg_quad
=
rgbquad_from_colorref
(
fg
);
fg_quad
=
rgbquad_from_colorref
(
color
);
if
(
rgbquad_equal
(
&
fg_quad
,
pdev
->
dib
.
color_table
))
if
(
rgbquad_equal
(
&
fg_quad
,
pdev
->
dib
.
color_table
))
return
0
;
return
0
;
if
(
rgbquad_equal
(
&
fg_quad
,
pdev
->
dib
.
color_table
+
1
))
if
(
rgbquad_equal
(
&
fg_quad
,
pdev
->
dib
.
color_table
+
1
))
return
1
;
return
1
;
if
(
fg
==
GetBkColor
(
pdev
->
dev
.
hdc
))
return
pdev
->
bkgnd_color
;
if
(
color
==
GetBkColor
(
pdev
->
dev
.
hdc
))
return
pdev
->
bkgnd_color
;
else
return
pdev
->
bkgnd_color
?
0
:
1
;
else
return
pdev
->
bkgnd_color
?
0
:
1
;
}
}
...
@@ -987,7 +987,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
...
@@ -987,7 +987,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
logpen
.
lopnColor
=
GetDCPenColor
(
dev
->
hdc
);
logpen
.
lopnColor
=
GetDCPenColor
(
dev
->
hdc
);
pdev
->
pen_colorref
=
logpen
.
lopnColor
;
pdev
->
pen_colorref
=
logpen
.
lopnColor
;
pdev
->
pen_color
=
get_
fg_color
(
pdev
,
pdev
->
pen_colorref
);
pdev
->
pen_color
=
get_
pixel_color
(
pdev
,
pdev
->
pen_colorref
,
TRUE
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
pdev
->
pen_pattern
=
dash_patterns
[
PS_SOLID
];
pdev
->
pen_pattern
=
dash_patterns
[
PS_SOLID
];
...
@@ -1039,7 +1039,7 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
...
@@ -1039,7 +1039,7 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
if
(
GetCurrentObject
(
dev
->
hdc
,
OBJ_PEN
)
==
GetStockObject
(
DC_PEN
))
if
(
GetCurrentObject
(
dev
->
hdc
,
OBJ_PEN
)
==
GetStockObject
(
DC_PEN
))
{
{
pdev
->
pen_colorref
=
color
;
pdev
->
pen_colorref
=
color
;
pdev
->
pen_color
=
get_
fg_color
(
pdev
,
pdev
->
pen_colorref
);
pdev
->
pen_color
=
get_
pixel_color
(
pdev
,
pdev
->
pen_colorref
,
TRUE
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
}
}
...
@@ -1311,7 +1311,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
...
@@ -1311,7 +1311,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
{
{
case
BS_SOLID
:
case
BS_SOLID
:
pdev
->
brush_colorref
=
logbrush
.
lbColor
;
pdev
->
brush_colorref
=
logbrush
.
lbColor
;
pdev
->
brush_color
=
get_
fg_color
(
pdev
,
pdev
->
brush_colorref
);
pdev
->
brush_color
=
get_
pixel_color
(
pdev
,
pdev
->
brush_colorref
,
TRUE
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
pdev
->
brush_rects
=
solid_brush
;
pdev
->
brush_rects
=
solid_brush
;
pdev
->
defer
&=
~
DEFER_BRUSH
;
pdev
->
defer
&=
~
DEFER_BRUSH
;
...
@@ -1363,7 +1363,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
...
@@ -1363,7 +1363,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
if
(
logbrush
.
lbHatch
>
HS_DIAGCROSS
)
return
0
;
if
(
logbrush
.
lbHatch
>
HS_DIAGCROSS
)
return
0
;
pdev
->
brush_hatch
=
logbrush
.
lbHatch
;
pdev
->
brush_hatch
=
logbrush
.
lbHatch
;
pdev
->
brush_colorref
=
logbrush
.
lbColor
;
pdev
->
brush_colorref
=
logbrush
.
lbColor
;
pdev
->
brush_color
=
get_
fg_color
(
pdev
,
pdev
->
brush_colorref
);
pdev
->
brush_color
=
get_
pixel_color
(
pdev
,
pdev
->
brush_colorref
,
TRUE
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
pdev
->
brush_rects
=
pattern_brush
;
pdev
->
brush_rects
=
pattern_brush
;
pdev
->
defer
&=
~
DEFER_BRUSH
;
pdev
->
defer
&=
~
DEFER_BRUSH
;
...
@@ -1388,7 +1388,7 @@ COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
...
@@ -1388,7 +1388,7 @@ COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
if
(
GetCurrentObject
(
dev
->
hdc
,
OBJ_BRUSH
)
==
GetStockObject
(
DC_BRUSH
))
if
(
GetCurrentObject
(
dev
->
hdc
,
OBJ_BRUSH
)
==
GetStockObject
(
DC_BRUSH
))
{
{
pdev
->
brush_colorref
=
color
;
pdev
->
brush_colorref
=
color
;
pdev
->
brush_color
=
get_
fg_color
(
pdev
,
pdev
->
brush_colorref
);
pdev
->
brush_color
=
get_
pixel_color
(
pdev
,
pdev
->
brush_colorref
,
TRUE
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
}
}
...
...
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