Remove branches that can't be taken under OS3

Micro-optimise these for OS4.1
Remove dummy compositing defines from os3support.h
This commit is contained in:
Chris Young 2015-03-01 11:48:21 +00:00
parent c0c9f54a9c
commit db91442304
5 changed files with 18 additions and 40 deletions

View File

@ -367,7 +367,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
return bm; return bm;
} }
static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm) static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm)
{ {
struct BitMap *tbm = NULL; struct BitMap *tbm = NULL;
@ -414,10 +414,9 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
scaledbm = ami_rtg_allocbitmap(width, height, 32, 0, scaledbm = ami_rtg_allocbitmap(width, height, 32, 0,
friendbm, AMI_BITMAP_FORMAT); friendbm, AMI_BITMAP_FORMAT);
if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
{
#ifdef __amigaos4__ #ifdef __amigaos4__
if(__builtin_expect(GfxBase->LibNode.lib_Version >= 53, 1)) {
/* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1) */
uint32 flags = 0; uint32 flags = 0;
if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter; if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
@ -433,9 +432,8 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
COMPTAG_OffsetY,0, COMPTAG_OffsetY,0,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap, COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE); TAG_DONE);
} else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */
#endif #endif
}
else /* Do it the old-fashioned way. This is pretty slow, even on OS4.1 */
{ {
bsa.bsa_SrcX = 0; bsa.bsa_SrcX = 0;
bsa.bsa_SrcY = 0; bsa.bsa_SrcY = 0;
@ -500,7 +498,7 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
return bitmap->native_mask; return bitmap->native_mask;
} }
static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap, static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
int width, int height) int width, int height)
{ {
struct BitMap *dtbm; struct BitMap *dtbm;
@ -547,7 +545,7 @@ static struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap, struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm) int width, int height, struct BitMap *friendbm)
{ {
if(ami_plot_screen_is_palettemapped() == true) { if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height); return ami_bitmap_get_palettemapped(bitmap, width, height);
} else { } else {
return ami_bitmap_get_truecolour(bitmap, width, height, friendbm); return ami_bitmap_get_truecolour(bitmap, width, height, friendbm);

View File

@ -189,25 +189,6 @@ struct OutlineFont {
struct TagItem *olf_OTagList; struct TagItem *olf_OTagList;
}; };
/* Compositing */
#define COMPFLAG_IgnoreDestAlpha 0
#define COMPFLAG_SrcAlphaOverride 0
#define COMPFLAG_SrcFilter 0
#define COMPOSITE_Src 0
#define COMPTAG_ScaleX 0
#define COMPTAG_ScaleY 0
#define COMPTAG_DestX 0
#define COMPTAG_DestY 0
#define COMPTAG_DestWidth 0
#define COMPTAG_DestHeight 0
#define COMPTAG_OffsetX 0
#define COMPTAG_OffsetY 0
#define CompositeTags(a, ...) ((void) (a))
#define COMP_FLOAT_TO_FIX(f) (f)
/* icon.library v51 (ie. AfA_OS version) */ /* icon.library v51 (ie. AfA_OS version) */
#define ICONCTRLA_SetImageDataFormat (ICONA_Dummy + 0x67) /*103*/ #define ICONCTRLA_SetImageDataFormat (ICONA_Dummy + 0x67) /*103*/
#define ICONCTRLA_GetImageDataFormat (ICONA_Dummy + 0x68) /*104*/ #define ICONCTRLA_GetImageDataFormat (ICONA_Dummy + 0x68) /*104*/

View File

@ -501,10 +501,9 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
LOG(("[ami_plotter] ami_bitmap() got native bitmap")); LOG(("[ami_plotter] ami_bitmap() got native bitmap"));
#endif #endif
if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false) &&
(nsoption_bool(direct_render) == false))
{
#ifdef __amigaos4__ #ifdef __amigaos4__
if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false) &&
(nsoption_bool(direct_render) == false), 1)) {
uint32 comptype = COMPOSITE_Src_Over_Dest; uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha; uint32 compflags = COMPFLAG_IgnoreDestAlpha;
if(bitmap_get_opaque(bitmap)) { if(bitmap_get_opaque(bitmap)) {
@ -524,9 +523,9 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
COMPTAG_OffsetY,y, COMPTAG_OffsetY,y,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap, COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE); TAG_DONE);
#endif
} }
else else
#endif
{ {
ULONG tag, tag_data, minterm = 0xc0; ULONG tag, tag_data, minterm = 0xc0;
@ -710,10 +709,9 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba
/* tile down and across to extents (bfmsg->Bounds.MinX)*/ /* tile down and across to extents (bfmsg->Bounds.MinX)*/
for (xf = -bfbm->offsetx; xf < bfmsg->Bounds.MaxX; xf += bfbm->width) { for (xf = -bfbm->offsetx; xf < bfmsg->Bounds.MaxX; xf += bfbm->width) {
for (yf = -bfbm->offsety; yf < bfmsg->Bounds.MaxY; yf += bfbm->height) { for (yf = -bfbm->offsety; yf < bfmsg->Bounds.MaxY; yf += bfbm->height) {
if((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false))
{
#ifdef __amigaos4__ #ifdef __amigaos4__
if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
(palette_mapped == false), 1)) {
CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap, CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap,
COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha, COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
COMPTAG_DestX,bfmsg->Bounds.MinX, COMPTAG_DestX,bfmsg->Bounds.MinX,
@ -726,9 +724,9 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba
COMPTAG_OffsetY,yf, COMPTAG_OffsetY,yf,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap, COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE); TAG_DONE);
#endif
} }
else else
#endif
{ {
ULONG tag, tag_data, minterm = 0xc0; ULONG tag, tag_data, minterm = 0xc0;

View File

@ -70,8 +70,9 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
thumbnail_redraw(content, plot_width, plot_height, &ctx); thumbnail_redraw(content, plot_width, plot_height, &ctx);
if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1) #ifdef __amigaos4__
{ if(__builtin_expect(GfxBase->LibNode.lib_Version >= 53, 1)) {
/* AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1) */
float resample_scale = bitmap->width / (float)plot_width; float resample_scale = bitmap->width / (float)plot_width;
uint32 flags = COMPFLAG_IgnoreDestAlpha; uint32 flags = COMPFLAG_IgnoreDestAlpha;
if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter; if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
@ -90,8 +91,8 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
COMPTAG_OffsetY,0, COMPTAG_OffsetY,0,
COMPTAG_FriendBitMap, scrn->RastPort.BitMap, COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE); TAG_DONE);
} } else
else #endif
{ {
bsa.bsa_SrcX = 0; bsa.bsa_SrcX = 0;
bsa.bsa_SrcY = 0; bsa.bsa_SrcY = 0;