We don't need to use P96 for RectFill

This commit is contained in:
Chris Young 2015-02-02 18:10:43 +00:00
parent 54a966f6ff
commit 7d41e04b61
5 changed files with 36 additions and 61 deletions

View File

@ -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);

46
amiga/plotters.c Executable file → Normal file
View File

@ -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,
};

22
amiga/plotters.h Executable file → Normal file
View File

@ -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);

View File

@ -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)
{

View File

@ -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,