- int i_code = 0x00;
- int i_next = 0;
- int i_id = 0;
- int i_color;
-
- /* FIXME: we need a way to get this information from the stream */
- #define TARGET_WIDTH 720
- #define TARGET_HEIGHT 576
- int i_x_scale = ( p_buffer->i_pic_width << 6 ) / TARGET_WIDTH;
- int i_y_scale = ( p_buffer->i_pic_height << 6 ) / TARGET_HEIGHT;
-
- /* FIXME: fake palette - the real one has to be sought in the .IFO */
- static int p_palette[4] = { 0x0000, 0x0000, 0x5555, 0xffff };
-
- boolean_t b_aligned = 1;
- byte_t *p_from[2];
- vout_spu_t vspu;
-
- p_from[1] = p_subpic->p_data + p_subpic->type.spu.i_offset[1];
- p_from[0] = p_subpic->p_data + p_subpic->type.spu.i_offset[0];
-
- vspu.i_x = 0;
- vspu.i_y = 0;
- vspu.i_width = TARGET_WIDTH;
- vspu.i_height = TARGET_HEIGHT;
- vspu.p_data = p_buffer->p_data
- /* add the picture coordinates and the SPU coordinates */
- + ( p_buffer->i_pic_x + ((p_subpic->i_x * i_x_scale) >> 6))
- * i_bytes_per_pixel
- + ( p_buffer->i_pic_y + ((p_subpic->i_y * i_y_scale) >> 6))
- * i_bytes_per_line;
-
- while( p_from[0] < (byte_t *)p_subpic->p_data
- + p_subpic->type.spu.i_offset[1] )
+ int i_len, i_color;
+ u16 *p_source = (u16 *)p_spu->p_data;
+
+ int i_xscale = ( p_buffer->i_pic_width << 6 ) / p_pic->i_width;
+ int i_yscale = ( p_buffer->i_pic_height << 6 ) / p_pic->i_height;
+
+ int i_width = p_spu->i_width * i_xscale;
+ int i_height = p_spu->i_height * i_yscale;
+
+ int i_x, i_y, i_ytmp, i_yreal, i_ynext;
+
+ u8 *p_dest = p_buffer->p_data + ( i_width >> 6 ) * i_bytes_per_pixel
+ /* Add the picture coordinates and the SPU coordinates */
+ + ( p_buffer->i_pic_x + ((p_spu->i_x * i_xscale) >> 6))
+ * i_bytes_per_pixel
+ + ( p_buffer->i_pic_y + ((p_spu->i_y * i_yscale) >> 6))
+ * i_bytes_per_line;
+
+ /* Draw until we reach the bottom of the subtitle */
+ i_y = 0;
+
+ while( i_y < i_height )