summaryrefslogtreecommitdiffstats
path: root/src/port.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-27 00:38:17 +0000
committerDavid Robillard <d@drobilla.net>2013-12-27 00:38:17 +0000
commit76298e353df88996de4b423f3090811723b73d37 (patch)
tree307edcd3cebb36acf404af5ffb8aaad48de72cb3 /src/port.c
parentf3d304f86be2d4639ba61267a1ca861900fb9d7d (diff)
downloadganv-76298e353df88996de4b423f3090811723b73d37.tar.gz
ganv-76298e353df88996de4b423f3090811723b73d37.tar.bz2
ganv-76298e353df88996de4b423f3090811723b73d37.zip
Performance improvements.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5214 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/port.c')
-rw-r--r--src/port.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/port.c b/src/port.c
index 10861c8..3b16758 100644
--- a/src/port.c
+++ b/src/port.c
@@ -138,6 +138,10 @@ ganv_port_draw(GanvItem* item,
GANV_ITEM_GET_CLASS(rect)->draw(rect, cr, cx, cy, width, height);
}
+ if (!GANV_NODE(port)->impl->show_label) {
+ return;
+ }
+
GanvItem* labels[2] = {
GANV_ITEM(GANV_NODE(item)->impl->label),
port->impl->control ? GANV_ITEM(port->impl->control->label) : NULL
@@ -158,11 +162,12 @@ ganv_port_tail_vector(const GanvNode* self,
double* dx,
double* dy)
{
+ GanvItem* item = GANV_ITEM(self);
GanvPort* port = GANV_PORT(self);
GanvCanvas* canvas = GANV_CANVAS(GANV_ITEM(self)->canvas);
- double px, py;
- g_object_get(G_OBJECT(self), "x", &px, "y", &py, NULL);
+ const double px = item->x;
+ const double py = item->y;
switch (canvas->direction) {
case GANV_DIRECTION_RIGHT:
@@ -190,11 +195,12 @@ ganv_port_head_vector(const GanvNode* self,
double* dx,
double* dy)
{
+ GanvItem* item = GANV_ITEM(self);
GanvPort* port = GANV_PORT(self);
GanvCanvas* canvas = GANV_CANVAS(GANV_ITEM(self)->canvas);
- double px, py;
- g_object_get(G_OBJECT(self), "x", &px, "y", &py, NULL);
+ const double px = item->x;
+ const double py = item->y;
switch (canvas->direction) {
case GANV_DIRECTION_RIGHT:
@@ -388,10 +394,6 @@ ganv_port_new(GanvModule* module,
va_end(args);
GanvBox* box = GANV_BOX(port);
- box->impl->radius_tl = (is_input ? 0.0 : 4.0);
- box->impl->radius_tr = (is_input ? 4.0 : 0.0);
- box->impl->radius_br = (is_input ? 4.0 : 0.0);
- box->impl->radius_bl = (is_input ? 0.0 : 4.0);
box->impl->coords.border_width = 1.0;
GanvNode* node = GANV_NODE(port);
@@ -472,6 +474,7 @@ void
ganv_port_set_value_label(GanvPort* port,
const char* str)
{
+ GanvNode* node = GANV_NODE(port);
GanvPortImpl* impl = port->impl;
if (!impl->control) {
return;