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
c27103d6
Commit
c27103d6
authored
3 years ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Remove debug, optimize
Generate conversion tables rather than do float math twice for each virtual pixel.
parent
c81eba89
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/syncterm/ripper.c
+78
-17
78 additions, 17 deletions
src/syncterm/ripper.c
with
78 additions
and
17 deletions
src/syncterm/ripper.c
+
78
−
17
View file @
c27103d6
...
...
@@ -247,6 +247,10 @@ static struct {
int x_max;
int y_max;
bool borders;
int *xmap;
int *ymap;
int *xunmap;
int *yunmap;
} rip = {
RIP_STATE_BOL,
RIP_STATE_FLUSHING,
...
...
@@ -274,6 +278,7 @@ static struct {
640,
350,
true,
NULL, NULL,
};
static const uint16_t rip_line_patterns[4] = {
...
...
@@ -7632,37 +7637,85 @@ map_rip_color(int color)
static int
unmap_rip_x(int x)
{
double dx = x;
dx *= rip.x_dim;
dx /= rip.x_max;
return roundl(dx);
int i;
if (rip.xunmap == NULL) {
rip.xunmap = malloc(rip.x_dim * sizeof(int));
if (rip.xunmap == NULL) {
double dx = x;
dx *= rip.x_max;
dx /= rip.x_dim;
return roundl(dx);
}
for (i = 0; i < rip.x_dim; i++)
rip.xunmap[i] = roundl(((double)i) * rip.x_dim / rip.x_max);
}
if (x >= rip.x_dim)
x = rip.x_dim;
return rip.xunmap[x];
}
static int
unmap_rip_y(int y)
{
double dy = y;
dy *= rip.y_dim;
dy /= rip.y_max;
return roundl(dy);
int i;
if (rip.yunmap == NULL) {
rip.yunmap = malloc(rip.y_dim * sizeof(int));
if (rip.yunmap == NULL) {
double dy = y;
dy *= rip.y_max;
dy /= rip.y_dim;
return roundl(dy);
}
for (i = 0; i < rip.y_dim; i++)
rip.yunmap[i] = roundl(((double)i) * rip.y_dim / rip.y_max);
}
if (y >= rip.y_dim)
y = rip.y_dim;
return rip.yunmap[y];
}
static int
map_rip_x(int x)
{
double dx = x;
dx *= rip.x_max;
dx /= rip.x_dim;
return roundl(dx);
int i;
if (rip.xmap == NULL) {
rip.xmap = malloc(rip.x_dim * sizeof(int));
if (rip.xmap == NULL) {
double dx = x;
dx *= rip.x_max;
dx /= rip.x_dim;
return roundl(dx);
}
for (i = 0; i < rip.x_dim; i++)
rip.xmap[i] = roundl(((double)i) * rip.x_max / rip.x_dim);
}
if (x >= rip.x_dim)
x = rip.x_dim;
return rip.xmap[x];
}
static int
map_rip_y(int y)
{
double dy = y;
dy *= rip.y_max;
dy /= rip.y_dim;
return roundl(dy);
int i;
if (rip.ymap == NULL) {
rip.ymap = malloc(rip.y_dim * sizeof(int));
if (rip.ymap == NULL) {
double dy = y;
dy *= rip.y_max;
dy /= rip.y_dim;
return roundl(dy);
}
for (i = 0; i < rip.y_dim; i++)
rip.ymap[i] = roundl(((double)i) * rip.y_max / rip.y_dim);
}
if (y >= rip.y_dim)
y = rip.y_dim;
return rip.ymap[y];
}
static void
...
...
@@ -9634,7 +9687,7 @@ do_rip_command(int level, int sublevel, int cmd, const char *rawargs)
args = parse_string(rawargs);
//SLEEP(100);
printf("Level: %d, Sublevel: %d, Cmd: '%c', args: '%s'\n", level, sublevel, cmd, args);
//
printf("Level: %d, Sublevel: %d, Cmd: '%c', args: '%s'\n", level, sublevel, cmd, args);
switch (level) {
case 0:
switch (sublevel) {
...
...
@@ -10335,6 +10388,10 @@ printf("Level: %d, Sublevel: %d, Cmd: '%c', args: '%s'\n", level, sublevel, cmd,
rip.viewport.sy = 0;
rip.viewport.ex = x1 - 1;
rip.viewport.ey = y1 - 1;
FREE_AND_NULL(rip.xmap);
FREE_AND_NULL(rip.ymap);
FREE_AND_NULL(rip.xunmap);
FREE_AND_NULL(rip.yunmap);
break;
case 'g': // RIP_GOTOXY !|g <x> <y>
/* This command sets the position of the text cursor in the TTY Text
...
...
@@ -13329,6 +13386,10 @@ init_rip(int enabled)
rip.x_max = 640;
rip.y_dim = 350;
rip.y_max = 350;
FREE_AND_NULL(rip.xmap);
FREE_AND_NULL(rip.ymap);
FREE_AND_NULL(rip.xunmap);
FREE_AND_NULL(rip.yunmap);
pending_len = 0;
if (pending)
...
...
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