[prev in list] [next in list] [prev in thread] [next in thread]
List: xine-cvslog
Subject: [xine-cvs] CVS: xine-lib/src/xine-engine osd.c,1.68,1.69
From: Stefan Holst <holstsn () users ! sourceforge ! net>
Date: 2005-01-27 22:32:27
Message-ID: E1CuIBf-00034o-MB () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/xine/xine-lib/src/xine-engine
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11803
Modified Files:
osd.c
Log Message:
fixed and faster clipping for texts, correct height for ft2 fonts. thanks to Andreas \
Roever
Index: osd.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/xine-engine/osd.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- osd.c 22 Jan 2005 23:29:06 -0000 1.68
+++ osd.c 27 Jan 2005 22:32:24 -0000 1.69
@@ -206,6 +206,10 @@
osd->y1 = osd->height;
if(osd->y2 > osd->height)
osd->y2 = osd->height;
+ if(osd->x1 < 0) osd->x1 = 0;
+ if(osd->x2 < 0) osd->x2 = 0;
+ if(osd->y1 < 0) osd->y1 = 0;
+ if(osd->y2 < 0) osd->y2 = 0;
#ifdef DEBUG_RLE
lprintf("osd_show %p rle starts\n", osd);
@@ -1043,7 +1047,6 @@
#ifdef HAVE_FT2
if (osd->ft2 && osd->ft2->useme) {
- int gheight, gwidth;
FT_GlyphSlot slot = osd->ft2->face->glyph;
@@ -1067,37 +1070,43 @@
xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("osd: error in rendering \
glyph\n")); }
- /* we shift the whole glyph down by it's ascender so that the specified \
coordinate
- * is the top left corner which is much more practical than the baseline as \
the user
- * normally has no idea where the baseline is
+ /* if the first letter has a bearing not on the basepoint shift, the
+ * whole output to be sure that we are inside the bounding box
*/
- dst = osd->area + (y1+(osd->ft2->face->ascender/64)-slot->bitmap_top) * \
osd->width;
- src = (uint8_t*) slot->bitmap.buffer;
- gheight = slot->bitmap.rows;
- gwidth = slot->bitmap.width;
-
if (first) x1 -= slot->bitmap_left;
first = 0;
- for( y = 0; y < gheight; y++ ) {
+ /* we shift the whole glyph down by it's ascender so that the specified
+ * coordinate is the top left corner which is much more practical than
+ * the baseline as the user normally has no idea where the baseline is
+ */
+ dst = osd->area + (y1 + osd->ft2->face->size->metrics.ascender/64 - \
slot->bitmap_top) * osd->width; + src = (uint8_t*) slot->bitmap.buffer;
+
+ for (y = 0; y < slot->bitmap.rows; y++) {
uint8_t *s = src;
uint8_t *d = dst + x1 + slot->bitmap_left;
- while (s < src + gwidth) {
- if ((d > osd->area) && (d < osd->area + osd->width * osd->height) &&
- (d < dst + osd->width) && (*s > 0))
- *d = (uint8_t)(*s/25) + (uint8_t) color_base;
-
- d++;
- s++;
- }
+ if (d >= osd->area + osd->width*osd->height)
+ break;
+
+ if (dst > osd->area)
+ while (s < src + slot->bitmap.width) {
+ if ((d >= dst) && (d < dst + osd->width) && *s)
+ *d = (uint8_t)(*s/25) + (uint8_t) color_base;
+
+ d++;
+ s++;
+ }
+
src += slot->bitmap.pitch;
dst += osd->width;
+
}
- x1 += slot->advance.x >> 6;
+ x1 += slot->advance.x / 64;
if( x1 > osd->x2 ) osd->x2 = x1;
- if( y1 > osd->y2 ) osd->y2 = y1;
+ if( y1 + osd->ft2->face->size->metrics.height/64 > osd->y2 ) osd->y2 = y1 + \
osd->ft2->face->size->metrics.height/64;
} else {
@@ -1110,21 +1119,24 @@
font->fontchar[i].height, x1, y1);
if ( i != font->num_fontchars ) {
- dst = osd->area + y1 * osd->width + x1;
+ dst = osd->area + y1 * osd->width;
src = font->fontchar[i].bmp;
for( y = 0; y < font->fontchar[i].height; y++ ) {
- int width = font->fontchar[i].width;
- uint8_t *s = src, *d = dst;
-
- while (s < src + width) {
- if(d <= (osd->area + (osd->width * osd->height))
- && *s > 1) /* skip drawing transparency */
- *d = *s + (uint8_t) color_base;
-
- d++;
- s++;
- }
+ uint8_t *s = src;
+ uint8_t *d = dst + x1;
+
+ if (d >= osd->area + osd->width*osd->height)
+ break;
+
+ if (dst >= osd->area)
+ while (s < src + font->fontchar[i].width) {
+ if((d >= dst) && (d < dst + osd->width) && (*s > 1)) /* skip drawing \
transparency */ + *d = *s + (uint8_t) color_base;
+
+ d++;
+ s++;
+ }
src += font->fontchar[i].width;
dst += osd->width;
}
@@ -1229,10 +1241,7 @@
*/
if (first_glyph) *width -= slot->bitmap_left;
first_glyph = 0;
- *width += slot->advance.x >> 6;
- /* we return the height of the font for the height, so we are on the save side
- */
- *height = osd->ft2->face->height >> 6;
+ *width += slot->advance.x / 64;
text++;
} else {
#endif
@@ -1258,9 +1267,10 @@
* to also add the left bearing because the letter might be shifted left or
* right and then the right edge is also shifted
*/
- *width -= osd->ft2->face->glyph->advance.x >> 6;
+ *width -= osd->ft2->face->glyph->advance.x / 64;
*width += osd->ft2->face->glyph->bitmap.width;
*width += osd->ft2->face->glyph->bitmap_left;
+ *height = osd->ft2->face->size->metrics.height / 64;
}
#endif
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic