Improve rotated rectangles and square brush drawing#5459
Conversation
aseprite-bot
left a comment
There was a problem hiding this comment.
clang-tidy made some suggestions
| int cy = (y1 + y2) / 2; | ||
| int a = (x2 - x1) / 2; | ||
| int b = (y2 - y1) / 2; | ||
| int a = (x2 - x1 + 1) / 2; |
There was a problem hiding this comment.
warning: variable 'a' of type 'int' can be declared 'const' [misc-const-correctness]
| int a = (x2 - x1 + 1) / 2; | |
| int const a = (x2 - x1 + 1) / 2; |
| int a = (x2 - x1) / 2; | ||
| int b = (y2 - y1) / 2; | ||
| int a = (x2 - x1 + 1) / 2; | ||
| int b = (y2 - y1 + 1) / 2; |
There was a problem hiding this comment.
warning: variable 'b' of type 'int' can be declared 'const' [misc-const-correctness]
| int b = (y2 - y1 + 1) / 2; | |
| int const b = (y2 - y1 + 1) / 2; |
| double s = -std::sin(angle); | ||
| double c = std::cos(angle); | ||
|
|
||
| int ac = a * c; |
There was a problem hiding this comment.
warning: variable 'ac' of type 'int' can be declared 'const' [misc-const-correctness]
| int ac = a * c; | |
| int const ac = a * c; |
| double c = std::cos(angle); | ||
|
|
||
| int ac = a * c; | ||
| int bs = b * s; |
There was a problem hiding this comment.
warning: variable 'bs' of type 'int' can be declared 'const' [misc-const-correctness]
| int bs = b * s; | |
| int const bs = b * s; |
|
|
||
| int ac = a * c; | ||
| int bs = b * s; | ||
| int as = a * s; |
There was a problem hiding this comment.
warning: variable 'as' of type 'int' can be declared 'const' [misc-const-correctness]
| int as = a * s; | |
| int const as = a * s; |
| // Based in code of IntertwineAsRectangles::rotateRectangle function. | ||
| int c = size / 2; | ||
| int a = m_size / 2; | ||
| int b = a; |
There was a problem hiding this comment.
warning: variable 'b' of type 'int' can be declared 'const' [misc-const-correctness]
| int b = a; | |
| int const b = a; |
| int c = size / 2; | ||
| int a = m_size / 2; | ||
| int b = a; | ||
| int ac = a * cos; |
There was a problem hiding this comment.
warning: variable 'ac' of type 'int' can be declared 'const' [misc-const-correctness]
| int ac = a * cos; | |
| int const ac = a * cos; |
| int a = m_size / 2; | ||
| int b = a; | ||
| int ac = a * cos; | ||
| int bs = b * sin; |
There was a problem hiding this comment.
warning: variable 'bs' of type 'int' can be declared 'const' [misc-const-correctness]
| int bs = b * sin; | |
| int const bs = b * sin; |
| int b = a; | ||
| int ac = a * cos; | ||
| int bs = b * sin; | ||
| int as = bs; |
There was a problem hiding this comment.
warning: variable 'as' of type 'int' can be declared 'const' [misc-const-correctness]
| int as = bs; | |
| int const as = bs; |
| int ac = a * cos; | ||
| int bs = b * sin; | ||
| int as = bs; | ||
| int bc = ac; |
There was a problem hiding this comment.
warning: variable 'bc' of type 'int' can be declared 'const' [misc-const-correctness]
| int bc = ac; | |
| int const bc = ac; |
|
It looks great 👍 I'll merge it, I'm not sure if it would make sense to move the |
This PR improves how the rectangles (made using any of the rectangle tool) and the square brush are drawn in rotated positions.