From 61979923c146b4456d24e794a44c08adc334cff6 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 3 Jul 2016 17:23:24 +0100 Subject: Use functions for determining throbber bitmap size --- frontends/amiga/gui.c | 4 ++-- frontends/amiga/theme.c | 34 ++++++++++++++++++++++------------ frontends/amiga/theme.h | 6 +++--- 3 files changed, 27 insertions(+), 17 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 36918a934..3eafa5952 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -4228,8 +4228,8 @@ gui_window_create(struct browser_window *bw, CHILD_WeightedWidth, nsoption_int(web_search_width), LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObj, GA_ID,GID_THROBBER, - SPACE_MinWidth,throbber_width, - SPACE_MinHeight,throbber_height, + SPACE_MinWidth, ami_theme_throbber_get_width(), + SPACE_MinHeight, ami_theme_throbber_get_height(), SPACE_Transparent,TRUE, // SPACE_RenderHook, &g->shared->throbber_hook, SpaceEnd, diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c index d87bae308..4042d1dd0 100644 --- a/frontends/amiga/theme.c +++ b/frontends/amiga/theme.c @@ -51,9 +51,6 @@ #include "amiga/theme.h" #include "amiga/misc.h" -ULONG throbber_width; -ULONG throbber_height; - static struct BitMap *throbber = NULL; static struct bitmap *throbber_nsbm = NULL; static int throbber_frames, throbber_update_interval; @@ -161,6 +158,16 @@ void ami_theme_init(void) } } +int ami_theme_throbber_get_width(void) +{ + return bitmap_get_width(throbber_nsbm) / throbber_frames; +} + +int ami_theme_throbber_get_height(void) +{ + return bitmap_get_height(throbber_nsbm); +} + void ami_theme_throbber_setup(void) { char throbberfile[1024]; @@ -174,8 +181,6 @@ void ami_theme_throbber_setup(void) bm = ami_bitmap_from_datatype(throbberfile); throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm), NULL); - throbber_width = bitmap_get_width(bm) / throbber_frames; - throbber_height = bitmap_get_height(bm); throbber_nsbm = bm; } @@ -456,8 +461,10 @@ void gui_window_stop_throbber(struct gui_window *g) } if(throbber != NULL) { - BltBitMapRastPort(throbber, 0, 0, g->shared->win->RPort, bbox->Left, - bbox->Top, throbber_width, throbber_height, 0x0C0); + BltBitMapRastPort(throbber, 0, 0, g->shared->win->RPort, + bbox->Left, bbox->Top, + ami_theme_throbber_get_width(), ami_theme_throbber_get_height(), + 0x0C0); } ami_gui_free_space_box(bbox); } @@ -490,12 +497,12 @@ static void ami_throbber_update(void *p) if(throbber != NULL) { #ifdef __amigaos4__ - BltBitMapTags(BLITA_SrcX, throbber_width * frame, + BltBitMapTags(BLITA_SrcX, ami_theme_throbber_get_width() * frame, BLITA_SrcY, 0, BLITA_DestX, bbox->Left, BLITA_DestY, bbox->Top, - BLITA_Width, throbber_width, - BLITA_Height, throbber_height, + BLITA_Width, ami_theme_throbber_get_width(), + BLITA_Height, ami_theme_throbber_get_height(), BLITA_Source, throbber, BLITA_Dest, g->shared->win->RPort, BLITA_SrcType, BLITT_BITMAP, @@ -503,8 +510,11 @@ static void ami_throbber_update(void *p) // BLITA_UseSrcAlpha, TRUE, TAG_DONE); #else - BltBitMapRastPort(throbber, throbber_width * frame, 0, g->shared->win->RPort, - bbox->Left, bbox->Top, throbber_width, throbber_height, 0xC0); + BltBitMapRastPort(throbber, ami_theme_throbber_get_width() * frame, + 0, g->shared->win->RPort, + bbox->Left, bbox->Top, + ami_theme_throbber_get_width(), ami_theme_throbber_get_height(), + 0xC0); #endif } ami_gui_free_space_box(bbox); diff --git a/frontends/amiga/theme.h b/frontends/amiga/theme.h index bf6ba57f7..6de7bc150 100644 --- a/frontends/amiga/theme.h +++ b/frontends/amiga/theme.h @@ -28,12 +28,12 @@ struct gui_window; #define AMI_GUI_POINTER_DRAG GUI_POINTER_PROGRESS+2 #define AMI_LASTPOINTER AMI_GUI_POINTER_DRAG -extern ULONG throbber_width; -extern ULONG throbber_height; - void ami_theme_init(void); void ami_get_theme_filename(char *filename, const char *themestring, bool protocol); +int ami_theme_throbber_get_width(void); +int ami_theme_throbber_get_height(void); + void ami_theme_throbber_setup(void); void ami_theme_throbber_free(void); void ami_update_throbber(struct gui_window_2 *g,bool redraw); -- cgit v1.2.3