From e38f4d2f1a2211ed03ac6418c460931194fa2870 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 13 Feb 2017 18:16:22 +0000 Subject: Get render bitmap size via function --- frontends/amiga/corewindow.c | 6 ++++-- frontends/amiga/gui.c | 6 ++++-- frontends/amiga/plotters.c | 6 ++++++ frontends/amiga/plotters.h | 8 ++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index e6293453c..5fc5c3736 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -219,8 +219,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r) struct IBox *bbox; ULONG pos_x, pos_y; struct rect draw_rect; - int tile_size_x = ami_cw->gg->width; - int tile_size_y = ami_cw->gg->height; + int tile_size_x; + int tile_size_y; int tile_x, tile_y, tile_w, tile_h; int x = r->x0; int y = r->y0; @@ -254,6 +254,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r) y = pos_y; } + ami_plot_ra_get_size(ami_cw->gg, &tile_size_x, &tile_size_y); + for(tile_y = y; tile_y < (y + height); tile_y += tile_size_y) { tile_h = tile_size_y; if(((y + height) - tile_y) < tile_size_y) diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 973f4e787..a8a1265d9 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -3524,8 +3524,10 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy, struct gui_globals *glob = (struct gui_globals *)ctx->priv; int x, y; struct rect clip; - int tile_size_x = glob->width; - int tile_size_y = glob->height; + int tile_size_x; + int tile_size_y; + + ami_plot_ra_get_size(glob, &tile_size_x, &tile_size_y); int tile_x_scale = (int)(tile_size_x / gwin->gw->scale); int tile_y_scale = (int)(tile_size_y / gwin->gw->scale); diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index e70a9a998..0f00bc415 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -265,6 +265,12 @@ struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg) return gg->bm; } +void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height) +{ + *width = gg->width; + *height = gg->height; +} + void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list) { gg->shared_pens = pen_list; diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h index 4d2dc660c..ed89916e7 100644 --- a/frontends/amiga/plotters.h +++ b/frontends/amiga/plotters.h @@ -76,6 +76,14 @@ void ami_plot_ra_free(struct gui_globals *gg); */ struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg); +/** + * Get size of BitMap associated with a render area + * \param gg render area + * \param width updated to BitMap width + * \param height updated to BitMap height + */ +void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height); + /** * Set a list of shared pens for a render area to use * Only relevant for palette-mapped screens -- cgit v1.2.3