Commit 6f18addb authored by Pierre Ynard's avatar Pierre Ynard

win32text: add multiline support

parent 797d3efe
/***************************************************************************** /*****************************************************************************
* win32text.c : Text drawing routines using the TextOut win32 API * win32text.c : Text drawing routines using the TextOut win32 API
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 - 2005 the VideoLAN team * Copyright (C) 2002 - 2009 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* Pierre Ynard
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -302,8 +303,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -302,8 +303,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
int i, i_width, i_height; int i, i_width, i_height;
HBITMAP bitmap, bitmap_bak; HBITMAP bitmap, bitmap_bak;
BITMAPINFO *p_bmi; BITMAPINFO *p_bmi;
RECT rect = {0}; RECT rect = { 0, 0, 0, 0 };
SIZE size;
/* Sanity check */ /* Sanity check */
if( !p_region_in || !p_region_out ) return VLC_EGENERIC; if( !p_region_in || !p_region_out ) return VLC_EGENERIC;
...@@ -344,8 +344,9 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -344,8 +344,9 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
SetTextColor( p_sys->hcdc, RGB( (i_font_color >> 16) & 0xff, SetTextColor( p_sys->hcdc, RGB( (i_font_color >> 16) & 0xff,
(i_font_color >> 8) & 0xff, i_font_color & 0xff) ); (i_font_color >> 8) & 0xff, i_font_color & 0xff) );
GetTextExtentPoint( p_sys->hcdc, psz_string, _tcslen(psz_string), &size ); DrawText( p_sys->hcdc, psz_string, -1, &rect,
i_width = rect.right = size.cx; i_height = rect.bottom = size.cy; DT_CALCRECT | DT_CENTER | DT_NOPREFIX );
i_width = rect.right; i_height = rect.bottom;
p_bmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*16); p_bmi = malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*16);
memset( p_bmi, 0, sizeof(BITMAPINFOHEADER) ); memset( p_bmi, 0, sizeof(BITMAPINFOHEADER) );
...@@ -376,8 +377,8 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -376,8 +377,8 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
bitmap_bak = SelectObject( p_sys->hcdc, bitmap ); bitmap_bak = SelectObject( p_sys->hcdc, bitmap );
FillRect( p_sys->hcdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) ); FillRect( p_sys->hcdc, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH) );
//TextOut( p_sys->hcdc, 0, 0, psz_string, strlen(psz_string) ); if( !DrawText( p_sys->hcdc, psz_string, -1, &rect,
if( !DrawText( p_sys->hcdc, psz_string, -1, &rect, 0 ) ) DT_CENTER | DT_NOPREFIX ) )
{ {
msg_Err( p_filter, "could not draw text" ); msg_Err( p_filter, "could not draw text" );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment