diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-07 05:32:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-07 05:32:15 +0400 |
commit | cdce3e09493c8bf4395de163342760409aad1407 (patch) | |
tree | 017af9ef854e58f7bd62a69d7c3cf79925deb244 /source/blender/editors/space_node | |
parent | 852a41fb0e314b70c2594150f7b0eb01daad1718 (diff) |
code cleanup:
- remove double promotions
- use UI_DPI_ICON_FAC macro rather then dpi/72
- add assert to prevent creating jobs with WM_JOB_TYPE_ANY, which should only be used for finding jobs.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 23 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 2 |
2 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 43dadb18a81..aafd4abb25e 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -124,7 +124,7 @@ static void node_socket_button_string(const bContext *C, uiBlock *block, UI_ThemeColor(TH_TEXT); slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt; - while (slen > (width * 0.5) && *ui_name) { + while (slen > (width * 0.5f) && *ui_name) { ui_name = BLI_str_find_next_char_utf8(ui_name, NULL); slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt; } @@ -140,7 +140,7 @@ static void node_socket_button_string(const bContext *C, uiBlock *block, if (node) uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node); - if (slen > 0.0) + if (slen > 0.0f) uiDefBut(block, LABEL, 0, IFACE_(name), x + (width - slen), y + 2, slen, NODE_DY - 2, NULL, 0, 0, 0, 0, ""); } } @@ -246,9 +246,9 @@ static void node_draw_output_default(const bContext *C, uiBlock *block, if (*ui_name) { uiDefBut(block, LABEL, 0, ui_name, - (int)(sock->locx - slen), (int)(sock->locy - 9.0f), - (short)slen, (short)NODE_DY, - NULL, 0, 0, 0, 0, ""); + (int)(sock->locx - slen), (int)(sock->locy - 9.0f), + (short)slen, (short)NODE_DY, + NULL, 0, 0, 0, 0, ""); } } @@ -523,8 +523,9 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) bNodeSocket *sock, *gsock; float locx, locy; rctf *rect = &gnode->totr; - float node_group_frame = U.dpi * NODE_GROUP_FRAME / 72; - float group_header = 26 * U.dpi / 72; + const float dpi_fac = UI_DPI_ICON_FAC; + const float node_group_frame = NODE_GROUP_FRAME * dpi_fac; + const float group_header = 26 * dpi_fac; int counter; int dy; @@ -701,7 +702,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket * static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode, bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out) { - const float dpi_fac = U.dpi / 72.0f; + const float dpi_fac = UI_DPI_ICON_FAC; bNodeTree *ngroup = (bNodeTree *)gnode->id; bNodeSocketType *stype = ntreeGetSocketType(gsock ? gsock->type : sock->type); uiBut *bt; @@ -813,9 +814,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN uiLayout *layout; PointerRNA ptr; rctf rect = gnode->totr; - const float dpi_fac = U.dpi / 72.0f; - float node_group_frame = NODE_GROUP_FRAME * dpi_fac; - float group_header = 26 * dpi_fac; + const float dpi_fac = UI_DPI_ICON_FAC; + const float node_group_frame = NODE_GROUP_FRAME * dpi_fac; + const float group_header = 26 * dpi_fac; int index; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 1d3b21fe2d6..72461cfb2a8 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -843,7 +843,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b rctf *rct = &node->totr; float dx, centy = BLI_rctf_cent_y(rct); float hiddenrad = BLI_rctf_size_y(rct) / 2.0f; - float socket_size = NODE_SOCKSIZE * U.dpi / 72; + float socket_size = NODE_SOCKSIZE * UI_DPI_ICON_FAC; int color_id = node_get_colorid(node); char showname[128]; /* 128 is used below */ |