summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-01-07 19:29:04 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-01-07 19:29:04 +0000
commitf5118786c393f756d25801c82f073641253bfe03 (patch)
treee95f38608d413f278c5262dbb621dd7219b676fd
parent40331b1675a2e13965d3c59fcc158f2131c2dea3 (diff)
downloadnetsurf-chris/composite-text.tar.gz
Convert AlphaTemplate to a BitMap and then compositechris/composite-text
-rwxr-xr-xamiga/font.c66
1 files changed, 51 insertions, 15 deletions
diff --git a/amiga/font.c b/amiga/font.c
index a692c0d40..2ce453140 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -72,7 +72,7 @@ struct ami_font_node
char *italic;
char *bolditalic;
struct TimeVal lastused;
- struct SplayTree *glyph_cache;
+ //struct SplayTree *glyph_cache;
};
const uint16 sc_table[] = {
@@ -584,9 +584,45 @@ struct ami_font_node *ami_open_outline_font(const plot_font_style_t *fstyle,
return NULL;
}
-struct BitMap *ami_font_get_glyph(struct ami_font_node *afn, uint16 *char, bool aa)
+struct BitMap *ami_font_free_glyph(struct BitMap *glyphbm)
{
+ p96FreeBitMap(glyphbm);
+}
+
+struct BitMap *ami_font_get_glyph(struct ami_font_node *afn, struct GlyphMap *glyph, bool aa)
+{
+ UBYTE *glyphbm;
+ struct BitMap *glyph_bitmap;
+ ULONG glyphmaptag = OT_GlyphMap8Bit;
+ ULONG template_type = BLITT_ALPHATEMPLATE;
+ struct OutlineFont *ofont = afn->font;
+ if(aa == false) {
+ glyphmaptag = OT_GlyphMap;
+ template_type = BLITT_TEMPLATE;
+ }
+
+ glyphbm = glyph->glm_BitMap;
+ if(!glyphbm) return NULL;
+
+ glyph_bitmap = p96AllocBitMap(glyph->glm_BlackWidth,
+ glyph->glm_BlackHeight, 8, BMF_DISPLAYABLE,
+ NULL, RGBFB_ALPHA8);
+
+ BltBitMapTags(BLITA_SrcX, glyph->glm_BlackLeft,
+ BLITA_SrcY, glyph->glm_BlackTop,
+ BLITA_DestX, 0,
+ BLITA_DestY, 0,
+ BLITA_Width, glyph->glm_BlackWidth,
+ BLITA_Height, glyph->glm_BlackHeight,
+ BLITA_Source, glyphbm,
+ BLITA_SrcType, template_type,
+ BLITA_Dest, glyph_bitmap,
+ BLITA_DestType, BLITT_BITMAP,
+ BLITA_SrcBytesPerRow, glyph->glm_BMModulo,
+ TAG_DONE);
+
+ return glyph_bitmap;
}
@@ -594,7 +630,7 @@ int32 ami_font_plot_glyph(struct ami_font_node *afn, struct RastPort *rp,
uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa)
{
struct GlyphMap *glyph;
- UBYTE *glyphbm;
+ struct BitMap *glyphbm;
int32 char_advance = 0;
FIXED kern = 0;
ULONG glyphmaptag = OT_GlyphMap8Bit;
@@ -625,8 +661,7 @@ int32 ami_font_plot_glyph(struct ami_font_node *afn, struct RastPort *rp,
glyphmaptag, &glyph,
TAG_END) == 0)
{
- glyphbm = glyph->glm_BitMap;
- if(!glyphbm) return 0;
+ glyphbm = ami_font_get_glyph(afn, glyph, aa);
if(rp) {
if((GfxBase->LibNode.lib_Version >= 53) &&
@@ -635,12 +670,12 @@ int32 ami_font_plot_glyph(struct ami_font_node *afn, struct RastPort *rp,
CompositeTags(COMPOSITE_Src_Over_Dest, COMPSRC_SOLIDCOLOR, rp->BitMap,
COMPTAG_Color0, 0xff000000, /* assume black for now */
COMPTAG_SrcAlphaMask, glyphbm,
- COMPTAG_SrcX, glyph->glm_BlackLeft,
- COMPTAG_SrcY, glyph->glm_BlackTop,
+ COMPTAG_SrcX, 0,
+ COMPTAG_SrcY, 0,
COMPTAG_SrcWidth, glyph->glm_BlackWidth,
COMPTAG_SrcHeight, glyph->glm_BlackHeight,
- COMPTAG_OffsetX, x - glyph->glm_X0 + glyph->glm_BlackLeft,
- COMPTAG_OffsetY, y - glyph->glm_Y0 + glyph->glm_BlackTop,
+ COMPTAG_OffsetX, x - glyph->glm_X0,
+ COMPTAG_OffsetY, y - glyph->glm_Y0,
COMPTAG_DestX, glob->rect.MinX,
COMPTAG_DestY, glob->rect.MinY,
COMPTAG_DestWidth, glob->rect.MaxX - glob->rect.MinX + 1,
@@ -648,17 +683,17 @@ int32 ami_font_plot_glyph(struct ami_font_node *afn, struct RastPort *rp,
COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
TAG_DONE);
} else {
- BltBitMapTags(BLITA_SrcX, glyph->glm_BlackLeft,
- BLITA_SrcY, glyph->glm_BlackTop,
- BLITA_DestX, x - glyph->glm_X0 + glyph->glm_BlackLeft,
- BLITA_DestY, y - glyph->glm_Y0 + glyph->glm_BlackTop,
+ BltBitMapTags(BLITA_SrcX, 0,
+ BLITA_SrcY, 0,
+ BLITA_DestX, x - glyph->glm_X0,
+ BLITA_DestY, y - glyph->glm_Y0,
BLITA_Width, glyph->glm_BlackWidth,
BLITA_Height, glyph->glm_BlackHeight,
BLITA_Source, glyphbm,
- BLITA_SrcType, template_type,
+ BLITA_SrcType, BLITT_BITMAP,
BLITA_Dest, rp,
BLITA_DestType, BLITT_RASTPORT,
- BLITA_SrcBytesPerRow, glyph->glm_BMModulo,
+ BLITA_UseSrcAlpha, TRUE,
TAG_DONE);
}
}
@@ -671,6 +706,7 @@ int32 ami_font_plot_glyph(struct ami_font_node *afn, struct RastPort *rp,
char_advance = (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
+ ami_font_free_glyph(glyphbm);
EReleaseInfo(&ofont->olf_EEngine,
glyphmaptag, glyph,
TAG_END);