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
3582d3df
Commit
3582d3df
authored
Jun 15, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Jun 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add helpers to retrieve foreground and background colours.
parent
6b48a9e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
16 deletions
+51
-16
dc.c
dlls/gdi32/dibdrv/dc.c
+15
-10
dibdrv.h
dlls/gdi32/dibdrv/dibdrv.h
+1
-0
objects.c
dlls/gdi32/dibdrv/objects.c
+35
-6
No files found.
dlls/gdi32/dibdrv/dc.c
View file @
3582d3df
...
...
@@ -262,6 +262,20 @@ BOOL convert_dib(dib_info *dst, const dib_info *src)
return
ret
;
}
static
void
update_fg_colors
(
dibdrv_physdev
*
pdev
)
{
pdev
->
pen_color
=
get_fg_color
(
pdev
,
pdev
->
pen_colorref
);
pdev
->
brush_color
=
get_fg_color
(
pdev
,
pdev
->
brush_colorref
);
}
static
void
update_masks
(
dibdrv_physdev
*
pdev
,
INT
rop
)
{
calc_and_xor_masks
(
rop
,
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
update_brush_rop
(
pdev
,
rop
);
if
(
GetBkMode
(
pdev
->
dev
.
hdc
)
==
OPAQUE
)
calc_and_xor_masks
(
rop
,
pdev
->
bkgnd_color
,
&
pdev
->
bkgnd_and
,
&
pdev
->
bkgnd_xor
);
}
/***********************************************************************
* dibdrv_DeleteDC
*/
...
...
@@ -357,14 +371,6 @@ static void CDECL dibdrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip
return
next
->
funcs
->
pSetDeviceClipping
(
next
,
vis_rgn
,
clip_rgn
);
}
static
void
update_masks
(
dibdrv_physdev
*
pdev
,
INT
rop
)
{
calc_and_xor_masks
(
rop
,
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
update_brush_rop
(
pdev
,
rop
);
if
(
GetBkMode
(
pdev
->
dev
.
hdc
)
==
OPAQUE
)
calc_and_xor_masks
(
rop
,
pdev
->
bkgnd_color
,
&
pdev
->
bkgnd_and
,
&
pdev
->
bkgnd_xor
);
}
/***********************************************************************
* dibdrv_SetDIBColorTable
*/
...
...
@@ -379,9 +385,8 @@ static UINT CDECL dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, co
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
)
);
pdev
->
pen_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
pdev
->
pen_colorref
);
pdev
->
brush_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
pdev
->
brush_colorref
);
pdev
->
bkgnd_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
GetBkColor
(
dev
->
hdc
)
);
update_fg_colors
(
pdev
);
update_masks
(
pdev
,
GetROP2
(
dev
->
hdc
)
);
}
...
...
dlls/gdi32/dibdrv/dibdrv.h
View file @
3582d3df
...
...
@@ -62,6 +62,7 @@ extern void free_dib_info(dib_info *dib, BOOL free_bits) 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
BOOL
convert_dib
(
dib_info
*
dst
,
const
dib_info
*
src
)
DECLSPEC_HIDDEN
;
extern
DWORD
get_fg_color
(
dibdrv_physdev
*
pdev
,
COLORREF
color
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
defer_pen
(
dibdrv_physdev
*
pdev
)
{
...
...
dlls/gdi32/dibdrv/objects.c
View file @
3582d3df
...
...
@@ -92,6 +92,36 @@ void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor)
*
xor
=
(
color
&
rop2_xor_array
[
rop
-
1
][
0
])
|
((
~
color
)
&
rop2_xor_array
[
rop
-
1
][
1
]);
}
/******************************************************************
* get_fg_color
*/
DWORD
get_fg_color
(
dibdrv_physdev
*
pdev
,
COLORREF
fg
)
{
if
(
pdev
->
dib
.
bit_count
!=
1
)
return
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
fg
);
FIXME
(
"bit count == 1
\n
"
);
return
0
;
}
/***************************************************************************
* get_pen_bkgnd_masks
*/
static
inline
void
get_pen_bkgnd_masks
(
const
dibdrv_physdev
*
pdev
,
DWORD
*
and
,
DWORD
*
xor
)
{
if
(
pdev
->
dib
.
bit_count
!=
1
||
GetBkMode
(
pdev
->
dev
.
hdc
)
==
TRANSPARENT
)
{
*
and
=
pdev
->
bkgnd_and
;
*
xor
=
pdev
->
bkgnd_xor
;
}
else
{
FIXME
(
"bit count == 1
\n
"
);
*
and
=
~
0u
;
*
xor
=
0u
;
}
}
static
inline
void
order_end_points
(
int
*
s
,
int
*
e
)
{
if
(
*
s
>
*
e
)
...
...
@@ -579,8 +609,7 @@ static inline void get_dash_colors(const dibdrv_physdev *pdev, DWORD *and, DWORD
}
else
/* space */
{
*
and
=
pdev
->
bkgnd_and
;
*
xor
=
pdev
->
bkgnd_xor
;
get_pen_bkgnd_masks
(
pdev
,
and
,
xor
);
}
}
...
...
@@ -869,7 +898,7 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
logpen
.
lopnColor
=
GetDCPenColor
(
dev
->
hdc
);
pdev
->
pen_colorref
=
logpen
.
lopnColor
;
pdev
->
pen_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
logpen
.
lopnColor
);
pdev
->
pen_color
=
get_fg_color
(
pdev
,
pdev
->
pen_colorref
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
pdev
->
pen_pattern
=
dash_patterns
[
PS_SOLID
];
...
...
@@ -921,7 +950,7 @@ COLORREF CDECL dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
if
(
GetCurrentObject
(
dev
->
hdc
,
OBJ_PEN
)
==
GetStockObject
(
DC_PEN
))
{
pdev
->
pen_colorref
=
color
;
pdev
->
pen_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
color
);
pdev
->
pen_color
=
get_fg_color
(
pdev
,
pdev
->
pen_colorref
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
pen_color
,
&
pdev
->
pen_and
,
&
pdev
->
pen_xor
);
}
...
...
@@ -1105,7 +1134,7 @@ HBRUSH CDECL dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
{
case
BS_SOLID
:
pdev
->
brush_colorref
=
logbrush
.
lbColor
;
pdev
->
brush_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
logbrush
.
lbColor
);
pdev
->
brush_color
=
get_fg_color
(
pdev
,
pdev
->
brush_colorref
);
calc_and_xor_masks
(
GetROP2
(
dev
->
hdc
),
pdev
->
brush_color
,
&
pdev
->
brush_and
,
&
pdev
->
brush_xor
);
pdev
->
brush_rects
=
solid_brush
;
pdev
->
defer
&=
~
DEFER_BRUSH
;
...
...
@@ -1156,7 +1185,7 @@ COLORREF CDECL dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
if
(
GetCurrentObject
(
dev
->
hdc
,
OBJ_BRUSH
)
==
GetStockObject
(
DC_BRUSH
))
{
pdev
->
brush_colorref
=
color
;
pdev
->
brush_color
=
pdev
->
dib
.
funcs
->
colorref_to_pixel
(
&
pdev
->
dib
,
color
);
pdev
->
brush_color
=
get_fg_color
(
pdev
,
pdev
->
brush_colorref
);
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