Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
orbea
wayland
Commits
967bf72e
Commit
967bf72e
authored
Dec 25, 2010
by
Kristian Høgsberg
Browse files
Split background and foreground painting into separate loops
parent
0c574d9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
clients/terminal.c
View file @
967bf72e
...
...
@@ -661,6 +661,7 @@ terminal_draw_contents(struct terminal *terminal)
int
text_x
,
text_y
;
cairo_surface_t
*
surface
;
double
d
;
struct
terminal_color
color
;
window_get_child_rectangle
(
terminal
->
window
,
&
rectangle
);
...
...
@@ -686,6 +687,7 @@ terminal_draw_contents(struct terminal *terminal)
cairo_set_line_width
(
cr
,
1
.
0
);
cairo_set_antialias
(
cr
,
CAIRO_ANTIALIAS_SUBPIXEL
);
/* paint the background */
for
(
row
=
0
;
row
<
terminal
->
height
;
row
++
)
for
(
col
=
0
;
col
<
terminal
->
width
;
col
++
)
{
...
...
@@ -700,15 +702,9 @@ terminal_draw_contents(struct terminal *terminal)
foreground
=
background
|
(
foreground
&
ATTRMASK_INTENSITY
);
background
=
tmp
&
~
ATTRMASK_INTENSITY
;
}
bold
=
(
attr
&
ATTRMASK_INTENSITY
);
underline
=
(
attr
&
ATTRMASK_UNDERLINE
);
/* paint the background */
cairo_set_source_rgba
(
cr
,
terminal
->
color_scheme
->
palette
[
background
].
r
,
terminal
->
color_scheme
->
palette
[
background
].
g
,
terminal
->
color_scheme
->
palette
[
background
].
b
,
terminal
->
color_scheme
->
palette
[
background
].
a
);
color
=
terminal
->
color_scheme
->
palette
[
background
];
cairo_set_source_rgba
(
cr
,
color
.
r
,
color
.
g
,
color
.
b
,
color
.
a
);
cairo_move_to
(
cr
,
side_margin
+
(
col
*
extents
.
max_x_advance
),
top_margin
+
(
row
*
extents
.
height
));
cairo_rel_line_to
(
cr
,
extents
.
max_x_advance
,
0
);
...
...
@@ -716,17 +712,32 @@ terminal_draw_contents(struct terminal *terminal)
cairo_rel_line_to
(
cr
,
-
extents
.
max_x_advance
,
0
);
cairo_close_path
(
cr
);
cairo_fill
(
cr
);
}
/* paint the foreground */
for
(
row
=
0
;
row
<
terminal
->
height
;
row
++
)
for
(
col
=
0
;
col
<
terminal
->
width
;
col
++
)
{
attr
=
terminal_get_attr
(
terminal
,
row
,
col
);
foreground
=
(
attr
&
ATTRMASK_FOREGROUND
)
>>
ATTRSHIFT_FOREGROUND
;
background
=
(
attr
&
ATTRMASK_BACKGROUND
)
>>
ATTRSHIFT_BACKGROUND
;
bold
=
(
attr
&
ATTRMASK_INTENSITY
);
underline
=
(
attr
&
ATTRMASK_UNDERLINE
);
if
(
terminal
->
inverse_mode
||
(
terminal
->
show_cursor
&&
terminal
->
focused
&&
terminal
->
row
==
row
&&
terminal
->
column
==
col
))
{
tmp
=
foreground
;
foreground
=
background
|
(
foreground
&
ATTRMASK_INTENSITY
);
background
=
tmp
&
~
ATTRMASK_INTENSITY
;
}
/* paint the foreground */
if
(
bold
)
cairo_set_font_face
(
cr
,
terminal
->
font_bold
);
else
cairo_set_font_face
(
cr
,
terminal
->
font_normal
);
cairo_set_source_rgba
(
cr
,
terminal
->
color_scheme
->
palette
[
foreground
].
r
,
terminal
->
color_scheme
->
palette
[
foreground
].
g
,
terminal
->
color_scheme
->
palette
[
foreground
].
b
,
terminal
->
color_scheme
->
palette
[
foreground
].
a
);
color
=
terminal
->
color_scheme
->
palette
[
foreground
];
cairo_set_source_rgba
(
cr
,
color
.
r
,
color
.
g
,
color
.
b
,
color
.
a
);
text_x
=
side_margin
+
col
*
extents
.
max_x_advance
;
text_y
=
top_margin
+
extents
.
ascent
+
row
*
extents
.
height
;
...
...
Write
Preview
Supports
Markdown
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