Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
dbbcf3da
Commit
dbbcf3da
authored
17 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Implement clreol() and clrscr() to avoid extra allocations in ciolib.
parent
1a4c6c79
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/conio/bitmap_con.c
+28
-1
28 additions, 1 deletion
src/conio/bitmap_con.c
src/conio/bitmap_con.h
+2
-0
2 additions, 0 deletions
src/conio/bitmap_con.h
src/conio/ciolib.c
+4
-0
4 additions, 0 deletions
src/conio/ciolib.c
with
34 additions
and
1 deletion
src/conio/bitmap_con.c
+
28
−
1
View file @
dbbcf3da
...
@@ -243,7 +243,7 @@ int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy)
...
@@ -243,7 +243,7 @@ int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy)
pthread_mutex_lock
(
&
vstatlock
);
pthread_mutex_lock
(
&
vstatlock
);
for
(
cy
=
(
direction
==-
1
?
(
height
-
1
)
:
0
);
cy
<
height
&&
cy
>=
0
;
cy
+=
direction
)
{
for
(
cy
=
(
direction
==-
1
?
(
height
-
1
)
:
0
);
cy
<
height
&&
cy
>=
0
;
cy
+=
direction
)
{
damaged
[
toy
+
cy
]
=
1
;
damaged
[
toy
+
cy
-
1
]
=
1
;
sourcepos
=
((
y
-
1
)
+
cy
)
*
cio_textinfo
.
screenwidth
+
(
x
-
1
);
sourcepos
=
((
y
-
1
)
+
cy
)
*
cio_textinfo
.
screenwidth
+
(
x
-
1
);
memmove
(
&
(
vstat
.
vmem
[
sourcepos
+
destoffset
]),
&
(
vstat
.
vmem
[
sourcepos
]),
sizeof
(
vstat
.
vmem
[
0
])
*
width
);
memmove
(
&
(
vstat
.
vmem
[
sourcepos
+
destoffset
]),
&
(
vstat
.
vmem
[
sourcepos
]),
sizeof
(
vstat
.
vmem
[
0
])
*
width
);
}
}
...
@@ -251,6 +251,33 @@ int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy)
...
@@ -251,6 +251,33 @@ int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy)
return
(
1
);
return
(
1
);
}
}
void
bitmap_clreol
(
void
)
{
int
pos
,
x
;
WORD
fill
=
(
cio_textinfo
.
attribute
<<
8
)
|
' '
;
pos
=
(
cio_textinfo
.
cury
+
cio_textinfo
.
wintop
-
2
)
*
cio_textinfo
.
screenwidth
;
pthread_mutex_lock
(
&
vstatlock
);
damaged
[
cio_textinfo
.
cury
-
1
]
=
1
;
for
(
x
=
cio_textinfo
.
curx
+
cio_textinfo
.
winleft
-
2
;
x
<
cio_textinfo
.
winright
;
x
++
)
vstat
.
vmem
[
pos
+
x
]
=
fill
;
pthread_mutex_unlock
(
&
vstatlock
);
}
void
bitmap_clrscr
(
void
)
{
int
x
,
y
;
WORD
fill
=
(
cio_textinfo
.
attribute
<<
8
)
|
' '
;
pthread_mutex_lock
(
&
vstatlock
);
for
(
y
=
cio_textinfo
.
wintop
-
1
;
y
<
cio_textinfo
.
winbottom
;
y
++
)
{
damaged
[
y
]
=
1
;
for
(
x
=
cio_textinfo
.
winleft
-
1
;
x
<
cio_textinfo
.
winright
;
x
++
)
vstat
.
vmem
[
y
*
cio_textinfo
.
screenwidth
+
x
]
=
fill
;
}
pthread_mutex_unlock
(
&
vstatlock
);
}
int
bitmap_puttext
(
int
sx
,
int
sy
,
int
ex
,
int
ey
,
void
*
fill
)
int
bitmap_puttext
(
int
sx
,
int
sy
,
int
ex
,
int
ey
,
void
*
fill
)
{
{
int
x
,
y
;
int
x
,
y
;
...
...
This diff is collapsed.
Click to expand it.
src/conio/bitmap_con.h
+
2
−
0
View file @
dbbcf3da
...
@@ -22,5 +22,7 @@ int bitmap_init_mode(int mode, int *width, int *height);
...
@@ -22,5 +22,7 @@ int bitmap_init_mode(int mode, int *width, int *height);
int
bitmap_init
(
void
(
*
drawrect_cb
)
(
int
xpos
,
int
ypos
,
int
width
,
int
height
,
unsigned
char
*
data
)
int
bitmap_init
(
void
(
*
drawrect_cb
)
(
int
xpos
,
int
ypos
,
int
width
,
int
height
,
unsigned
char
*
data
)
,
void
(
*
flush
)
(
void
));
,
void
(
*
flush
)
(
void
));
int
bitmap_movetext
(
int
x
,
int
y
,
int
ex
,
int
ey
,
int
tox
,
int
toy
);
int
bitmap_movetext
(
int
x
,
int
y
,
int
ex
,
int
ey
,
int
tox
,
int
toy
);
void
bitmap_clreol
(
void
);
void
bitmap_clrscr
(
void
);
#endif
#endif
This diff is collapsed.
Click to expand it.
src/conio/ciolib.c
+
4
−
0
View file @
dbbcf3da
...
@@ -129,6 +129,8 @@ int try_sdl_init(int mode)
...
@@ -129,6 +129,8 @@ int try_sdl_init(int mode)
cio_api
.
getfont
=
bitmap_getfont
;
cio_api
.
getfont
=
bitmap_getfont
;
cio_api
.
loadfont
=
bitmap_loadfont
;
cio_api
.
loadfont
=
bitmap_loadfont
;
cio_api
.
movetext
=
bitmap_movetext
;
cio_api
.
movetext
=
bitmap_movetext
;
cio_api
.
clreol
=
bitmap_clreol
;
cio_api
.
clrscr
=
bitmap_clrscr
;
cio_api
.
kbhit
=
sdl_kbhit
;
cio_api
.
kbhit
=
sdl_kbhit
;
cio_api
.
getch
=
sdl_getch
;
cio_api
.
getch
=
sdl_getch
;
...
@@ -168,6 +170,8 @@ int try_x_init(int mode)
...
@@ -168,6 +170,8 @@ int try_x_init(int mode)
cio_api
.
loadfont
=
bitmap_loadfont
;
cio_api
.
loadfont
=
bitmap_loadfont
;
cio_api
.
beep
=
x_beep
;
cio_api
.
beep
=
x_beep
;
cio_api
.
movetext
=
bitmap_movetext
;
cio_api
.
movetext
=
bitmap_movetext
;
cio_api
.
clreol
=
bitmap_clreol
;
cio_api
.
clrscr
=
bitmap_clrscr
;
cio_api
.
kbhit
=
x_kbhit
;
cio_api
.
kbhit
=
x_kbhit
;
cio_api
.
getch
=
x_getch
;
cio_api
.
getch
=
x_getch
;
...
...
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