Skip setting the pen in the RastPort if it is already set to that pen

This captures the scenario when the RGBA value has changed but graphics.library has picked the same pen.
This commit is contained in:
Chris Young 2016-03-23 23:18:05 +00:00
parent 0368935cd3
commit 281fe7674c
2 changed files with 8 additions and 2 deletions

View File

@ -190,6 +190,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->apen = 0x00000000;
gg->open = 0x00000000;
gg->apen_num = -1;
gg->open_num = -1;
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
@ -275,6 +277,8 @@ void ami_plot_release_pens(struct MinList *shared_pens)
glob->apen = 0x00000000;
glob->open = 0x00000000;
glob->apen_num = -1;
glob->open_num = -1;
}
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
@ -290,7 +294,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
#endif
{
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetAPen(rp, pen);
if((pen != -1) && (pen != glob->apen_num)) SetAPen(rp, pen);
}
glob->apen = colr;
@ -309,7 +313,7 @@ static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
#endif
{
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetOPen(rp, pen);
if((pen != -1) && (pen != glob->open_num)) SetOPen(rp, pen);
}
glob->open = colr;

View File

@ -36,6 +36,8 @@ struct gui_globals
bool palette_mapped;
ULONG apen;
ULONG open;
LONG apen_num;
LONG open_num;
int width; /* size of bm and */
int height; /* associated memory */
};