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++

Add safe_assert and put includes at the top of the file.

Wolthera van Hövell tot Westerflierb1a368965c31
diff --git a/libs/flake/text/KoSvgTextShape_p_output.cpp b/libs/flake/text/KoSvgTextShape_p_output.cpp
index 4be8dd25dd..3b80040c28 100644
--- a/libs/flake/text/KoSvgTextShape_p_output.cpp
+++ b/libs/flake/text/KoSvgTextShape_p_output.cpp
@@ -19,6 +19,9 @@
#include <KoShapeFactoryBase.h>
#include <KoProperties.h>
#include <KoClipMask.h>
+#include <KoInsets.h>
+
+#include <kis_algebra_2d.h>
#include <QPainter>
#include <QtMath>
@@ -264,7 +267,6 @@ void KoSvgTextShape::Private::paintPaths(QPainter &painter,
}
}
-#include <kis_algebra_2d.h>
QGradient *cloneAndTransformGradient(const QGradient *grad, const QTransform &tf) {
QGradient *newGrad = KoFlake::cloneGradient(grad);
@@ -294,7 +296,7 @@ QSharedPointer<KoShapeBackground> transformBackgroundToBounds(QSharedPointer<KoS
// assume bg is KoColorBackground.
return bg;
}
-#include <KoInsets.h>
+
KoShapeStrokeModelSP transformStrokeBgToNewBounds(KoShapeStrokeModelSP stroke, const QRectF &oldBounds, const QRectF &newBounds, bool calcInsets = true) {
KoShapeStrokeSP s = qSharedPointerDynamicCast<KoShapeStroke>(stroke);
if (s) {
diff --git a/plugins/flake/imageshape/ImageShapeFactory.cpp b/plugins/flake/imageshape/ImageShapeFactory.cpp
index 5e62b29e81..3d3f532c1c 100644
--- a/plugins/flake/imageshape/ImageShapeFactory.cpp
+++ b/plugins/flake/imageshape/ImageShapeFactory.cpp
@@ -49,9 +49,10 @@ KoShape *ImageShapeFactory::createShape(const KoProperties *params, KoDocumentRe
shape->setShapeId(ImageShapeId);
QVariant var = params->value("image");
- if (var.type() == QVariant::Image) {
- shape->setImage(var.value<QImage>());
- }
+
+ KIS_SAFE_ASSERT_RECOVER(var.type() == QVariant::Image);
+ shape->setImage(var.value<QImage>());
+
var = params->value("viewboxTransform");
if (var.type() == QVariant::Transform) {
shape->setViewBoxTransform(var.value<QTransform>());