Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_image/space_image.c')
-rw-r--r--source/blender/editors/space_image/space_image.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 0eb377450e9..0b8a2d8f843 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -45,7 +45,6 @@
#include "BKE_image.h"
#include "BKE_mesh.h"
#include "BKE_screen.h"
-#include "BKE_utildefines.h"
#include "IMB_imbuf_types.h"
@@ -55,7 +54,6 @@
#include "ED_uvedit.h"
#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "RNA_access.h"
@@ -98,6 +96,7 @@ void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obe
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
ED_area_tag_redraw(CTX_wm_area(C));
+
}
}
@@ -176,6 +175,12 @@ void ED_space_image_size(SpaceImage *sima, int *width, int *height)
/* not very important, just nice */
*width= (scene->r.xsch*scene->r.size)/100;
*height= (scene->r.ysch*scene->r.size)/100;
+
+ if((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
+ *width *= (scene->r.border.xmax - scene->r.border.xmin);
+ *height *= (scene->r.border.ymax - scene->r.border.ymin);
+ }
+
}
/* I know a bit weak... but preview uses not actual image size */
// XXX else if(image_preview_active(sima, width, height));
@@ -289,21 +294,21 @@ int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit)
}
-
-static void image_histogram_tag_refresh(ScrArea *sa)
+static void image_scopes_tag_refresh(ScrArea *sa)
{
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
ARegion *ar;
-
+
/* only while histogram is visible */
for (ar=sa->regionbase.first; ar; ar=ar->next) {
if (ar->regiontype == RGN_TYPE_PREVIEW && ar->flag & RGN_FLAG_HIDDEN)
return;
}
-
- sima->hist.ok=0;
+
+ sima->scopes.ok=0;
}
+
/* ******************** manage regions ********************* */
ARegion *image_has_buttons_region(ScrArea *sa)
@@ -356,8 +361,8 @@ ARegion *image_has_scope_region(ScrArea *sa)
arnew->alignment= RGN_ALIGN_RIGHT;
arnew->flag = RGN_FLAG_HIDDEN;
-
- image_histogram_tag_refresh(sa);
+
+ image_scopes_tag_refresh(sa);
return arnew;
}
@@ -377,6 +382,8 @@ static SpaceLink *image_new(const bContext *C)
simage->iuser.ok= 1;
simage->iuser.fie_ima= 2;
simage->iuser.frames= 100;
+
+ scopes_new(&simage->scopes);
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for image");
@@ -400,7 +407,7 @@ static SpaceLink *image_new(const bContext *C)
ar->regiontype= RGN_TYPE_PREVIEW;
ar->alignment= RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for image");
@@ -417,9 +424,7 @@ static void image_free(SpaceLink *sl)
if(simage->cumap)
curvemapping_free(simage->cumap);
-// if(simage->gpd)
-// XXX free_gpencil_data(simage->gpd);
-
+ scopes_free(&simage->scopes);
}
@@ -524,7 +529,7 @@ void image_keymap(struct wmKeyConfig *keyconf)
static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
{
if(drag->type==WM_DRAG_PATH)
- if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
+ if(ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
@@ -532,7 +537,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
static void image_drop_copy(wmDrag *drag, wmDropBox *drop)
{
/* copy drag path to properties */
- RNA_string_set(drop->ptr, "path", drag->path);
+ RNA_string_set(drop->ptr, "filepath", drag->path);
}
/* area+region dropbox definition */
@@ -590,7 +595,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
case NC_SCENE:
switch(wmn->data) {
case ND_FRAME:
- image_histogram_tag_refresh(sa);
+ image_scopes_tag_refresh(sa);
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
break;
@@ -598,7 +603,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
case ND_RENDER_RESULT:
case ND_COMPO_RESULT:
if (ED_space_image_show_render(sima))
- image_histogram_tag_refresh(sa);
+ image_scopes_tag_refresh(sa);
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
break;
@@ -606,14 +611,14 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_IMAGE:
if (wmn->reference == sima->image || !wmn->reference) {
- image_histogram_tag_refresh(sa);
+ image_scopes_tag_refresh(sa);
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
}
break;
case NC_SPACE:
if(wmn->data == ND_SPACE_IMAGE) {
- image_histogram_tag_refresh(sa);
+ image_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
}
break;
@@ -768,8 +773,6 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
/* draw Grease Pencil - screen space only */
draw_image_grease_pencil((bContext *)C, 0);
-
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
/* scrollers? */
/*scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
@@ -837,10 +840,12 @@ static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
static void image_scope_area_draw(const bContext *C, ARegion *ar)
{
SpaceImage *sima= CTX_wm_space_image(C);
+ Scene *scene= CTX_data_scene(C);
void *lock;
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
- if(ibuf)
- histogram_update(&sima->hist, ibuf);
+ if(ibuf) {
+ scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT );
+ }
ED_space_image_release_buffer(sima, lock);
ED_region_panels(C, ar, 1, NULL, -1);