From 827e4397df72b503ed402f3c94d72d25adbba489 Mon Sep 17 00:00:00 2001
From: Marten Richter <marten.richter@freenet.de>
Date: Sun, 30 Jun 2013 09:40:55 +0200
Subject: [PATCH] Fix symbol and font gradients

---
 colour.cc    | 20 ++++++++++++++++++--
 osdopenvg.cc | 14 ++++++++++++--
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/colour.cc b/colour.cc
index b4083e6..e062148 100644
--- a/colour.cc
+++ b/colour.cc
@@ -148,7 +148,7 @@ Real colours
 
 	DrawStyle::DARKGREY=DrawStyle(50, 50, 50);
 	DrawStyle::DARKGREY.grad_col[0]=Colour(100, 100, 100);
-	DrawStyle::DARKGREY.grad_col[1]=Colour(50, 50, 50);
+	DrawStyle::DARKGREY.grad_col[1]=Colour(80, 80, 80);
 	DrawStyle::DARKGREY.grad_pos[0]=0.5;
 	DrawStyle::DARKGREY.num_colors=2;
 	DrawStyle::DARKGREY.ft=DrawStyle::GradientLinear;
@@ -192,8 +192,24 @@ Real colours
 	DrawStyle::SELECTHIGHLIGHT.y2=1.0;
 
 
-	DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(120, 125, 40);
+	DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(60, 65, 20);
+	DrawStyle::SELECTDARKHIGHLIGHT.grad_col[0]=DrawStyle(120, 125, 40);
+	DrawStyle::SELECTDARKHIGHLIGHT.num_colors=1;
+	DrawStyle::SELECTDARKHIGHLIGHT.ft=DrawStyle::GradientLinear;
+	DrawStyle::SELECTDARKHIGHLIGHT.x1=0.0;
+	DrawStyle::SELECTDARKHIGHLIGHT.y1=0.0;
+	DrawStyle::SELECTDARKHIGHLIGHT.x2=0.0;
+	DrawStyle::SELECTDARKHIGHLIGHT.y2=1.0;
+
 	DrawStyle::LIGHTTEXT=DrawStyle(255, 255, 255);
+	DrawStyle::LIGHTTEXT.grad_col[0]=DrawStyle(150, 150, 150);
+	DrawStyle::LIGHTTEXT.num_colors=1;
+	DrawStyle::LIGHTTEXT.ft=DrawStyle::GradientLinear;
+	DrawStyle::LIGHTTEXT.x1=0.0;
+	DrawStyle::LIGHTTEXT.y1=0.0;
+	DrawStyle::LIGHTTEXT.x2=0.0;
+	DrawStyle::LIGHTTEXT.y2=1.0;
+
 	DrawStyle::DARKTEXT=DrawStyle(0, 0, 100);
 	DrawStyle::DANGER=DrawStyle(200, 0, 0);
 
diff --git a/osdopenvg.cc b/osdopenvg.cc
index 740272b..d11c0d9 100644
--- a/osdopenvg.cc
+++ b/osdopenvg.cc
@@ -845,7 +845,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command)
 			vgScale(aspect_correction,1.f);
 			vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
 		    vgGetMatrix(save_matrix2);
-		    vgScale(0.2f,0.2f);
+		    vgScale(imagewidth,imageheight);
 		} else {
 
 			//vgScale(720.f/((float)BACKBUFFER_WIDTH), 576.f/((float)BACKBUFFER_HEIGHT));
@@ -881,15 +881,25 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command)
 		vgSetPaint((VGPaint) command.reference,VG_FILL_PATH);
 		vgSetPaint((VGPaint) command.reference,VG_STROKE_PATH);
 		vgTranslate(command.x,command.y);
+		vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+		vgGetMatrix(save_matrix2);
+		unsigned int glyph_index=FT_Get_Char_Index(ft_face,command.target.textchar);
+	    vgScale(font_exp_x[glyph_index],font_height);
+
+
 		VGfloat gori[]={0.,0.};
 		vgSetfv(VG_GLYPH_ORIGIN,2,gori);
 
-		unsigned int glyph_index=FT_Get_Char_Index(ft_face,command.target.textchar);
+
 		vgDrawGlyph(vgfont,glyph_index,VG_FILL_PATH,VG_FALSE);
 		//vgDrawPath(std_paths[Rectangle],VG_FILL_PATH);
 	/*	Log::getInstance()->log("OSD", Log::DEBUG, "Draw Glyph %d %c %d %g %g %x",command.reference,command.target.textchar,glyph_index,command.x,command.y,
 						vgGetError());*/
+		vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE);
 		vgLoadMatrix(save_matrix);
+		vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+		vgLoadMatrix(save_matrix2);
+
 		vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
 	} break;
 	case DrawTTchar:{
-- 
2.39.5