From 8ec4371ff1d2e36970b0823e4b6f4a7edc25d89e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Mar 2012 22:42:32 +0000 Subject: style cleanup: render --- source/blender/editors/render/render_view.c | 110 ++++++++++++++-------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'source/blender/editors/render/render_view.c') diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 31b53fcabe1..0d902722183 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -61,24 +61,24 @@ /* would use BKE_screen_find_big_area(...) but this is too specific */ static ScrArea *biggest_non_image_area(bContext *C) { - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa, *big= NULL; - int size, maxsize= 0, bwmaxsize= 0; - short foundwin= 0; + bScreen *sc = CTX_wm_screen(C); + ScrArea *sa, *big = NULL; + int size, maxsize = 0, bwmaxsize = 0; + short foundwin = 0; - for (sa= sc->areabase.first; sa; sa= sa->next) { + for (sa = sc->areabase.first; sa; sa = sa->next) { if (sa->winx > 30 && sa->winy > 30) { - size= sa->winx*sa->winy; + size = sa->winx * sa->winy; if (sa->spacetype == SPACE_BUTS) { if (foundwin == 0 && size > bwmaxsize) { - bwmaxsize= size; - big= sa; + bwmaxsize = size; + big = sa; } } else if (sa->spacetype != SPACE_IMAGE && size > maxsize) { - maxsize= size; - big= sa; - foundwin= 1; + maxsize = size; + big = sa; + foundwin = 1; } } } @@ -88,16 +88,16 @@ static ScrArea *biggest_non_image_area(bContext *C) static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win) { - wmWindowManager *wm= CTX_wm_manager(C); + wmWindowManager *wm = CTX_wm_manager(C); ScrArea *sa = NULL; SpaceImage *sima; /* find an imagewindow showing render result */ - for (*win=wm->windows.first; *win; *win= (*win)->next) { - for (sa= (*win)->screen->areabase.first; sa; sa= sa->next) { - if (sa->spacetype==SPACE_IMAGE) { - sima= sa->spacedata.first; - if (sima->image && sima->image->type==IMA_TYPE_R_RESULT) + for (*win = wm->windows.first; *win; *win = (*win)->next) { + for (sa = (*win)->screen->areabase.first; sa; sa = sa->next) { + if (sa->spacetype == SPACE_IMAGE) { + sima = sa->spacedata.first; + if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) break; } } @@ -110,14 +110,14 @@ static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win) static ScrArea *find_area_image_empty(bContext *C) { - bScreen *sc= CTX_wm_screen(C); + bScreen *sc = CTX_wm_screen(C); ScrArea *sa; SpaceImage *sima; /* find an imagewindow showing render result */ - for (sa=sc->areabase.first; sa; sa= sa->next) { - if (sa->spacetype==SPACE_IMAGE) { - sima= sa->spacedata.first; + for (sa = sc->areabase.first; sa; sa = sa->next) { + if (sa->spacetype == SPACE_IMAGE) { + sima = sa->spacedata.first; if (!sima->image) break; } @@ -131,70 +131,70 @@ static ScrArea *find_area_image_empty(bContext *C) /* new window uses x,y to set position */ void render_view_open(bContext *C, int mx, int my) { - wmWindow *win= CTX_wm_window(C); - Scene *scene= CTX_data_scene(C); - ScrArea *sa= NULL; + wmWindow *win = CTX_wm_window(C); + Scene *scene = CTX_data_scene(C); + ScrArea *sa = NULL; SpaceImage *sima; - int area_was_image=0; + int area_was_image = 0; - if (scene->r.displaymode==R_OUTPUT_NONE) + if (scene->r.displaymode == R_OUTPUT_NONE) return; - if (scene->r.displaymode==R_OUTPUT_WINDOW) { + if (scene->r.displaymode == R_OUTPUT_WINDOW) { rcti rect; int sizex, sizey; - sizex= 10 + (scene->r.xsch*scene->r.size)/100; - sizey= 40 + (scene->r.ysch*scene->r.size)/100; + sizex = 10 + (scene->r.xsch * scene->r.size) / 100; + sizey = 40 + (scene->r.ysch * scene->r.size) / 100; /* arbitrary... miniature image window views don't make much sense */ - if (sizex < 320) sizex= 320; - if (sizey < 256) sizey= 256; + if (sizex < 320) sizex = 320; + if (sizey < 256) sizey = 256; /* XXX some magic to calculate postition */ - rect.xmin = mx + win->posx - sizex/2; - rect.ymin = my + win->posy - sizey/2; + rect.xmin = mx + win->posx - sizex / 2; + rect.ymin = my + win->posy - sizey / 2; rect.xmax = rect.xmin + sizex; rect.ymax = rect.ymin + sizey; /* changes context! */ WM_window_open_temp(C, &rect, WM_WINDOW_RENDER); - sa= CTX_wm_area(C); + sa = CTX_wm_area(C); } - else if (scene->r.displaymode==R_OUTPUT_SCREEN) { + else if (scene->r.displaymode == R_OUTPUT_SCREEN) { if (CTX_wm_area(C) && CTX_wm_area(C)->spacetype == SPACE_IMAGE) area_was_image = 1; /* this function returns with changed context */ - sa= ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE); + sa = ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE); } if (!sa) { - sa= find_area_showing_r_result(C, &win); - if (sa==NULL) - sa= find_area_image_empty(C); + sa = find_area_showing_r_result(C, &win); + if (sa == NULL) + sa = find_area_image_empty(C); /* if area found in other window, we make that one show in front */ - if (win && win!=CTX_wm_window(C)) + if (win && win != CTX_wm_window(C)) wm_window_raise(win); - if (sa==NULL) { + if (sa == NULL) { /* find largest open non-image area */ - sa= biggest_non_image_area(C); + sa = biggest_non_image_area(C); if (sa) { ED_area_newspace(C, sa, SPACE_IMAGE); - sima= sa->spacedata.first; + sima = sa->spacedata.first; /* makes ESC go back to prev space */ sima->flag |= SI_PREVSPACE; } else { /* use any area of decent size */ - sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0); - if (sa->spacetype!=SPACE_IMAGE) { + sa = BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0); + if (sa->spacetype != SPACE_IMAGE) { // XXX newspace(sa, SPACE_IMAGE); - sima= sa->spacedata.first; + sima = sa->spacedata.first; /* makes ESC go back to prev space */ sima->flag |= SI_PREVSPACE; @@ -202,10 +202,10 @@ void render_view_open(bContext *C, int mx, int my) } } } - sima= sa->spacedata.first; + sima = sa->spacedata.first; /* get the correct image, and scale it */ - sima->image= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"); + sima->image = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"); /* if we're rendering to full screen, set appropriate hints on image editor @@ -229,9 +229,9 @@ void render_view_open(bContext *C, int mx, int my) static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op)) { - wmWindow *win= CTX_wm_window(C); - ScrArea *sa= CTX_wm_area(C); - SpaceImage *sima= sa->spacedata.first; + wmWindow *win = CTX_wm_window(C); + ScrArea *sa = CTX_wm_area(C); + SpaceImage *sima = sa->spacedata.first; /* test if we have a temp screen in front */ if (CTX_wm_window(C)->screen->temp) { @@ -284,11 +284,11 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent } else { wmWindow *win, *winshow; - ScrArea *sa= find_area_showing_r_result(C, &winshow); + ScrArea *sa = find_area_showing_r_result(C, &winshow); /* is there another window showing result? */ - for (win= CTX_wm_manager(C)->windows.first; win; win= win->next) { - if (win->screen->temp || (win==winshow && winshow!=wincur)) { + for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) { + if (win->screen->temp || (win == winshow && winshow != wincur)) { wm_window_raise(win); return OPERATOR_FINISHED; } @@ -298,7 +298,7 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent if (sa) { /* but don't close it when rendering */ if (!G.rendering) { - SpaceImage *sima= sa->spacedata.first; + SpaceImage *sima = sa->spacedata.first; if (sima->flag & SI_PREVSPACE) { sima->flag &= ~SI_PREVSPACE; -- cgit v1.2.3