summaryrefslogtreecommitdiffstats
path: root/src/splivarot.cpp
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2013-11-12 19:28:51 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2013-11-12 19:28:51 +0000
commit7476da8cb27f25300274d7cab45cd8bde1df5a98 (patch)
tree2562fe3800b89e94b3358258087617d276ad6bf9 /src/splivarot.cpp
parentPathOutline. modify tolerance for detecting smooth joins. (Bug 1247441) (diff)
downloadinkscape-7476da8cb27f25300274d7cab45cd8bde1df5a98.tar.gz
inkscape-7476da8cb27f25300274d7cab45cd8bde1df5a98.zip
splivarot: scan-build fixes and cleanup
(bzr r12798)
Diffstat (limited to 'src/splivarot.cpp')
-rw-r--r--src/splivarot.cpp36
1 files changed, 14 insertions, 22 deletions
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index ad40178fb..7bf556aa1 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -338,6 +338,8 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool
return;
}
+ g_assert(il != NULL);
+
if (g_slist_length(il) > 2) {
if (bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) {
boolop_display_error_message(desktop, _("Select <b>exactly 2 paths</b> to perform difference, division, or path cut."));
@@ -352,8 +354,8 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool
if (bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice) {
// check in the tree to find which element of the selection list is topmost (for 2-operand commands only)
- Inkscape::XML::Node *a = reinterpret_cast<SPObject *>(il->data)->getRepr();
- Inkscape::XML::Node *b = reinterpret_cast<SPObject *>(il->next->data)->getRepr();
+ Inkscape::XML::Node *a = SP_OBJECT(il->data)->getRepr();
+ Inkscape::XML::Node *b = SP_OBJECT(il->next->data)->getRepr();
if (a == NULL || b == NULL) {
boolop_display_error_message(desktop, _("Unable to determine the <b>z-order</b> of the objects selected for difference, XOR, division, or path cut."));
@@ -393,6 +395,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool
}
il = g_slist_copy(il);
+ g_assert(il != NULL);
// first check if all the input objects have shapes
// otherwise bail out
@@ -1160,7 +1163,7 @@ sp_selected_path_outline(SPDesktop *desktop)
items != NULL;
items = items->next) {
- SPItem *item = (SPItem *) items->data;
+ SPItem *item = SP_ITEM(items->data);
if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item))
continue;
@@ -1177,6 +1180,8 @@ sp_selected_path_outline(SPDesktop *desktop)
continue;
}
+ g_assert(curve != NULL);
+
if (curve->get_pathvector().empty()) {
continue;
}
@@ -1595,6 +1600,8 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool
}
}
+ g_assert(curve != NULL);
+
Geom::Affine const transform(item->transform);
item->doWriteTransform(item->getRepr(), Geom::identity());
@@ -1610,9 +1617,6 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool
float o_width = 0;
{
- SPStyle *i_style = item->style;
-
- o_width = i_style->stroke_width.computed;
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
o_width = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px");
@@ -1774,7 +1778,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
items != NULL;
items = items->next) {
- SPItem *item = (SPItem *) items->data;
+ SPItem *item = SP_ITEM(items->data);
if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item))
continue;
@@ -1791,6 +1795,9 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
continue;
}
+ // We've now checked that there is a curve for this item
+ g_assert(curve != NULL);
+
Geom::Affine const transform(item->transform);
item->doWriteTransform(item->getRepr(), Geom::identity());
@@ -1805,9 +1812,6 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
{
SPStyle *i_style = item->style;
int jointype = i_style->stroke_linejoin.value;
- //int captype = i_style->stroke_linecap.value;
-
- o_width = i_style->stroke_width.computed;
switch (jointype) {
case SP_STROKE_LINEJOIN_MITER:
@@ -1821,18 +1825,6 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
break;
}
- /*switch (captype) {
- case SP_STROKE_LINECAP_SQUARE:
- o_butt = butt_square;
- break;
- case SP_STROKE_LINECAP_ROUND:
- o_butt = butt_round;
- break;
- default:
- o_butt = butt_straight;
- break;
- }*/
-
o_width = prefOffset;
if (o_width < 0.1)