summaryrefslogtreecommitdiffstats
path: root/src/sp-rect.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-04-10 18:44:21 +0000
committerMarkus Engel <markus.engel@tum.de>2013-04-10 18:44:21 +0000
commit1f096398da95ef2c74a89e53c64d9cd75911b6eb (patch)
tree58b963c4ea018649d68d1112134cc85de5fec564 /src/sp-rect.cpp
parentRemoved unused (ancient!) code. (diff)
downloadinkscape-1f096398da95ef2c74a89e53c64d9cd75911b6eb.tar.gz
inkscape-1f096398da95ef2c74a89e53c64d9cd75911b6eb.zip
various little changes
(bzr r11608.1.93)
Diffstat (limited to 'src/sp-rect.cpp')
-rw-r--r--src/sp-rect.cpp45
1 files changed, 33 insertions, 12 deletions
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index 820f05dff..c150267fc 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -34,7 +34,11 @@
#include "sp-factory.h"
namespace {
- bool rectRegistered = SPFactory::instance().registerObject("svg:rect", []() { return new SPRect(); });
+ SPRect* createRect() {
+ return new SPRect();
+ }
+
+ bool rectRegistered = SPFactory::instance().registerObject("svg:rect", createRect);
}
@@ -200,14 +204,30 @@ void SPRect::set_shape() {
*/
if ((rx > 1e-18) && (ry > 1e-18)) {
c->moveto(x + rx, y);
- if (rx < w2) c->lineto(x + w - rx, y);
- c->curveto(x + w - rx * (1 - C1), y, x + w, y + ry * (1 - C1), x + w, y + ry);
- if (ry < h2) c->lineto(x + w, y + h - ry);
- c->curveto(x + w, y + h - ry * (1 - C1), x + w - rx * (1 - C1), y + h, x + w - rx, y + h);
- if (rx < w2) c->lineto(x + rx, y + h);
- c->curveto(x + rx * (1 - C1), y + h, x, y + h - ry * (1 - C1), x, y + h - ry);
- if (ry < h2) c->lineto(x, y + ry);
- c->curveto(x, y + ry * (1 - C1), x + rx * (1 - C1), y, x + rx, y);
+
+ if (rx < w2) {
+ c->lineto(x + w - rx, y);
+ }
+
+ c->curveto(x + w - rx * (1 - C1), y, x + w, y + ry * (1 - C1), x + w, y + ry);
+
+ if (ry < h2) {
+ c->lineto(x + w, y + h - ry);
+ }
+
+ c->curveto(x + w, y + h - ry * (1 - C1), x + w - rx * (1 - C1), y + h, x + w - rx, y + h);
+
+ if (rx < w2) {
+ c->lineto(x + rx, y + h);
+ }
+
+ c->curveto(x + rx * (1 - C1), y + h, x, y + h - ry * (1 - C1), x, y + h - ry);
+
+ if (ry < h2) {
+ c->lineto(x, y + ry);
+ }
+
+ c->curveto(x, y + ry * (1 - C1), x + rx * (1 - C1), y, x + rx, y);
} else {
c->moveto(x + 0.0, y + 0.0);
c->lineto(x + w, y + 0.0);
@@ -216,8 +236,8 @@ void SPRect::set_shape() {
}
c->closepath();
- this->setCurveInsync( c, TRUE);
- this->setCurveBeforeLPE( c );
+ this->setCurveInsync(c, true);
+ this->setCurveBeforeLPE(c);
// LPE is not applied because result can generally not be represented as SPRect
@@ -504,7 +524,8 @@ void SPRect::convert_to_guides() {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) {
- this->convert_to_guides();
+ // Use bounding box instead of edges
+ SPShape::convert_to_guides();
return;
}