Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
drivers
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MLA98
drivers
Commits
ce05b12a
Commit
ce05b12a
authored
Nov 20, 2017
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ransid for vesad
parent
bd102d7f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
118 deletions
+131
-118
Cargo.lock
Cargo.lock
+87
-86
vesad/Cargo.toml
vesad/Cargo.toml
+1
-1
vesad/src/display.rs
vesad/src/display.rs
+0
-15
vesad/src/screen/text.rs
vesad/src/screen/text.rs
+43
-16
No files found.
Cargo.lock
View file @
ce05b12a
This diff is collapsed.
Click to expand it.
vesad/Cargo.toml
View file @
ce05b12a
...
...
@@ -4,7 +4,7 @@ version = "0.1.0"
[dependencies]
orbclient
=
"0.3"
ransid
=
"0.
2
"
ransid
=
"0.
4
"
rusttype
=
{
version
=
"0.2"
,
optional
=
true
}
redox_syscall
=
"0.1"
...
...
vesad/src/display.rs
View file @
ce05b12a
...
...
@@ -245,21 +245,6 @@ impl Display {
}
}
/// Scroll display
pub
fn
scroll
(
&
mut
self
,
rows
:
usize
,
color
:
u32
)
{
let
width
=
self
.width
;
let
height
=
self
.height
;
if
rows
>
0
&&
rows
<
height
{
let
off1
=
rows
*
width
;
let
off2
=
height
*
width
-
off1
;
unsafe
{
let
data_ptr
=
self
.offscreen
.as_mut_ptr
()
as
*
mut
u32
;
fast_copy
(
data_ptr
as
*
mut
u8
,
data_ptr
.offset
(
off1
as
isize
)
as
*
const
u8
,
off2
as
usize
*
4
);
fast_set32
(
data_ptr
.offset
(
off2
as
isize
),
color
,
off1
as
usize
);
}
}
}
/// Copy from offscreen to onscreen
pub
fn
sync
(
&
mut
self
,
x
:
usize
,
y
:
usize
,
w
:
usize
,
h
:
usize
)
{
let
start_y
=
cmp
::
min
(
self
.height
,
y
);
...
...
vesad/src/screen/text.rs
View file @
ce05b12a
extern
crate
ransid
;
use
std
::
collections
::{
BTreeSet
,
VecDeque
};
use
std
::
ptr
;
use
orbclient
::{
Event
,
EventOption
};
use
syscall
::
error
::
*
;
...
...
@@ -32,17 +33,17 @@ impl TextScreen {
impl
Screen
for
TextScreen
{
fn
width
(
&
self
)
->
usize
{
self
.console.w
self
.console.
state.
w
}
fn
height
(
&
self
)
->
usize
{
self
.console.h
self
.console.
state.
h
}
fn
resize
(
&
mut
self
,
width
:
usize
,
height
:
usize
)
{
self
.display
.resize
(
width
,
height
);
self
.console.w
=
width
/
8
;
self
.console.h
=
height
/
16
;
self
.console.
state.
w
=
width
/
8
;
self
.console.
state.
h
=
height
/
16
;
}
fn
event
(
&
mut
self
,
flags
:
usize
)
->
Result
<
usize
>
{
...
...
@@ -138,9 +139,9 @@ impl Screen for TextScreen {
}
fn
write
(
&
mut
self
,
buf
:
&
[
u8
],
sync
:
bool
)
->
Result
<
usize
>
{
if
self
.console.
cursor
&&
self
.console.x
<
self
.console.w
&&
self
.console.y
<
self
.consol
e.h
{
let
x
=
self
.console.x
;
let
y
=
self
.console.y
;
if
self
.console.
state.cursor
&&
self
.console.state.x
<
self
.console.state.w
&&
self
.console.state.y
<
self
.console.stat
e.h
{
let
x
=
self
.console.
state.
x
;
let
y
=
self
.console.
state.
y
;
self
.display
.invert
(
x
*
8
,
y
*
16
,
8
,
16
);
self
.changed
.insert
(
y
);
}
...
...
@@ -152,33 +153,59 @@ impl Screen for TextScreen {
self
.console
.write
(
buf
,
|
event
|
{
match
event
{
ransid
::
Event
::
Char
{
x
,
y
,
c
,
color
,
bold
,
..
}
=>
{
display
.char
(
x
*
8
,
y
*
16
,
c
,
color
.
data
,
bold
,
false
);
display
.char
(
x
*
8
,
y
*
16
,
c
,
color
.
as_rgb
()
,
bold
,
false
);
changed
.insert
(
y
);
},
ransid
::
Event
::
Input
{
data
}
=>
{
input
.extend
(
data
);
},
ransid
::
Event
::
Rect
{
x
,
y
,
w
,
h
,
color
}
=>
{
display
.rect
(
x
*
8
,
y
*
16
,
w
*
8
,
h
*
16
,
color
.
data
);
display
.rect
(
x
*
8
,
y
*
16
,
w
*
8
,
h
*
16
,
color
.
as_rgb
()
);
for
y2
in
y
..
y
+
h
{
changed
.insert
(
y2
);
}
},
ransid
::
Event
::
ScreenBuffer
{
..
}
=>
(),
ransid
::
Event
::
Scroll
{
rows
,
color
}
=>
{
display
.scroll
(
rows
*
16
,
color
.data
);
for
y
in
0
..
display
.height
/
16
{
changed
.insert
(
y
);
ransid
::
Event
::
Move
{
from_x
,
from_y
,
to_x
,
to_y
,
w
,
h
}
=>
{
println!
(
"Move {}, {} to {}, {} size {}, {}"
,
from_x
,
from_y
,
to_x
,
to_y
,
w
,
h
);
let
width
=
display
.width
;
let
pixels
=
&
mut
display
.offscreen
;
for
raw_y
in
0
..
h
{
let
y
=
if
from_y
>
to_y
{
raw_y
}
else
{
h
-
raw_y
-
1
};
for
pixel_y
in
0
..
16
{
{
let
off_from
=
((
from_y
+
y
)
*
16
+
pixel_y
)
*
width
+
from_x
*
8
;
let
off_to
=
((
to_y
+
y
)
*
16
+
pixel_y
)
*
width
+
to_x
*
8
;
let
len
=
w
*
8
;
if
off_from
+
len
<=
pixels
.len
()
&&
off_to
+
len
<=
pixels
.len
()
{
unsafe
{
let
data_ptr
=
pixels
.as_mut_ptr
()
as
*
mut
u32
;
ptr
::
copy
(
data_ptr
.offset
(
off_from
as
isize
),
data_ptr
.offset
(
off_to
as
isize
),
len
);
}
}
}
}
changed
.insert
(
to_y
+
y
);
}
},
ransid
::
Event
::
Resize
{
..
}
=>
(),
ransid
::
Event
::
Title
{
..
}
=>
()
}
});
}
if
self
.console.
cursor
&&
self
.console.x
<
self
.console.w
&&
self
.console.y
<
self
.consol
e.h
{
let
x
=
self
.console.x
;
let
y
=
self
.console.y
;
if
self
.console.
state.cursor
&&
self
.console.state.x
<
self
.console.state.w
&&
self
.console.state.y
<
self
.console.stat
e.h
{
let
x
=
self
.console.
state.
x
;
let
y
=
self
.console.
state.
y
;
self
.display
.invert
(
x
*
8
,
y
*
16
,
8
,
16
);
self
.changed
.insert
(
y
);
}
...
...
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