Minor changes to f24eb75298c118500ff4428661fe186eefdde2b2

This commit is contained in:
David Capello 2019-03-22 11:06:03 -03:00
parent f24eb75298
commit 60e8a5967d
10 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018 Igara Studio S.A. // Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018 Igara Studio S.A. // Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello // Copyright (C) 2001-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2016-2017 David Capello // Copyright (C) 2016-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2016-2017 David Capello // Copyright (C) 2016-2017 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018 Igara Studio S.A. // Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -757,7 +757,6 @@ void CliProcessor::saveFile(Context* ctx, const CliOpenFile& cof)
// Call delegate // Call delegate
m_delegate->saveFile(ctx, itemCof); m_delegate->saveFile(ctx, itemCof);
// for trim or trimByGrid case
if (cof.trim) { if (cof.trim) {
ctx->executeCommand(undoCommand); ctx->executeCommand(undoCommand);
clearUndo = true; clearUndo = true;

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018 Igara Studio S.A. // Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2016-2018 David Capello // Copyright (C) 2016-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of

View File

@ -102,7 +102,7 @@ AutocropSpriteCommand::AutocropSpriteCommand()
{ {
} }
void AutocropSpriteCommand::onLoadParams(const app::Params &params) void AutocropSpriteCommand::onLoadParams(const app::Params& params)
{ {
m_byGrid = false; m_byGrid = false;
if (params.has_param("byGrid")) { if (params.has_param("byGrid")) {

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -158,7 +159,7 @@ void DocApi::cropSprite(Sprite* sprite, const gfx::Rect& bounds)
} }
} }
void DocApi::trimSprite(Sprite* sprite, bool isByGrid) void DocApi::trimSprite(Sprite* sprite, const bool byGrid)
{ {
gfx::Rect bounds; gfx::Rect bounds;
@ -177,7 +178,8 @@ void DocApi::trimSprite(Sprite* sprite, bool isByGrid)
if (doc::algorithm::shrink_bounds(image, frameBounds, get_pixel(image, 0, 0))) if (doc::algorithm::shrink_bounds(image, frameBounds, get_pixel(image, 0, 0)))
bounds = bounds.createUnion(frameBounds); bounds = bounds.createUnion(frameBounds);
if (isByGrid) { // TODO merge this code with the code in DocExporter::captureSamples()
if (byGrid) {
Doc* doc = m_document; Doc* doc = m_document;
auto& docPref = Preferences::instance().document(doc); auto& docPref = Preferences::instance().document(doc);
gfx::Point posTopLeft = gfx::Point posTopLeft =

View File

@ -1,4 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -45,7 +46,7 @@ namespace app {
void setSpriteSize(Sprite* sprite, int w, int h); void setSpriteSize(Sprite* sprite, int w, int h);
void setSpriteTransparentColor(Sprite* sprite, color_t maskColor); void setSpriteTransparentColor(Sprite* sprite, color_t maskColor);
void cropSprite(Sprite* sprite, const gfx::Rect& bounds); void cropSprite(Sprite* sprite, const gfx::Rect& bounds);
void trimSprite(Sprite* sprite, bool isByGrid); void trimSprite(Sprite* sprite, const bool byGrid);
// Frames API // Frames API
void addFrame(Sprite* sprite, frame_t newFrame); void addFrame(Sprite* sprite, frame_t newFrame);

View File

@ -603,6 +603,7 @@ void DocExporter::captureSamples(Samples& samples)
} }
if (m_trimCels) { if (m_trimCels) {
// TODO merge this code with the code in DocApi::trimSprite()
if (m_trimByGrid) { if (m_trimByGrid) {
auto& docPref = Preferences::instance().document(doc); auto& docPref = Preferences::instance().document(doc);
gfx::Point posTopLeft = gfx::Point posTopLeft =