Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
2e41ce25
Commit
2e41ce25
authored
May 04, 2021
by
Deucе
👌🏾
Browse files
Optimize pixel calculations.
parent
fe022fec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
src/conio/x_events.c
src/conio/x_events.c
+23
-19
No files found.
src/conio/x_events.c
View file @
2e41ce25
...
...
@@ -456,6 +456,7 @@ static void local_draw_rect(struct rectlist *rect)
int
ctop
=
rect
->
rect
.
height
;
int
cbottom
=
-
1
;
int
idx
;
uint32_t
last_pixel
=
0x55555555
;
if
(
bitmap_width
!=
cleft
||
bitmap_height
!=
ctop
)
return
;
...
...
@@ -487,27 +488,30 @@ static void local_draw_rect(struct rectlist *rect)
continue
;
}
}
if
(
last_pixel
!=
rect
->
data
[
idx
])
{
last_pixel
=
rect
->
data
[
idx
];
r
=
rect
->
data
[
idx
]
>>
16
&
0xff
;
g
=
rect
->
data
[
idx
]
>>
8
&
0xff
;
b
=
rect
->
data
[
idx
]
&
0xff
;
r
=
(
r
<<
8
)
|
r
;
g
=
(
g
<<
8
)
|
g
;
b
=
(
b
<<
8
)
|
b
;
pixel
=
base_pixel
;
if
(
r_shift
>=
0
)
pixel
|=
(
r
<<
r_shift
)
&
visual
.
red_mask
;
else
pixel
|=
(
r
>>
(
0
-
r_shift
))
&
visual
.
red_mask
;
if
(
g_shift
>=
0
)
pixel
|=
(
g
<<
g_shift
)
&
visual
.
green_mask
;
else
pixel
|=
(
g
>>
(
0
-
g_shift
))
&
visual
.
green_mask
;
if
(
b_shift
>=
0
)
pixel
|=
(
b
<<
b_shift
)
&
visual
.
blue_mask
;
else
pixel
|=
(
b
>>
(
0
-
b_shift
))
&
visual
.
blue_mask
;
}
for
(
yscale
=
0
;
yscale
<
x_cvstat
.
scaling
*
x_cvstat
.
vmultiplier
;
yscale
++
)
{
for
(
xscale
=
0
;
xscale
<
x_cvstat
.
scaling
;
xscale
++
)
{
r
=
rect
->
data
[
idx
]
>>
16
&
0xff
;
g
=
rect
->
data
[
idx
]
>>
8
&
0xff
;
b
=
rect
->
data
[
idx
]
&
0xff
;
r
=
(
r
<<
8
)
|
r
;
g
=
(
g
<<
8
)
|
g
;
b
=
(
b
<<
8
)
|
b
;
pixel
=
base_pixel
;
if
(
r_shift
>=
0
)
pixel
|=
(
r
<<
r_shift
)
&
visual
.
red_mask
;
else
pixel
|=
(
r
>>
(
0
-
r_shift
))
&
visual
.
red_mask
;
if
(
g_shift
>=
0
)
pixel
|=
(
g
<<
g_shift
)
&
visual
.
green_mask
;
else
pixel
|=
(
g
>>
(
0
-
g_shift
))
&
visual
.
green_mask
;
if
(
b_shift
>=
0
)
pixel
|=
(
b
<<
b_shift
)
&
visual
.
blue_mask
;
else
pixel
|=
(
b
>>
(
0
-
b_shift
))
&
visual
.
blue_mask
;
#ifdef XPutPixel
XPutPixel
(
xim
,(
x
+
rect
->
rect
.
x
)
*
x_cvstat
.
scaling
+
xscale
,(
y
+
rect
->
rect
.
y
)
*
x_cvstat
.
scaling
*
x_cvstat
.
vmultiplier
+
yscale
,
pixel
);
#else
...
...
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