Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François Revol
firmware
Commits
c13ee1f8
Commit
c13ee1f8
authored
5 years ago
by
Mateusz Zalega
Browse files
Options
Downloads
Patches
Plain Diff
gfx: textbuffer: redraw only if the buffer has changed
Signed-off-by:
Mateusz Zalega
<
mateusz@appliedsourcery.com
>
parent
497a0946
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/gfx/textbuffer.c
+11
-0
11 additions, 0 deletions
lib/gfx/textbuffer.c
lib/gfx/textbuffer.h
+1
-0
1 addition, 0 deletions
lib/gfx/textbuffer.h
with
12 additions
and
0 deletions
lib/gfx/textbuffer.c
+
11
−
0
View file @
c13ee1f8
...
...
@@ -12,6 +12,7 @@ void txt_init(struct txt_buffer *txtb, struct gfx_region *reg, sFONT *f)
txtb
->
bg_color
=
gfx_color_rgb_f
(
reg
,
.
0
f
,
.
0
f
,
.
0
f
);
txtb
->
draw_cursor
=
1
;
txtb
->
auto_update
=
1
;
txtb
->
needs_redraw
=
0
;
txt_clear
(
txtb
);
}
...
...
@@ -49,6 +50,8 @@ static void scrollup(struct txt_buffer *tm)
g
->
fg_color
=
tm
->
fg_color
;
g
->
bg_color
=
tm
->
bg_color
;
}
tm
->
needs_redraw
=
1
;
}
static
void
newline
(
struct
txt_buffer
*
tm
)
...
...
@@ -71,6 +74,8 @@ static inline void advance_cursor(struct txt_buffer *tm)
if
(
tm
->
cursor_row
>
last_row
)
newline
(
tm
);
}
tm
->
needs_redraw
=
1
;
}
static
void
tab
(
struct
txt_buffer
*
tm
)
...
...
@@ -107,6 +112,7 @@ void txt_clear(struct txt_buffer *tm)
tm
->
cursor_column
=
0
;
tm
->
cursor_row
=
0
;
tm
->
needs_redraw
=
1
;
if
(
tm
->
auto_update
)
txt_update
(
tm
);
}
...
...
@@ -131,6 +137,7 @@ void txt_putchar(struct txt_buffer *tm, char ch)
advance_cursor
(
tm
);
}
tm
->
needs_redraw
=
1
;
if
(
tm
->
auto_update
)
txt_update
(
tm
);
}
...
...
@@ -193,6 +200,8 @@ void txt_draw(struct txt_buffer *tm)
if
(
tm
->
draw_cursor
)
draw_cursor_
(
tm
);
tm
->
needs_redraw
=
0
;
}
void
txt_set_color_f
(
...
...
@@ -247,5 +256,7 @@ void txt_set_transparent(struct txt_buffer *tm)
void
txt_update
(
struct
txt_buffer
*
tm
)
{
if
(
tm
->
needs_redraw
)
txt_draw
(
tm
);
gfx_update
(
tm
->
reg
);
}
This diff is collapsed.
Click to expand it.
lib/gfx/textbuffer.h
+
1
−
0
View file @
c13ee1f8
...
...
@@ -22,6 +22,7 @@ struct txt_buffer {
Color
bg_color
;
int
draw_cursor
;
int
auto_update
;
int
needs_redraw
;
struct
txt_glyph
text
[
TEXTBUFFER_MAX_HEIGHT
][
TEXTBUFFER_MAX_WIDTH
];
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment