mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 00:40:04 +00:00
Fix rendering artifacts when Apply Zoom is disabled and bg grid isn't aligned with pixels (fix #1349)
This commit is contained in:
parent
41f44d9080
commit
19b52a68b9
@ -19,6 +19,8 @@
|
||||
#include "gfx/clip.h"
|
||||
#include "gfx/region.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace {
|
||||
@ -754,6 +756,13 @@ void Render::renderBackground(Image* image,
|
||||
if (tile_w < zoom.apply(1)) tile_w = zoom.apply(1);
|
||||
if (tile_h < zoom.apply(1)) tile_h = zoom.apply(1);
|
||||
|
||||
// Tiles must be aligned with pixels
|
||||
double intpart;
|
||||
if (std::modf(double(tile_w) / zoom.apply(1.0), &intpart) != 0.0)
|
||||
tile_w = intpart*zoom.apply(1);
|
||||
if (std::modf(double(tile_h) / zoom.apply(1.0), &intpart) != 0.0)
|
||||
tile_h = intpart*zoom.apply(1);
|
||||
|
||||
if (tile_w < 1) tile_w = 1;
|
||||
if (tile_h < 1) tile_h = 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user