diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-30 08:31:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-30 08:31:55 +0300 |
commit | cfd36476a194724962d9ff162acca5552363500f (patch) | |
tree | 8701e9bbc3319a057cea1379456517f5303ab752 /source | |
parent | d59721e47aba4c9db96cfe5b10c63969ff361897 (diff) |
Cleanup: use const for screen functions
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_screen.h | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 32 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 5 |
3 files changed, 20 insertions, 19 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 441a9bdb1c1..79b1751fcb9 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -57,7 +57,7 @@ void ED_region_set(const struct bContext *C, struct ARegion *ar); void ED_region_update_rect(struct bContext *C, struct ARegion *ar); void ED_region_init(struct bContext *C, struct ARegion *ar); void ED_region_tag_redraw(struct ARegion *ar); -void ED_region_tag_redraw_partial(struct ARegion *ar, struct rcti *rct); +void ED_region_tag_redraw_partial(struct ARegion *ar, const struct rcti *rct); void ED_region_tag_redraw_overlay(struct ARegion *ar); void ED_region_tag_refresh_ui(struct ARegion *ar); void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7fe6518134e..42adcc2df93 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -75,7 +75,7 @@ extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, /* general area and region code */ -static void region_draw_emboss(ARegion *ar, rcti *scirct) +static void region_draw_emboss(const ARegion *ar, const rcti *scirct) { rcti rect; @@ -572,7 +572,7 @@ void ED_region_tag_refresh_ui(ARegion *ar) } } -void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct) +void ED_region_tag_redraw_partial(ARegion *ar, const rcti *rct) { if (ar && !(ar->do_draw & RGN_DRAWING)) { if (!(ar->do_draw & RGN_DRAW)) { @@ -981,7 +981,7 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, const int alignment, cons } /* dir is direction to check, not the splitting edge direction! */ -static int rct_fits(rcti *rect, char dir, int size) +static int rct_fits(const rcti *rect, char dir, int size) { if (dir == 'h') { return BLI_rcti_size_x(rect) + 1 - size; @@ -2094,7 +2094,7 @@ BLI_INLINE bool metadata_is_valid(ImBuf *ibuf, char *r_str, short index, int off return (IMB_metadata_get_field(ibuf, meta_data_list[index], r_str + offset, MAX_METADATA_STR - offset) && r_str[0]); } -static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool is_top) +static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const bool is_top) { char temp_str[MAX_METADATA_STR]; int line_width; @@ -2111,8 +2111,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool i bool do_newline = false; len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[0]); if (metadata_is_valid(ibuf, temp_str, 0, len)) { - BLF_position(fontid, rect.xmin + (0.2f * U.widget_unit), - rect.ymax - vertical_offset, 0.0f); + BLF_position(fontid, rect->xmin + (0.2f * U.widget_unit), + rect->ymax - vertical_offset, 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); do_newline = true; } @@ -2120,8 +2120,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool i len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[1]); if (metadata_is_valid(ibuf, temp_str, 1, len)) { line_width = BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); - BLF_position(fontid, rect.xmax - line_width - (0.2f * U.widget_unit), - rect.ymax - vertical_offset, 0.0f); + BLF_position(fontid, rect->xmax - line_width - (0.2f * U.widget_unit), + rect->ymax - vertical_offset, 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); do_newline = true; } @@ -2132,8 +2132,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool i else if (i == 1) { len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]); if (metadata_is_valid(ibuf, temp_str, i + 1, len)) { - BLF_position(fontid, rect.xmin + (0.2f * U.widget_unit), - rect.ymax - vertical_offset - ofs_y, 0.0f); + BLF_position(fontid, rect->xmin + (0.2f * U.widget_unit), + rect->ymax - vertical_offset - ofs_y, 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_y += vertical_offset; } @@ -2142,8 +2142,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool i len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]); if (metadata_is_valid(ibuf, temp_str, i + 1, len)) { line_width = BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); - BLF_position(fontid, rect.xmax - line_width - (0.2f * U.widget_unit), - rect.ymax - vertical_offset - ofs_y, 0.0f); + BLF_position(fontid, rect->xmax - line_width - (0.2f * U.widget_unit), + rect->ymax - vertical_offset - ofs_y, 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_y += vertical_offset; } @@ -2155,8 +2155,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool i for (i = 5; i < 10; i++) { len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i]); if (metadata_is_valid(ibuf, temp_str, i, len)) { - BLF_position(fontid, rect.xmin + (0.2f * U.widget_unit) + ofs_x, - rect.ymin + (0.3f * U.widget_unit), 0.0f); + BLF_position(fontid, rect->xmin + (0.2f * U.widget_unit) + ofs_x, + rect->ymin + (0.3f * U.widget_unit), 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_x += BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX) + UI_UNIT_X; @@ -2233,7 +2233,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, rctf frame, float BLF_enable(blf_mono_font, BLF_CLIPPING); UI_ThemeColor(TH_METADATA_TEXT); - metadata_draw_imbuf(ibuf, rect, blf_mono_font, true); + metadata_draw_imbuf(ibuf, &rect, blf_mono_font, true); BLF_disable(blf_mono_font, BLF_CLIPPING); } @@ -2255,7 +2255,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, rctf frame, float BLF_enable(blf_mono_font, BLF_CLIPPING); UI_ThemeColor(TH_METADATA_TEXT); - metadata_draw_imbuf(ibuf, rect, blf_mono_font, false); + metadata_draw_imbuf(ibuf, &rect, blf_mono_font, false); BLF_disable(blf_mono_font, BLF_CLIPPING); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e5c3cb4e5e2..571dab6a65e 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -728,7 +728,8 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - AZone *az = is_in_area_actionzone(CTX_wm_area(C), &event->x); + ScrArea *sa = CTX_wm_area(C); + AZone *az = is_in_area_actionzone(sa, &event->x); sActionzoneData *sad; /* quick escape */ @@ -737,7 +738,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* ok we do the actionzone */ sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData"); - sad->sa1 = CTX_wm_area(C); + sad->sa1 = sa; sad->az = az; sad->x = event->x; sad->y = event->y; |