Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_image/space_image.c
| Show First 20 Lines • Show All 822 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| SpaceImage *sima = CTX_wm_space_image(C); | SpaceImage *sima = CTX_wm_space_image(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| void *lock; | void *lock; | ||||
| ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); | ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); | ||||
| if (ibuf) { | if (ibuf) { | ||||
| if (!sima->scopes.ok) { | if (!sima->scopes.ok) { | ||||
| BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings); | BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings); | ||||
| } | } | ||||
brecht: I guess we'll have to live with that loose coupling, I don't think it's so bad.
The other… | |||||
| if (sima->image->flag & IMA_VIEW_AS_RENDER) | if (sima->image->flag & IMA_VIEW_AS_RENDER) | ||||
| scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings); | scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings); | ||||
| else | else | ||||
| scopes_update(&sima->scopes, ibuf, NULL, &scene->display_settings); | scopes_update(&sima->scopes, ibuf, NULL, &scene->display_settings); | ||||
| } | } | ||||
| ED_space_image_release_buffer(sima, ibuf, lock); | ED_space_image_release_buffer(sima, ibuf, lock); | ||||
| ED_region_panels(C, ar, 1, NULL, -1); | ED_region_panels(C, ar, 1, NULL, -1); | ||||
| ▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | void ED_spacetype_image(void) | ||||
| art->regionid = RGN_TYPE_UI; | art->regionid = RGN_TYPE_UI; | ||||
| art->prefsizex = 220; // XXX | art->prefsizex = 220; // XXX | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | ||||
| art->listener = image_buttons_area_listener; | art->listener = image_buttons_area_listener; | ||||
| art->init = image_buttons_area_init; | art->init = image_buttons_area_init; | ||||
| art->draw = image_buttons_area_draw; | art->draw = image_buttons_area_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| image_buttons_register(art); | |||||
| ED_uvedit_buttons_register(art); | ED_uvedit_buttons_register(art); | ||||
| /* regions: statistics/scope buttons */ | /* regions: statistics/scope buttons */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); | ||||
| art->regionid = RGN_TYPE_PREVIEW; | art->regionid = RGN_TYPE_PREVIEW; | ||||
| art->prefsizex = 220; // XXX | art->prefsizex = 220; // XXX | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; | ||||
| art->listener = image_scope_area_listener; | art->listener = image_scope_area_listener; | ||||
| art->init = image_scope_area_init; | art->init = image_scope_area_init; | ||||
| art->draw = image_scope_area_draw; | art->draw = image_scope_area_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| image_buttons_register(art); | |||||
| /* regions: header */ | /* regions: header */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); | ||||
| art->regionid = RGN_TYPE_HEADER; | art->regionid = RGN_TYPE_HEADER; | ||||
| art->prefsizey = HEADERY; | art->prefsizey = HEADERY; | ||||
| art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; | art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; | ||||
| art->listener = image_header_area_listener; | art->listener = image_header_area_listener; | ||||
| art->init = image_header_area_init; | art->init = image_header_area_init; | ||||
| art->draw = image_header_area_draw; | art->draw = image_header_area_draw; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| BKE_spacetype_register(st); | BKE_spacetype_register(st); | ||||
| } | } | ||||
I guess we'll have to live with that loose coupling, I don't think it's so bad.
The other solution would be to compute the scopes just in time before drawing, but I don't like that much either, since ideally the scopes should be computed as part of the dependency graph somehow for better threading.