Fix zoom level 20% distorts layers (fix #5774)#5776
Merged
Conversation
aseprite-bot
left a comment
Collaborator
There was a problem hiding this comment.
clang-tidy made some suggestions
| BlenderHelper<DstTraits, SrcTraits> blender(dst, src, pal, blendMode, newBlend); | ||
| int step_w = int(1.0 / sx); | ||
| int step_h = int(1.0 / sy); | ||
| int step_w = int(std::round(1.0 / sx)); |
Collaborator
There was a problem hiding this comment.
warning: variable 'step_w' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
| int step_w = int(std::round(1.0 / sx)); | |
| int const step_w = int(std::round(1.0 / sx)); |
| int step_w = int(1.0 / sx); | ||
| int step_h = int(1.0 / sy); | ||
| int step_w = int(std::round(1.0 / sx)); | ||
| int step_h = int(std::round(1.0 / sy)); |
Collaborator
There was a problem hiding this comment.
warning: variable 'step_h' of type 'int' can be declared 'const' [misc-const-correctness]
Suggested change
| int step_h = int(std::round(1.0 / sy)); | |
| int const step_h = int(std::round(1.0 / sy)); |
Member
|
It works great 👍 I'll merge it as it is (probably a release in There are some crashes with the render logic which might be due to some similar issues, i.e. src/dst bounds being calculated outside the valid image bounds, e.g. in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem was that
sxwas 0.20000000000000001 and then1.0/sxgave 5.0 which naturally was truncated to 5. In the other hand,sywas 0.20000000000000004 and then1.0/sygave 4.9999999999999991 which was truncated to 4.aseprite/src/render/render.cpp
Lines 277 to 278 in e053655
It would seem better to remove the multiplication and division of
celBounds.w / double(cel_image->width())andcelBounds.h / double(cel_image->height())that resulted in 0.20000000000000004 in the first place:aseprite/src/render/render.cpp
Lines 1368 to 1369 in e053655
However, if I'm not mistaken, this is intended for reference layers. Therefore, I'll leave it as is.
Fix #5774