mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +00:00
Fixed size calculation on resize_image
This commit is contained in:
parent
26279597b6
commit
b65fb3a14e
@ -21,6 +21,7 @@
|
|||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -33,8 +34,8 @@ doc::Image* resize_image(
|
|||||||
const RgbMap* rgbmap)
|
const RgbMap* rgbmap)
|
||||||
{
|
{
|
||||||
doc::ImageSpec spec = image->spec();
|
doc::ImageSpec spec = image->spec();
|
||||||
spec.setWidth(std::max(1, int(scale.w*image->width())));
|
spec.setWidth(std::max(1, int(std::round(scale.w*image->width()))));
|
||||||
spec.setHeight(std::max(1, int(scale.h*image->height())));
|
spec.setHeight(std::max(1, int(std::round(scale.h*image->height()))));
|
||||||
std::unique_ptr<doc::Image> newImage(
|
std::unique_ptr<doc::Image> newImage(
|
||||||
doc::Image::create(spec));
|
doc::Image::create(spec));
|
||||||
newImage->setMaskColor(image->maskColor());
|
newImage->setMaskColor(image->maskColor());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user