Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Qt6: Check whether the alpha param is 0

Halla Rempt3cd78bfccdc0
diff --git a/libs/ui/canvas/kis_display_color_converter.cpp b/libs/ui/canvas/kis_display_color_converter.cpp
index 9408129060..3af0edb72e 100644
--- a/libs/ui/canvas/kis_display_color_converter.cpp
+++ b/libs/ui/canvas/kis_display_color_converter.cpp
@@ -711,12 +711,16 @@ void KisDisplayColorConverter::getHsvF(const KoColor &srcColor, qreal *h, qreal
fH = *h;
fS = *s;
fV = *v;
- fA = *a;
+ if (a) {
+ fA = *a;
+ }
color.getHsvF(&fH, &fS, &fV, &fA);
*h = fH;
*s = fS;
*v = fV;
- *a = fA;
+ if (a) {
+ *a = fA;
+ }
#endif
}
@@ -743,13 +747,16 @@ void KisDisplayColorConverter::getHslF(const KoColor &srcColor, qreal *h, qreal
fH = *h;
fS = *s;
fL = *l;
- fA = *a;
+ if (a) {
+ fA = *a;
+ }
color.getHslF(&fH, &fS, &fL, &fA);
*h = fH;
*s = fS;
*l = fL;
- *a = fA;
-
+ if (a) {
+ *a = fA;
+ }
#endif
}