diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-04-18 06:03:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-04-18 06:03:19 +0400 |
commit | dfe2f8dc03267e041102837e92f547fb04881510 (patch) | |
tree | d9582c4667ce5b9e39e2adce40832aa4f44b4fe7 /source/blender/editors/space_image/image_ops.c | |
parent | d7e08f2d33207fdf76b1b597ef0de9dec26e3987 (diff) | |
parent | 00e46ef739cf2bfddb8805af056aa59fd3b3c71c (diff) |
Merged changes in the trunk up to revision 28247.
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c9daeb09f25..f74dc30d567 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -134,7 +134,6 @@ static int space_image_file_exists_poll(bContext *C) return 0; } - int space_image_main_area_poll(bContext *C) { SpaceImage *sima= CTX_wm_space_image(C); @@ -177,7 +176,7 @@ static void view_pan_exit(bContext *C, wmOperator *op, int cancel) if(cancel) { sima->xof= vpd->xof; sima->yof= vpd->yof; - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); } WM_cursor_restore(CTX_wm_window(C)); @@ -193,7 +192,7 @@ static int view_pan_exec(bContext *C, wmOperator *op) sima->xof += offset[0]; sima->yof += offset[1]; - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); /* XXX notifier? */ #if 0 @@ -309,7 +308,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel) if(cancel) { sima->zoom= vpd->zoom; - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); } WM_cursor_restore(CTX_wm_window(C)); @@ -323,7 +322,7 @@ static int view_zoom_exec(bContext *C, wmOperator *op) sima_zoom_set_factor(sima, ar, RNA_float_get(op->ptr, "factor")); - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); /* XXX notifier? */ #if 0 @@ -347,7 +346,7 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) factor= 1.0 + (event->x-event->prevx+event->y-event->prevy)/300.0f; RNA_float_set(op->ptr, "factor", factor); sima_zoom_set(sima, ar, sima->zoom*factor); - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } @@ -369,7 +368,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) factor= 1.0 + (vpd->x-event->x+vpd->y-event->y)/300.0f; RNA_float_set(op->ptr, "factor", factor); sima_zoom_set(sima, ar, vpd->zoom*factor); - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); break; case MIDDLEMOUSE: case LEFTMOUSE: @@ -452,7 +451,7 @@ static int view_all_exec(bContext *C, wmOperator *op) sima->xof= sima->yof= 0.0f; - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } @@ -504,11 +503,16 @@ static int view_selected_exec(bContext *C, wmOperator *op) if(size<=0.01) size= 0.01; sima_zoom_set(sima, ar, 0.7/size); - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } +static int view_selected_poll(bContext *C) +{ + return (space_image_main_area_poll(C) && ED_operator_uvedit(C)); +} + void IMAGE_OT_view_selected(wmOperatorType *ot) { /* identifiers */ @@ -517,7 +521,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) /* api callbacks */ ot->exec= view_selected_exec; - ot->poll= ED_operator_uvedit; + ot->poll= view_selected_poll; } /********************** view zoom in/out operator *********************/ @@ -529,7 +533,7 @@ static int view_zoom_in_exec(bContext *C, wmOperator *op) sima_zoom_set_factor(sima, ar, 1.25f); - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } @@ -552,7 +556,7 @@ static int view_zoom_out_exec(bContext *C, wmOperator *op) sima_zoom_set_factor(sima, ar, 0.8f); - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } @@ -590,7 +594,7 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op) } #endif - ED_area_tag_redraw(CTX_wm_area(C)); + ED_region_tag_redraw(CTX_wm_region(C)); return OPERATOR_FINISHED; } @@ -1688,16 +1692,17 @@ static int sample_line_exec(bContext *C, wmOperator *op) hist->data_r[i] = fp[0]; hist->data_g[i] = fp[1]; hist->data_b[i] = fp[2]; + hist->data_luma[i] = (0.299f*fp[0] + 0.587f*fp[1] + 0.114f*fp[2]); } else if (ibuf->rect) { cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x); hist->data_r[i] = (float)cp[0]/255.0f; hist->data_g[i] = (float)cp[1]/255.0f; hist->data_b[i] = (float)cp[2]/255.0f; + hist->data_luma[i] = (0.299f*cp[0] + 0.587f*cp[1] + 0.114f*cp[2])/255; } } } - hist->ok=1; ED_space_image_release_buffer(sima, lock); |