diff options
author | phintuka <phintuka> | 2010-05-30 22:18:32 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2010-05-30 22:18:32 +0000 |
commit | 0a58e3d6b6cf2872c368ee4f59b0577372c5eef1 (patch) | |
tree | e304457cc7f87035f706edaf42ac231627c1dbc7 | |
parent | 917e8a7e88b252eafca6030136966e52363dbacb (diff) | |
download | xineliboutput-0a58e3d6b6cf2872c368ee4f59b0577372c5eef1.tar.gz xineliboutput-0a58e3d6b6cf2872c368ee4f59b0577372c5eef1.tar.bz2 |
hud_osd_command(OSD_Set_RLE): factorized calculating coordinates and scaling factor
(Thanks to grueni75, patch #2978033)
-rw-r--r-- | xine_sxfe_frontend.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c index 23acb08f..48efc577 100644 --- a/xine_sxfe_frontend.c +++ b/xine_sxfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_sxfe_frontend.c,v 1.124 2010-05-30 22:05:31 phintuka Exp $ + * $Id: xine_sxfe_frontend.c,v 1.125 2010-05-30 22:18:32 phintuka Exp $ * */ @@ -648,6 +648,7 @@ static void hud_fill_img_memory(uint32_t* dst, const struct osd_command_s *cmd) static int hud_osd_command(frontend_t *this_gen, struct osd_command_s *cmd) { sxfe_t *this = (sxfe_t*)this_gen; + if(this && this->hud && cmd) { XLockDisplay(this->display); switch(cmd->cmd) { @@ -666,35 +667,35 @@ static int hud_osd_command(frontend_t *this_gen, struct osd_command_s *cmd) XFlush(this->display); break; - case OSD_Set_RLE: /* Create/update OSD window. Data is rle-compressed. */ + case OSD_Set_RLE: { /* Create/update OSD window. Data is rle-compressed. */ LOGDBG("HUD Set RLE"); + if (!(cmd->flags & OSDFLAG_TOP_LAYER)) break; + + XDouble scale_x = (XDouble)this->x.width / (XDouble)this->osd_width; + XDouble scale_y = (XDouble)this->x.height / (XDouble)this->osd_height; + int x = cmd->x + cmd->dirty_area.x1; + int y = cmd->y + cmd->dirty_area.y1; + int w = cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1; + int h = cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1; + #ifdef HAVE_XSHM if(this->completion_event != -1) { hud_fill_img_memory((uint32_t*)(this->hud_img->data), cmd); if(!cmd->scaling) { /* Place image directly onto hud window */ XShmPutImage(this->display, this->hud_window, this->gc, this->hud_img, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1, - cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1, + x, y, x, y, w, h, False); } else { /* Place image onto Xrender surface which will be blended onto hud window */ XShmPutImage(this->display, this->surf_img->draw, this->gc, this->hud_img, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1, - cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1, + x, y, x, y, w, h, False); xrender_surf_blend(this->display, this->surf_img, this->surf_win, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1, - cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1, - (XDouble)this->x.width / (XDouble)this->osd_width, - (XDouble)this->x.height / (XDouble)this->osd_height, + x, y, w, h, + scale_x, scale_y, (cmd->scaling & 2)); // Note: HUD_SCALING_BILINEAR=2 } } @@ -705,23 +706,14 @@ static int hud_osd_command(frontend_t *this_gen, struct osd_command_s *cmd) if(!cmd->scaling) { /* Place image directly onto hud window (always unscaled) */ XPutImage(this->display, this->hud_window, this->gc, this->hud_img, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1, - cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1); + x, y, x, y, w, h); } else { /* Place image onto Xrender surface which will be blended onto hud window */ XPutImage(this->display, this->surf_img->draw, this->gc, this->hud_img, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1, - cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1); + x, y, x, y, w, h); xrender_surf_blend(this->display, this->surf_img, this->surf_win, - cmd->x + cmd->dirty_area.x1, cmd->y + cmd->dirty_area.y1, - cmd->dirty_area.x2 - cmd->dirty_area.x1 + 1, - cmd->dirty_area.y2 - cmd->dirty_area.y1 + 1, - (XDouble)this->x.width / (XDouble)this->osd_width, - (XDouble)this->x.height / (XDouble)this->osd_height, + x, y, w, h, + scale_x, scale_y, (cmd->scaling & 2)); // Note: HUD_SCALING_BILINEAR=2 } } |