diff --git a/src/app/commands/filters/cmd_brightness_contrast.cpp b/src/app/commands/filters/cmd_brightness_contrast.cpp index b7dcc4665..0a04a94ab 100644 --- a/src/app/commands/filters/cmd_brightness_contrast.cpp +++ b/src/app/commands/filters/cmd_brightness_contrast.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2017 David Capello // // This program is distributed under the terms of @@ -65,6 +65,7 @@ public: private: void onChange() { + stopPreview(); m_filter.setBrightness(m_brightness.getValue() / 100.0); m_filter.setContrast(m_contrast.getValue() / 100.0); restartPreview(); diff --git a/src/app/commands/filters/cmd_color_curve.cpp b/src/app/commands/filters/cmd_color_curve.cpp index 54c27e93d..3377164c8 100644 --- a/src/app/commands/filters/cmd_color_curve.cpp +++ b/src/app/commands/filters/cmd_color_curve.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -55,6 +55,8 @@ public: protected: void onCurveChange() { + stopPreview(); + // The color curve in the filter is the same refereced by the // editor. But anyway, we have to re-set the same curve in the // filter to regenerate the map used internally by the filter diff --git a/src/app/commands/filters/cmd_convolution_matrix.cpp b/src/app/commands/filters/cmd_convolution_matrix.cpp index b1f3340d5..aaf671d18 100644 --- a/src/app/commands/filters/cmd_convolution_matrix.cpp +++ b/src/app/commands/filters/cmd_convolution_matrix.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -136,6 +136,8 @@ private: std::shared_ptr matrix = m_stock.getByName(selected->text().c_str()); Target newTarget = matrix->getDefaultTarget(); + stopPreview(); + m_filter.setMatrix(matrix); setNewTarget(newTarget); diff --git a/src/app/commands/filters/cmd_hue_saturation.cpp b/src/app/commands/filters/cmd_hue_saturation.cpp index d28299b83..d2c740dd9 100644 --- a/src/app/commands/filters/cmd_hue_saturation.cpp +++ b/src/app/commands/filters/cmd_hue_saturation.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2017-2018 David Capello // // This program is distributed under the terms of @@ -95,6 +95,8 @@ private: } void onChangeMode() { + stopPreview(); + Preferences::instance().hueSaturation.mode(mode()); m_filter.setMode(mode()); m_sliders.setColorType(isHsl() ? @@ -105,6 +107,8 @@ private: } void onChangeControls() { + stopPreview(); + m_sliders.syncRelHsvHslSliders(); if (isHsl()) { diff --git a/src/app/commands/filters/cmd_outline.cpp b/src/app/commands/filters/cmd_outline.cpp index 7a030fe08..335b329d3 100644 --- a/src/app/commands/filters/cmd_outline.cpp +++ b/src/app/commands/filters/cmd_outline.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2020 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -137,21 +137,26 @@ private: } void onColorChange(const app::Color& color) { + stopPreview(); m_filter.color(color); restartPreview(); } void onBgColorChange(const app::Color& color) { + stopPreview(); m_filter.bgColor(color); restartPreview(); } void onPlaceChange(OutlineFilter::Place place) { + stopPreview(); m_filter.place(place); restartPreview(); } void onMatrixTypeChange() { + stopPreview(); + OutlineFilter::Matrix matrix = OutlineFilter::Matrix::None; switch (m_panel.outlineType()->selectedItem()) { case CIRCLE: matrix = OutlineFilter::Matrix::Circle; break; @@ -165,6 +170,8 @@ private: } void onMatrixPixelChange(const int index) { + stopPreview(); + int matrix = (int)m_filter.matrix(); matrix ^= (1 << (8-index)); m_filter.matrix((OutlineFilter::Matrix)matrix); diff --git a/src/app/commands/filters/cmd_replace_color.cpp b/src/app/commands/filters/cmd_replace_color.cpp index 74d390c71..d42f588fa 100644 --- a/src/app/commands/filters/cmd_replace_color.cpp +++ b/src/app/commands/filters/cmd_replace_color.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2021 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -101,16 +101,19 @@ public: private: void onFromChange(const app::Color& color) { + stopPreview(); m_filter.setFrom(color); restartPreview(); } void onToChange(const app::Color& color) { + stopPreview(); m_filter.setTo(color); restartPreview(); } void onToleranceChange() { + stopPreview(); m_filter.setTolerance(m_toleranceSlider->getValue()); restartPreview(); } diff --git a/src/app/commands/filters/filter_window.h b/src/app/commands/filters/filter_window.h index 128a26576..449891c89 100644 --- a/src/app/commands/filters/filter_window.h +++ b/src/app/commands/filters/filter_window.h @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2022 Igara Studio S.A. // Copyright (C) 2001-2017 David Capello // // This program is distributed under the terms of @@ -40,7 +41,7 @@ namespace app { bool doModal(); // Starts (or restart) the preview procedure. You should call this - // method each time the user modifies parameters of the Filter. + // method after the user modifies parameters of the Filter. void restartPreview(); protected: @@ -61,6 +62,8 @@ namespace app { // mode overriding this method. virtual void setupTiledMode(TiledMode tiledMode) { } + // Stops the filter preview background thread, you should call + // this before you modify the parameters of the Filter. void stopPreview(); private: