[aseprite] 119/134: Add option to disable animation loop when saving GIF files (fix #585)

Tobias Hansen thansen at moszumanska.debian.org
Sat Mar 14 17:10:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit c4d0266b5280dde34938114f2838e990dac8e907
Author: David Capello <davidcapello at gmail.com>
Date:   Thu Jan 29 11:24:43 2015 -0300

    Add option to disable animation loop when saving GIF files (fix #585)
---
 data/widgets/gif_options.xml | 3 ++-
 src/app/file/gif_format.cpp  | 6 +++++-
 src/app/file/gif_options.h   | 5 +++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/data/widgets/gif_options.xml b/data/widgets/gif_options.xml
index 78991d7..c1b34a0 100644
--- a/data/widgets/gif_options.xml
+++ b/data/widgets/gif_options.xml
@@ -13,8 +13,9 @@
       <radio id="no_quantize" text="&Don't modify color palette" group="1" />
     </vbox>
 
-    <separator text="Optimize for Web:" left="true" horizontal="true" />
+    <separator text="General Options:" left="true" horizontal="true" />
     <check text="Interlaced" id="interlaced" />
+    <check text="Animation Loop" id="loop" />
 
     <separator horizontal="true" />
 
diff --git a/src/app/file/gif_format.cpp b/src/app/file/gif_format.cpp
index 7dc0c45..d58ed9e 100644
--- a/src/app/file/gif_format.cpp
+++ b/src/app/file/gif_format.cpp
@@ -544,7 +544,7 @@ bool GifFormat::onSave(FileOp* fop)
   int sprite_h = sprite->height();
   PixelFormat sprite_format = sprite->pixelFormat();
   bool interlaced = gif_options->interlaced();
-  int loop = 0;
+  int loop = (gif_options->loop() ? 0: -1);
   bool has_background = (sprite->backgroundLayer() ? true: false);
   int background_color = (sprite_format == IMAGE_INDEXED ? sprite->transparentColor(): 0);
   int transparent_index = (has_background ? -1: sprite->transparentColor());
@@ -797,6 +797,7 @@ SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
     // Configuration parameters
     gif_options->setQuantize((GifOptions::Quantize)get_config_int("GIF", "Quantize", (int)gif_options->quantize()));
     gif_options->setInterlaced(get_config_bool("GIF", "Interlaced", gif_options->interlaced()));
+    gif_options->setLoop(get_config_bool("GIF", "Loop", gif_options->loop()));
     gif_options->setDithering((raster::DitheringMethod)get_config_int("GIF", "Dither", (int)gif_options->dithering()));
 
     // Load the window to ask to the user the GIF options he wants.
@@ -810,6 +811,7 @@ SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
       case GifOptions::QuantizeAll: win.quantizeAll()->setSelected(true); break;
     }
     win.interlaced()->setSelected(gif_options->interlaced());
+    win.loop()->setSelected(gif_options->loop());
 
     win.dither()->setEnabled(true);
     win.dither()->setSelected(gif_options->dithering() == raster::DITHERING_ORDERED);
@@ -825,12 +827,14 @@ SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
         gif_options->setQuantize(GifOptions::NoQuantize);
 
       gif_options->setInterlaced(win.interlaced()->isSelected());
+      gif_options->setLoop(win.loop()->isSelected());
       gif_options->setDithering(win.dither()->isSelected() ?
         raster::DITHERING_ORDERED:
         raster::DITHERING_NONE);
 
       set_config_int("GIF", "Quantize", gif_options->quantize());
       set_config_bool("GIF", "Interlaced", gif_options->interlaced());
+      set_config_bool("GIF", "Loop", gif_options->loop());
       set_config_int("GIF", "Dither", gif_options->dithering());
     }
     else {
diff --git a/src/app/file/gif_options.h b/src/app/file/gif_options.h
index ba72393..115659b 100644
--- a/src/app/file/gif_options.h
+++ b/src/app/file/gif_options.h
@@ -33,23 +33,28 @@ namespace app {
     GifOptions(
       Quantize quantize = QuantizeEach,
       bool interlaced = false,
+      bool loop = true,
       DitheringMethod dithering = raster::DITHERING_NONE)
       : m_quantize(quantize)
       , m_interlaced(interlaced)
+      , m_loop(loop)
       , m_dithering(dithering) {
     }
 
     Quantize quantize() const { return m_quantize; }
     bool interlaced() const { return m_interlaced; }
+    bool loop() const { return m_loop; }
     raster::DitheringMethod dithering() const { return m_dithering; }
 
     void setQuantize(const Quantize quantize) { m_quantize = quantize; }
     void setInterlaced(bool interlaced) { m_interlaced = interlaced; }
+    void setLoop(bool loop) { m_loop = loop; }
     void setDithering(const raster::DitheringMethod dithering) { m_dithering = dithering; }
 
   private:
     Quantize m_quantize;
     bool m_interlaced;
+    bool m_loop;
     raster::DitheringMethod m_dithering;
   };
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list