This is an automated email from the git hooks/post-receive script. thansen pushed a commit to branch master in repository aseprite.
commit 66e3cacbd04e40797bf35cd0f67ac858edb62673 Author: David Capello <[email protected]> Date: Tue Mar 22 17:02:41 2016 -0300 Add RotSprite as a resize algorithm on Sprite > Resize Sprite menu --- src/app/commands/cmd_sprite_size.cpp | 14 +++++++++++--- src/doc/algorithm/resize_image.cpp | 16 +++++++++++++--- src/doc/algorithm/resize_image.h | 3 ++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/app/commands/cmd_sprite_size.cpp b/src/app/commands/cmd_sprite_size.cpp index 4f1cdff..04bce4f 100644 --- a/src/app/commands/cmd_sprite_size.cpp +++ b/src/app/commands/cmd_sprite_size.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2015 David Capello +// Copyright (C) 2001-2016 David Capello // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -168,10 +168,16 @@ public: widthPx()->setTextf("%d", new_width); heightPx()->setTextf("%d", new_height); + static_assert(doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR == 0 && + doc::algorithm::RESIZE_METHOD_BILINEAR == 1 && + doc::algorithm::RESIZE_METHOD_ROTSPRITE == 2, + "ResizeMethod enum has changed"); method()->addItem("Nearest-neighbor"); method()->addItem("Bilinear"); - method()->setSelectedItemIndex(get_config_int("SpriteSize", "Method", - doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR)); + method()->addItem("RotSprite"); + method()->setSelectedItemIndex( + get_config_int("SpriteSize", "Method", + doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR)); } private: @@ -279,6 +285,8 @@ void SpriteSizeCommand::onLoadParams(const Params& params) if (!resize_method.empty()) { if (resize_method == "bilinear") m_resizeMethod = doc::algorithm::RESIZE_METHOD_BILINEAR; + else if (resize_method == "rotsprite") + m_resizeMethod = doc::algorithm::RESIZE_METHOD_ROTSPRITE; else m_resizeMethod = doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR; } diff --git a/src/doc/algorithm/resize_image.cpp b/src/doc/algorithm/resize_image.cpp index 16fed96..d57bd4c 100644 --- a/src/doc/algorithm/resize_image.cpp +++ b/src/doc/algorithm/resize_image.cpp @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2001-2015 David Capello +// Copyright (c) 2001-2016 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -10,6 +10,7 @@ #include "doc/algorithm/resize_image.h" +#include "doc/algorithm/rotsprite.h" #include "doc/image_impl.h" #include "doc/palette.h" #include "doc/rgbmap.h" @@ -23,8 +24,7 @@ void resize_image(const Image* src, Image* dst, ResizeMethod method, const Palet switch (method) { // TODO optimize this - case RESIZE_METHOD_NEAREST_NEIGHBOR: - { + case RESIZE_METHOD_NEAREST_NEIGHBOR: { int o_width = src->width(), o_height = src->height(); int n_width = dst->width(), n_height = dst->height(); double x_ratio = o_width / (double)n_width; @@ -141,6 +141,16 @@ void resize_image(const Image* src, Image* dst, ResizeMethod method, const Palet break; } + case RESIZE_METHOD_ROTSPRITE: { + rotsprite_image( + dst, src, nullptr, + 0, 0, + dst->width(), 0, + dst->width(), dst->height(), + 0, dst->height()); + break; + } + } } diff --git a/src/doc/algorithm/resize_image.h b/src/doc/algorithm/resize_image.h index ee7a085..fa4b069 100644 --- a/src/doc/algorithm/resize_image.h +++ b/src/doc/algorithm/resize_image.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2001-2015 David Capello +// Copyright (c) 2001-2016 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. @@ -21,6 +21,7 @@ namespace doc { enum ResizeMethod { RESIZE_METHOD_NEAREST_NEIGHBOR, RESIZE_METHOD_BILINEAR, + RESIZE_METHOD_ROTSPRITE, }; // Resizes the source image 'src' to the destination image 'dst'. -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

