diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2017-02-13 18:09:43 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2017-02-13 18:09:43 +0000 |
commit | 593ec1fbeab32d598bc4cc5de42bb0887ad0d520 (patch) | |
tree | d7f95372c4caf1a860d414a67bb8fb78a6df0820 /frontends/amiga/plotters.c | |
parent | 075e9c0258bd75307a90b3e6bd576742bf212b08 (diff) | |
download | netsurf-593ec1fbeab32d598bc4cc5de42bb0887ad0d520.tar.gz netsurf-593ec1fbeab32d598bc4cc5de42bb0887ad0d520.tar.bz2 |
Manage shared pens internally unless we need multiple lists (eg. per browser_window)
Diffstat (limited to 'frontends/amiga/plotters.c')
-rw-r--r-- | frontends/amiga/plotters.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index 1911b7d17..e70a9a998 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -102,7 +102,7 @@ static bool palette_mapped = true; /* palette-mapped state for the screen */ /* Define the below to get additional debug */ #undef AMI_PLOTTER_DEBUG -struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit) +struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list) { /* init shared bitmaps */ int depth = 32; @@ -201,15 +201,24 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height); - if((gg->palette_mapped == true) && (pool_pens == NULL)) { - pool_pens = ami_memory_itempool_create(sizeof(struct ami_plot_pen)); + gg->shared_pens = NULL; + gg->managed_pen_list = false; + + if(gg->palette_mapped == true) { + if(pool_pens == NULL) { + pool_pens = ami_memory_itempool_create(sizeof(struct ami_plot_pen)); + } + + if(alloc_pen_list == true) { + gg->shared_pens = ami_AllocMinList(); + gg->managed_pen_list = true; + } } gg->apen = 0x00000000; gg->open = 0x00000000; gg->apen_num = -1; gg->open_num = -1; - gg->shared_pens = NULL; init_layers_count++; LOG("Layer initialised (total: %d)", init_layers_count); @@ -242,6 +251,12 @@ void ami_plot_ra_free(struct gui_globals *gg) if(gg->bm) FreeBitMap(gg->bm); } + if(gg->managed_pen_list == true) { + ami_plot_release_pens(gg->shared_pens); + free(gg->shared_pens); + gg->shared_pens = NULL; + } + free(gg); } @@ -250,6 +265,11 @@ struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg) return gg->bm; } +void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list) +{ + gg->shared_pens = pen_list; +} + void ami_clearclipreg(struct gui_globals *gg) { struct Region *reg = NULL; @@ -261,6 +281,11 @@ void ami_clearclipreg(struct gui_globals *gg) gg->rect.MinY = 0; gg->rect.MaxX = scrn->Width-1; gg->rect.MaxY = scrn->Height-1; + + gg->apen = 0x00000000; + gg->open = 0x00000000; + gg->apen_num = -1; + gg->open_num = -1; } static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr) |