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
a6d5d23d
Commit
a6d5d23d
authored
Sep 22, 2016
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix openlibm
parent
690a4334
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
vesad/src/display.rs
vesad/src/display.rs
+21
-16
No files found.
vesad/src/display.rs
View file @
a6d5d23d
...
...
@@ -87,22 +87,27 @@ impl Display {
let
scale
=
Scale
::
uniform
(
16.0
);
let
v_metrics
=
font
.v_metrics
(
scale
);
let
point
=
point
(
0.0
,
v_metrics
.ascent
);
glyph
.scaled
(
scale
)
.positioned
(
point
)
.draw
(|
off_x
,
off_y
,
v
|
{
let
off_x
=
x
+
off_x
as
usize
;
let
off_y
=
y
+
off_y
as
usize
;
// There's still a possibility that the glyph clips the boundaries of the bitmap
if
off_x
<
width
&&
off_y
<
height
{
let
v_u
=
(
v
*
255.0
)
as
u32
;
let
r
=
((
color
>>
16
)
&
0xFF
*
v_u
)
/
255
;
let
g
=
((
color
>>
8
)
&
0xFF
*
v_u
)
/
255
;
let
b
=
(
color
&
0xFF
*
v_u
)
/
255
;
let
c
=
(
r
<<
16
)
|
(
g
<<
8
)
|
b
;
let
index
=
(
off_y
*
width
+
off_x
)
as
isize
;
unsafe
{
*
offscreen
.offset
(
index
)
=
c
;
}
unsafe
{
*
onscreen
.offset
(
index
)
=
c
;
}
}
});
let
glyph
=
glyph
.scaled
(
scale
)
.positioned
(
point
);
if
let
Some
(
bb
)
=
glyph
.pixel_bounding_box
()
{
glyph
.draw
(|
off_x
,
off_y
,
v
|
{
let
off_x
=
x
+
(
off_x
as
i32
+
bb
.min.x
)
as
usize
;
let
off_y
=
y
+
(
off_y
as
i32
+
bb
.min.y
)
as
usize
;
// There's still a possibility that the glyph clips the boundaries of the bitmap
if
off_x
<
width
&&
off_y
<
height
{
let
v_u
=
(
v
*
255.0
)
as
u32
;
if
v_u
>
0
{
let
r
=
(((
color
>>
16
)
&
0xFF
)
*
v_u
)
/
255
;
let
g
=
(((
color
>>
8
)
&
0xFF
)
*
v_u
)
/
255
;
let
b
=
((
color
&
0xFF
)
*
v_u
)
/
255
;
let
c
=
(
r
<<
16
)
|
(
g
<<
8
)
|
b
;
let
index
=
(
off_y
*
width
+
off_x
)
as
isize
;
unsafe
{
*
offscreen
.offset
(
index
)
=
c
;
}
unsafe
{
*
onscreen
.offset
(
index
)
=
c
;
}
}
}
});
}
}
}
...
...
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