diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2015-02-02 18:10:43 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2015-02-02 18:10:43 +0000 |
commit | 7d41e04b61162d3cb1f0032100d29ef7897b2d83 (patch) | |
tree | 5587b322d516c96049105e923be95fbfa9a663e3 | |
parent | 54a966f6ff1b2d09d3db94560b67a2343e8684e1 (diff) | |
download | netsurf-7d41e04b61162d3cb1f0032100d29ef7897b2d83.tar.gz netsurf-7d41e04b61162d3cb1f0032100d29ef7897b2d83.tar.bz2 |
We don't need to use P96 for RectFill
-rw-r--r-- | amiga/gui.c | 14 | ||||
-rw-r--r--[-rwxr-xr-x] | amiga/plotters.c | 46 | ||||
-rw-r--r--[-rwxr-xr-x] | amiga/plotters.h | 22 | ||||
-rw-r--r-- | amiga/rtg.c | 11 | ||||
-rw-r--r-- | amiga/rtg.h | 4 |
5 files changed, 36 insertions, 61 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index 3ec33f6e7..52fb0ffa8 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -142,7 +142,6 @@ #include "amiga/plotters.h" #include "amiga/plugin_hack.h" #include "amiga/print.h" -#include "amiga/rtg.h" #include "amiga/schedule.h" #include "amiga/search.h" #include "amiga/theme.h" @@ -2873,21 +2872,18 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw) RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL], gwin->win, NULL, STRINGA_TextVal, "", TAG_DONE); - ami_rtg_rectfill(gwin->win->RPort, bbox->Left, bbox->Top, - bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff); - + ami_plot_clear_bbox(gwin->win->RPort, bbox); ami_gui_free_space_box(bbox); return; } - ami_plot_release_pens(&gwin->shared_pens); + ami_plot_release_pens(&browserglob.shared_pens); ami_update_buttons(gwin); ami_menu_update_disabled(gwin->gw, browser_window_get_content(gwin->gw->bw)); if(redraw) { - ami_rtg_rectfill(gwin->win->RPort, bbox->Left, bbox->Top, - bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff); + ami_plot_clear_bbox(gwin->win->RPort, bbox); browser_window_update(gwin->gw->bw, false); gui_window_set_scroll(gwin->gw, @@ -4197,7 +4193,7 @@ static void gui_window_destroy(struct gui_window *g) return; } - ami_plot_release_pens(&g->shared->shared_pens); + ami_plot_release_pens(&browserglob.shared_pens); ami_schedule_redraw_remove(g->shared); ami_schedule(-1, ami_gui_refresh_favicon, g->shared); @@ -5076,7 +5072,7 @@ static void gui_window_new_content(struct gui_window *g) g->shared->oldh = 0; g->shared->oldv = 0; g->favicon = NULL; - ami_plot_release_pens(&g->shared->shared_pens); + ami_plot_release_pens(&browserglob.shared_pens); ami_menu_update_disabled(g, c); ami_gui_update_hotlist_button(g->shared); ami_gui_scroller_update(g->shared); diff --git a/amiga/plotters.c b/amiga/plotters.c index 88021ee29..81bee058a 100755..100644 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -89,20 +89,6 @@ bool palette_mapped = false; /* Define the below to get additional debug */ #undef AMI_PLOTTER_DEBUG -struct plotter_table plot; -const struct plotter_table amiplot = { - .rectangle = ami_rectangle, - .line = ami_line, - .polygon = ami_polygon, - .clip = ami_clip, - .text = ami_text, - .disc = ami_disc, - .arc = ami_arc, - .bitmap = ami_bitmap_tile, - .path = ami_path, - .option_knockout = true, -}; - void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) { /* init shared bitmaps * @@ -243,13 +229,14 @@ void ami_plot_release_pens(struct MinList *shared_pens) static void ami_plot_setapen(ULONG colr) { - if(palette_mapped == false) { #ifdef __amigaos4__ + if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_APenColor, ns_color_to_nscss(colr), TAG_DONE); + } else #endif - } else { + { LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr); if(pen != -1) SetAPen(glob->rp, pen); } @@ -257,18 +244,27 @@ static void ami_plot_setapen(ULONG colr) static void ami_plot_setopen(ULONG colr) { - if(palette_mapped == false) { #ifdef __amigaos4__ + if(palette_mapped == false) { SetRPAttrs(glob->rp, RPTAG_OPenColor, ns_color_to_nscss(colr), TAG_DONE); + } else #endif - } else { + { LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr); if(pen != -1) SetOPen(glob->rp, pen); } } +void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox) +{ + ami_plot_setapen(0xffffffff); + RectFill(rp, bbox->Left, bbox->Top, + bbox->Width+bbox->Left, bbox->Height+bbox->Top); +} + + bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style) { #ifdef AMI_PLOTTER_DEBUG @@ -864,3 +860,17 @@ bool ami_plot_screen_is_palettemapped(void) return palette_mapped; } +struct plotter_table plot; +const struct plotter_table amiplot = { + .rectangle = ami_rectangle, + .line = ami_line, + .polygon = ami_polygon, + .clip = ami_clip, + .text = ami_text, + .disc = ami_disc, + .arc = ami_arc, + .bitmap = ami_bitmap_tile, + .path = ami_path, + .option_knockout = true, +}; + diff --git a/amiga/plotters.h b/amiga/plotters.h index 501698a41..a6087d1e1 100755..100644 --- a/amiga/plotters.h +++ b/amiga/plotters.h @@ -30,33 +30,15 @@ struct gui_globals APTR areabuf; APTR tmprasbuf; struct Rectangle rect; - struct MinList *shared_pens; + struct MinList *shared_pens; /**\todo move this to gui_window_2 */ }; extern const struct plotter_table amiplot; -bool ami_clg(colour c); -bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style); -bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style); -bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style); -bool ami_clip(const struct rect *clip); -bool ami_text(int x, int y, const char *text, size_t length, - const plot_font_style_t *fstyle); -bool ami_disc(int x, int y, int radius, const plot_style_t *style); -bool ami_arc(int x, int y, int radius, int angle1, int angle2, - const plot_style_t *style); -bool ami_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bitmap_flags_t flags); -bool ami_group_start(const char *name); -bool ami_group_end(void); -bool ami_flush(void); -bool ami_path(const float *p, unsigned int n, colour fill, float width, - colour c, const float transform[6]); - void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height); void ami_free_layers(struct gui_globals *gg); void ami_clearclipreg(struct gui_globals *gg); +void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox); void ami_plot_release_pens(struct MinList *shared_pens); bool ami_plot_screen_is_palettemapped(void); diff --git a/amiga/rtg.c b/amiga/rtg.c index 267bd5d05..2f4b9e1d1 100644 --- a/amiga/rtg.c +++ b/amiga/rtg.c @@ -44,17 +44,6 @@ void ami_rtg_freebitmap(struct BitMap *bm) } } -void ami_rtg_rectfill(struct RastPort *rp, UWORD min_x, UWORD min_y, - UWORD max_x, UWORD max_y, ULONG colour) -{ - if(P96Base == NULL) { - SetAPen(rp, 2); /* white */ - return RectFill(rp, min_x, min_y, max_x, max_y); - } else { - return p96RectFill(rp, min_x, min_y, max_x, max_y, colour); - } -} - void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm, ULONG width, ULONG height, ULONG bpr, ULONG format) { diff --git a/amiga/rtg.h b/amiga/rtg.h index 9d9e9a41f..72f5bf38b 100644 --- a/amiga/rtg.h +++ b/amiga/rtg.h @@ -25,12 +25,10 @@ #include <proto/graphics.h> #include <proto/Picasso96API.h> -/* Wrappers for Alloc/FreeBitMap and RectFill */ +/* Wrappers for Alloc/FreeBitMap */ struct BitMap *ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth, ULONG flags, struct BitMap *friend, RGBFTYPE format); void ami_rtg_freebitmap(struct BitMap *bm); -void ami_rtg_rectfill(struct RastPort *rp, UWORD min_x, UWORD min_y, - UWORD max_x, UWORD max_y, ULONG colour); /* WritePixelArray wrapper. This isn't entirely (at all) equivalent to p96WPA */ void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm, |