Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
5c9a7b89
Commit
5c9a7b89
authored
Sep 13, 2018
by
antirez
Browse files
LOLWUT: change padding conditional to a more direct one.
parent
02817d8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lolwut.c
View file @
5c9a7b89
...
@@ -177,7 +177,7 @@ void lwDrawSquare(lwCanvas *canvas, int x, int y, float size, float angle) {
...
@@ -177,7 +177,7 @@ void lwDrawSquare(lwCanvas *canvas, int x, int y, float size, float angle) {
lwCanvas
*
lwDrawSchotter
(
int
console_cols
,
int
squares_per_row
,
int
squares_per_col
)
{
lwCanvas
*
lwDrawSchotter
(
int
console_cols
,
int
squares_per_row
,
int
squares_per_col
)
{
/* Calculate the canvas size. */
/* Calculate the canvas size. */
int
canvas_width
=
console_cols
*
2
;
int
canvas_width
=
console_cols
*
2
;
int
padding
=
c
onsole_cols
>
2
?
2
:
0
;
int
padding
=
c
anvas_width
>
4
?
2
:
0
;
float
square_side
=
(
float
)(
canvas_width
-
padding
*
2
)
/
squares_per_row
;
float
square_side
=
(
float
)(
canvas_width
-
padding
*
2
)
/
squares_per_row
;
int
canvas_height
=
square_side
*
squares_per_col
+
padding
*
2
;
int
canvas_height
=
square_side
*
squares_per_col
+
padding
*
2
;
lwCanvas
*
canvas
=
lwCreateCanvas
(
canvas_width
,
canvas_height
);
lwCanvas
*
canvas
=
lwCreateCanvas
(
canvas_width
,
canvas_height
);
...
...
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