Add DOC_SPRITE_MAX_WIDTH/HEIGHT constants

This commit is contained in:
David Capello 2018-06-28 13:53:38 -03:00
parent f595ceea7f
commit aec65faa2b
4 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2017 David Capello
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -335,7 +335,10 @@ void CanvasSizeCommand::onExecute(Context* context)
Transaction transaction(writer.context(), "Canvas Size");
DocumentApi api = document->getApi(transaction);
api.cropSprite(sprite, gfx::Rect(x1, y1, x2-x1, y2-y1));
api.cropSprite(sprite,
gfx::Rect(x1, y1,
MID(1, x2-x1, DOC_SPRITE_MAX_WIDTH),
MID(1, y2-y1, DOC_SPRITE_MAX_HEIGHT)));
transaction.commit();
document->generateMaskBoundaries();

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2017 David Capello
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -138,8 +138,8 @@ void NewFileCommand::onExecute(Context* context)
static_assert(IMAGE_INDEXED == 2, "Indexed pixel format should be 2");
format = MID(IMAGE_RGB, format, IMAGE_INDEXED);
w = MID(1, w, 65535);
h = MID(1, h, 65535);
w = MID(1, w, DOC_SPRITE_MAX_WIDTH);
h = MID(1, h, DOC_SPRITE_MAX_HEIGHT);
bg = MID(0, bg, 2);
// Select the color

View File

@ -354,6 +354,9 @@ void SpriteSizeCommand::onExecute(Context* context)
}
#endif // ENABLE_UI
new_width = MID(1, new_width, DOC_SPRITE_MAX_WIDTH);
new_height = MID(1, new_height, DOC_SPRITE_MAX_HEIGHT);
{
SpriteSizeJob job(reader, new_width, new_height, resize_method);
job.startJob();

View File

@ -1,5 +1,5 @@
// Aseprite Document Library
// Copyright (c) 2001-2017 David Capello
// Copyright (c) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -25,6 +25,9 @@
#include <vector>
#define DOC_SPRITE_MAX_WIDTH 65535
#define DOC_SPRITE_MAX_HEIGHT 65535
namespace doc {
class CelsRange;