Skip to content

Commit b7909bf

Browse files
committed
Fix for #246
1 parent 9478f6a commit b7909bf

1 file changed

Lines changed: 11 additions & 26 deletions

File tree

src/fxscanlines.cpp

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,35 @@
2626
#include "fxscanlines.h"
2727

2828
#include <QPainter>
29-
#include <cmath>
3029

3130
FxScanlines::FxScanlines() {}
3231

3332
QImage FxScanlines::applyEffect(const QImage &src, const Layer &layer,
3433
Settings *config) {
3534
QImage canvas = src;
36-
QString resource = layer.resource;
3735
double scaling = 1.0;
38-
int opacity = layer.opacity;
3936
if (!layer.scaling.isEmpty()) {
4037
bool isDouble = false;
4138
layer.scaling.toDouble(&isDouble);
42-
if (isDouble)
39+
if (isDouble) {
4340
scaling = layer.scaling.toDouble();
41+
if (scaling < 0.1)
42+
scaling = 0.1;
43+
else if (scaling > 2.0)
44+
scaling = 2.0;
45+
}
4446
}
4547

46-
if (resource.isEmpty() || !config->resources.contains("resource"))
48+
QString resource = layer.resource;
49+
if (!config->resources.contains(resource))
4750
resource = "scanlines1.png";
48-
if (opacity == -1)
49-
opacity = 100;
50-
51-
if (scaling < 0.1)
52-
scaling = 0.1;
53-
if (scaling > 2.0)
54-
scaling = 2.0;
5551

56-
if (opacity > 100)
52+
int opacity = layer.opacity;
53+
if (opacity == -1 || opacity > 100)
5754
opacity = 100;
58-
if (opacity < 0)
55+
else if (opacity < -1)
5956
opacity = 0;
6057

61-
/*
62-
if(!layer.scaling.isEmpty()) {
63-
if(layer.scaling == "auto") {
64-
} else {
65-
bool isDouble = false;
66-
layer.scaling.toDouble(&isDouble);
67-
if(isDouble)
68-
scaling = layer.scaling.toDouble();
69-
}
70-
}
71-
*/
72-
7358
QPainter painter;
7459
painter.begin(&canvas);
7560
painter.setOpacity(opacity * 0.01);

0 commit comments

Comments
 (0)