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
Liam Naddell
drivers
Commits
60f88081
Commit
60f88081
authored
Nov 10, 2016
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invert on cursor
parent
febfbfed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
vesad/src/display.rs
vesad/src/display.rs
+32
-0
vesad/src/screen/text.rs
vesad/src/screen/text.rs
+2
-4
No files found.
vesad/src/display.rs
View file @
60f88081
...
...
@@ -103,6 +103,38 @@ impl Display {
}
}
/// Invert a rectangle
pub
fn
invert
(
&
mut
self
,
x
:
usize
,
y
:
usize
,
w
:
usize
,
h
:
usize
)
{
let
start_y
=
cmp
::
min
(
self
.height
-
1
,
y
);
let
end_y
=
cmp
::
min
(
self
.height
,
y
+
h
);
let
start_x
=
cmp
::
min
(
self
.width
-
1
,
x
);
let
len
=
cmp
::
min
(
self
.width
,
x
+
w
)
-
start_x
;
let
mut
offscreen_ptr
=
self
.offscreen
.as_mut_ptr
()
as
usize
;
let
stride
=
self
.width
*
4
;
let
offset
=
y
*
stride
+
start_x
*
4
;
offscreen_ptr
+=
offset
;
let
mut
rows
=
end_y
-
start_y
;
while
rows
>
0
{
let
mut
row_ptr
=
offscreen_ptr
;
let
mut
cols
=
len
;
while
cols
>
0
{
unsafe
{
let
color
=
*
(
row_ptr
as
*
mut
u32
);
*
(
row_ptr
as
*
mut
u32
)
=
!
color
;
}
row_ptr
+=
4
;
cols
-=
1
;
}
offscreen_ptr
+=
stride
;
rows
-=
1
;
}
}
/// Draw a character
#[cfg(not(feature=
"rusttype"
))]
pub
fn
char
(
&
mut
self
,
x
:
usize
,
y
:
usize
,
character
:
char
,
color
:
u32
,
_
bold
:
bool
,
_
italic
:
bool
)
{
...
...
vesad/src/screen/text.rs
View file @
60f88081
...
...
@@ -163,8 +163,7 @@ impl Screen for TextScreen {
if
self
.console.cursor
&&
self
.console.x
<
self
.console.w
&&
self
.console.y
<
self
.console.h
{
let
x
=
self
.console.x
;
let
y
=
self
.console.y
;
let
color
=
self
.console.background
;
self
.display
.rect
(
x
*
8
,
y
*
16
,
8
,
16
,
color
.data
);
self
.display
.invert
(
x
*
8
,
y
*
16
,
8
,
16
);
self
.changed
.insert
(
y
);
}
...
...
@@ -196,8 +195,7 @@ impl Screen for TextScreen {
if
self
.console.cursor
&&
self
.console.x
<
self
.console.w
&&
self
.console.y
<
self
.console.h
{
let
x
=
self
.console.x
;
let
y
=
self
.console.y
;
let
color
=
self
.console.foreground
;
self
.display
.rect
(
x
*
8
,
y
*
16
,
8
,
16
,
color
.data
);
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