|
From: <cad...@li...> - 2005-11-28 09:15:43
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml"> <head><style type=3D"text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: = #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li { font-family: verdana,arial,helvetica= ,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; fo= nt-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padd= ing: 6px; } #msg ul, pre { overflow: auto; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt= ;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:aut= o;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patc= h .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 = 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 = 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[286] kos-ports/libparallax/src/font.c: KOS: libparallax: Apply Ji= m Ursetto's patch for antialiased fonts</title> </head> <body> <div id=3D"msg"> <dl> <dt>Revision</dt> <dd>286</dd> <dt>Author</dt> <dd>sam.steele</dd> <dt>Date</dt> <dd>2005-11-28 01:07:26 -0800 (Mon, 28 Nov 2005)</dd> </dl> <h3>Log Message</h3> <pre>KOS: libparallax: Apply Jim Ursetto's patch for antialiased fonts</p= re> <h3>Modified Paths</h3> <ul> <li><a href=3D"#kosportslibparallaxsrcfontc">kos-ports/libparallax/src/fo= nt.c</a></li> </ul> </div> <div id=3D"patch"> <h3>Diff</h3> <a id=3D"kosportslibparallaxsrcfontc"></a> <div class=3D"modfile"><h4>Modified: kos-ports/libparallax/src/font.c (28= 5 =3D> 286)</h4> <pre class=3D"diff"> <span class=3D"info">--- kos-ports/libparallax/src/font.c 2005-11-27 23:0= 9:06 UTC (rev 285) +++ kos-ports/libparallax/src/font.c 2005-11-28 09:07:26 UTC (rev 286) </span><span class=3D"lines">@@ -135,7 +135,7 @@ </span><span class=3D"cx"> hdr.max_ascent, hdr.max_descent, hdr.glyph_c= nt); */ </span><span class=3D"cx">=20 </span><span class=3D"cx"> /* Make sure we can allocate texture space fo= r it */ </span><del>- fnt->txr =3D plx_txr_canvas(hdr.txr_width, hdr.txr_heigh= t, PVR_TXRFMT_ARGB1555); </del><ins>+ fnt->txr =3D plx_txr_canvas(hdr.txr_width, hdr.txr_height= , PVR_TXRFMT_ARGB4444); </ins><span class=3D"cx"> if (fnt->txr =3D=3D NULL) { </span><span class=3D"cx"> dbglog(DBG_WARNING, "plx_font_load: can= 't allocate texture for '%s'\n", fn); </span><span class=3D"cx"> goto fail_2; /* bail */ </span><span class=3D"lines">@@ -249,16 +249,15 @@ </span><span class=3D"cx"> goto fail_4; /* bail */ </span><span class=3D"cx"> } </span><span class=3D"cx">=20 </span><del>- /* Convert to ARGB1555 -- go backwards so we can do it in = place */ - /* XXX Technically we should probably switch to ARGB4444 here */ </del><ins>+ /* Convert to ARGB4444 -- go backwards so we can do it in p= lace */ + /* PLIB seems to duplicate the alpha value into luminance. I think it + * looks nicer to hardcode luminance to 1.0; characters look more robu= st. */ </ins><span class=3D"cx"> bmtmp =3D (uint8 *)txrtmp; </span><span class=3D"cx"> for (x=3Dbmsize-1; x>=3D0; x--) { </span><del>- if (bmtmp[x] =3D=3D 0) - txrtmp[x] =3D 0x0000; - else { - int c =3D ((int)bmtmp[x]) >> 3; - txrtmp[x] =3D 0x8000 | (c << 10) | (c << 5) | (c <<= ; 0); - } </del><ins>+ uint8 alpha =3D (bmtmp[x] & 0xF0) >> 4; + /* uint8 lum =3D alpha; */ + uint8 lum =3D 0x0f; + txrtmp[x] =3D (alpha << 12) | (lum << 8) | (lum << = 4) | (lum << 0); </ins><span class=3D"cx"> } </span><span class=3D"cx"> bmtmp =3D NULL; </span><span class=3D"cx">=20 </span></pre> </div> </div> </body> </html> |