summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-02-11 16:42:40 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-02-11 16:42:40 +0000
commit39c0fe482390f6657913635f344267e63cbf9005 (patch)
treefa90cad12fda2f9d509d2ea9d686e9e515cb419a /src
parent507fb444aeef4a7c863b7099661ccbb5d2ea4dd3 (diff)
downloadxine-lib-39c0fe482390f6657913635f344267e63cbf9005.tar.gz
xine-lib-39c0fe482390f6657913635f344267e63cbf9005.tar.bz2
add osd function to draw bitmaps (patch by Julio Sánchez <j.sanchezf@terra.es>)
CVS patchset: 4135 CVS date: 2003/02/11 16:42:40
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/osd.c33
-rw-r--r--src/xine-engine/osd.h9
-rw-r--r--src/xine-engine/xine_interface.c8
3 files changed, 48 insertions, 2 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index 87f040d81..54f95617b 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -815,6 +815,38 @@ static void update_text_palette(void *this_gen, xine_cfg_entry_t *entry)
printf("osd: text palette will be %s\n", textpalettes_str[this->textpalette] );
}
+static void osd_draw_bitmap(osd_object_t *osd, uint8_t *bitmap,
+ int x1, int y1, int width, int height,
+ uint8_t *palette_map)
+{
+ int y, x;
+
+#ifdef LOG_DEBUG
+ printf("osd_draw_bitmap %p at (%d,%d) %dx%d\n",osd, x1,y1, width,height );
+#endif
+
+ /* update clipping area */
+ osd->x1 = MIN( osd->x1, x1 );
+ osd->x2 = MAX( osd->x2, x1+width );
+ osd->y1 = MIN( osd->y1, y1 );
+ osd->y2 = MAX( osd->y2, y1+height );
+
+ for( y=0; y<height; y++ ) {
+ if ( palette_map ) {
+ int src_offset = y * width;
+ int dst_offset = (y1+y) * osd->width + x1;
+ /* Slow copy with palette translation, the map describes how to
+ convert color indexes in the source bitmap to indexes in the
+ osd palette */
+ for ( x=0; x<width; x++ ) {
+ osd->area[dst_offset+x] = palette_map[bitmap[src_offset+x]];
+ }
+ } else {
+ /* Fast copy with direct mapping */
+ memcpy(osd->area + (y1+y) * osd->width + x1, bitmap + y * width, width);
+ }
+ }
+}
/*
* initialize the osd rendering engine
@@ -870,6 +902,7 @@ osd_renderer_t *osd_renderer_init( video_overlay_instance_t *video_overlay, conf
this->render_text = osd_render_text;
this->get_text_size = osd_get_text_size;
this->close = osd_renderer_close;
+ this->draw_bitmap = osd_draw_bitmap;
return this;
}
diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h
index 26b53bdad..a3e40f821 100644
--- a/src/xine-engine/osd.h
+++ b/src/xine-engine/osd.h
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* OSD stuff (text and graphic primitives)
- * $Id: osd.h,v 1.11 2002/11/20 18:41:14 mroi Exp $
+ * $Id: osd.h,v 1.12 2003/02/11 16:42:42 miguelfreitas Exp $
*/
#ifndef HAVE_OSD_H
@@ -167,6 +167,13 @@ struct osd_renderer_s {
*/
void (*clear) (osd_object_t *osd );
+ /*
+ * paste a bitmap with optional palette mapping
+ */
+ void (*draw_bitmap) (osd_object_t *osd, uint8_t *bitmap,
+ int x1, int y1, int width, int height,
+ uint8_t *palette_map);
+
/* private stuff */
pthread_mutex_t osd_mutex;
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index ecce238b0..0dbabd2c9 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_interface.c,v 1.39 2003/02/06 10:59:02 miguelfreitas Exp $
+ * $Id: xine_interface.c,v 1.40 2003/02/11 16:42:43 miguelfreitas Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -567,6 +567,12 @@ void xine_osd_get_palette(xine_osd_t *this, uint32_t *color, uint8_t *trans) {
this->osd.renderer->get_palette(&this->osd, color, trans);
}
+void xine_osd_draw_bitmap(xine_osd_t *this, uint8_t *bitmap,
+ int x1, int y1, int width, int height,
+ uint8_t *palette_map) {
+ this->osd.renderer->draw_bitmap(&this->osd, bitmap, x1, y1, width, height, palette_map);
+}
+
const char *const *xine_post_list_inputs(xine_post_t *this_gen) {
post_plugin_t *this = (post_plugin_t *)this_gen;
return this->input_ids;