mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 13:32:27 +00:00
Stop filter preview before we change filter parameters
Similar fixes as in 811b893320
This commit is contained in:
parent
811b893320
commit
0cfeacab5c
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2017 David Capello
|
// Copyright (C) 2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -65,6 +65,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void onChange() {
|
void onChange() {
|
||||||
|
stopPreview();
|
||||||
m_filter.setBrightness(m_brightness.getValue() / 100.0);
|
m_filter.setBrightness(m_brightness.getValue() / 100.0);
|
||||||
m_filter.setContrast(m_contrast.getValue() / 100.0);
|
m_filter.setContrast(m_contrast.getValue() / 100.0);
|
||||||
restartPreview();
|
restartPreview();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019 Igara Studio S.A.
|
// Copyright (C) 2019-2022 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
|
||||||
@ -55,6 +55,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
void onCurveChange() {
|
void onCurveChange() {
|
||||||
|
stopPreview();
|
||||||
|
|
||||||
// The color curve in the filter is the same refereced by the
|
// 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
|
// editor. But anyway, we have to re-set the same curve in the
|
||||||
// filter to regenerate the map used internally by the filter
|
// filter to regenerate the map used internally by the filter
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2022 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
|
||||||
@ -136,6 +136,8 @@ private:
|
|||||||
std::shared_ptr<ConvolutionMatrix> matrix = m_stock.getByName(selected->text().c_str());
|
std::shared_ptr<ConvolutionMatrix> matrix = m_stock.getByName(selected->text().c_str());
|
||||||
Target newTarget = matrix->getDefaultTarget();
|
Target newTarget = matrix->getDefaultTarget();
|
||||||
|
|
||||||
|
stopPreview();
|
||||||
|
|
||||||
m_filter.setMatrix(matrix);
|
m_filter.setMatrix(matrix);
|
||||||
|
|
||||||
setNewTarget(newTarget);
|
setNewTarget(newTarget);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
// Copyright (C) 2019-2022 Igara Studio S.A.
|
||||||
// Copyright (C) 2017-2018 David Capello
|
// Copyright (C) 2017-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -95,6 +95,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onChangeMode() {
|
void onChangeMode() {
|
||||||
|
stopPreview();
|
||||||
|
|
||||||
Preferences::instance().hueSaturation.mode(mode());
|
Preferences::instance().hueSaturation.mode(mode());
|
||||||
m_filter.setMode(mode());
|
m_filter.setMode(mode());
|
||||||
m_sliders.setColorType(isHsl() ?
|
m_sliders.setColorType(isHsl() ?
|
||||||
@ -105,6 +107,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onChangeControls() {
|
void onChangeControls() {
|
||||||
|
stopPreview();
|
||||||
|
|
||||||
m_sliders.syncRelHsvHslSliders();
|
m_sliders.syncRelHsvHslSliders();
|
||||||
|
|
||||||
if (isHsl()) {
|
if (isHsl()) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// 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
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -137,21 +137,26 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onColorChange(const app::Color& color) {
|
void onColorChange(const app::Color& color) {
|
||||||
|
stopPreview();
|
||||||
m_filter.color(color);
|
m_filter.color(color);
|
||||||
restartPreview();
|
restartPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onBgColorChange(const app::Color& color) {
|
void onBgColorChange(const app::Color& color) {
|
||||||
|
stopPreview();
|
||||||
m_filter.bgColor(color);
|
m_filter.bgColor(color);
|
||||||
restartPreview();
|
restartPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPlaceChange(OutlineFilter::Place place) {
|
void onPlaceChange(OutlineFilter::Place place) {
|
||||||
|
stopPreview();
|
||||||
m_filter.place(place);
|
m_filter.place(place);
|
||||||
restartPreview();
|
restartPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMatrixTypeChange() {
|
void onMatrixTypeChange() {
|
||||||
|
stopPreview();
|
||||||
|
|
||||||
OutlineFilter::Matrix matrix = OutlineFilter::Matrix::None;
|
OutlineFilter::Matrix matrix = OutlineFilter::Matrix::None;
|
||||||
switch (m_panel.outlineType()->selectedItem()) {
|
switch (m_panel.outlineType()->selectedItem()) {
|
||||||
case CIRCLE: matrix = OutlineFilter::Matrix::Circle; break;
|
case CIRCLE: matrix = OutlineFilter::Matrix::Circle; break;
|
||||||
@ -165,6 +170,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onMatrixPixelChange(const int index) {
|
void onMatrixPixelChange(const int index) {
|
||||||
|
stopPreview();
|
||||||
|
|
||||||
int matrix = (int)m_filter.matrix();
|
int matrix = (int)m_filter.matrix();
|
||||||
matrix ^= (1 << (8-index));
|
matrix ^= (1 << (8-index));
|
||||||
m_filter.matrix((OutlineFilter::Matrix)matrix);
|
m_filter.matrix((OutlineFilter::Matrix)matrix);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2019-2021 Igara Studio S.A.
|
// Copyright (C) 2019-2022 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
|
||||||
@ -101,16 +101,19 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void onFromChange(const app::Color& color) {
|
void onFromChange(const app::Color& color) {
|
||||||
|
stopPreview();
|
||||||
m_filter.setFrom(color);
|
m_filter.setFrom(color);
|
||||||
restartPreview();
|
restartPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onToChange(const app::Color& color) {
|
void onToChange(const app::Color& color) {
|
||||||
|
stopPreview();
|
||||||
m_filter.setTo(color);
|
m_filter.setTo(color);
|
||||||
restartPreview();
|
restartPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onToleranceChange() {
|
void onToleranceChange() {
|
||||||
|
stopPreview();
|
||||||
m_filter.setTolerance(m_toleranceSlider->getValue());
|
m_filter.setTolerance(m_toleranceSlider->getValue());
|
||||||
restartPreview();
|
restartPreview();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2022 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
|
||||||
@ -40,7 +41,7 @@ namespace app {
|
|||||||
bool doModal();
|
bool doModal();
|
||||||
|
|
||||||
// Starts (or restart) the preview procedure. You should call this
|
// 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();
|
void restartPreview();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -61,6 +62,8 @@ namespace app {
|
|||||||
// mode overriding this method.
|
// mode overriding this method.
|
||||||
virtual void setupTiledMode(TiledMode tiledMode) { }
|
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();
|
void stopPreview();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user