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
|
||||
// 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();
|
||||
|
@ -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
|
||||
|
@ -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<ConvolutionMatrix> matrix = m_stock.getByName(selected->text().c_str());
|
||||
Target newTarget = matrix->getDefaultTarget();
|
||||
|
||||
stopPreview();
|
||||
|
||||
m_filter.setMatrix(matrix);
|
||||
|
||||
setNewTarget(newTarget);
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user