diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-05-17 16:38:50 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-05-17 16:38:50 +0200 |
commit | c1ddc63fda4b2896eee72bacc1f935b1194b3800 (patch) | |
tree | 9fb699d56895fba3474386e289f4ed3c455b503c | |
parent | 4f889749b3d4a6f3e0c24cc03bd4e432c6638cdf (diff) | |
download | vdr-c1ddc63fda4b2896eee72bacc1f935b1194b3800.tar.gz vdr-c1ddc63fda4b2896eee72bacc1f935b1194b3800.tar.bz2 |
Implemented taBorder alignment flag
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | osd.c | 18 | ||||
-rw-r--r-- | osd.h | 4 |
3 files changed, 20 insertions, 7 deletions
@@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History - Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank Schmirler). -2012-05-13: Version 1.7.28 +2012-05-17: Version 1.7.28 - Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4. - Fixed getting the maximum short channel name length in case there are no short names @@ -7108,3 +7108,6 @@ Video Disk Recorder Revision History more information about the currently played recording. - Fixed a mismatched 'delete' in cSchedules::SetEpgDataFileName() (thanks to Reinhard Mantey). +- The DrawText() functions of the OSD now accept the new alignment flag taBorder, + which triggers keeping a proper distance from the edge that taLeft or taRight + aligns to. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 2.28 2012/03/28 10:40:12 kls Exp $ + * $Id: osd.c 2.29 2012/05/17 13:29:19 kls Exp $ */ #include "osd.h" @@ -553,11 +553,15 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color if (Width || Height) { limit = x + cw - x0; if (Width) { - if ((Alignment & taLeft) != 0) - ; + if ((Alignment & taLeft) != 0) { + if ((Alignment & taBorder) != 0) + x += max(h / TEXT_ALIGN_BORDER, 1); + } else if ((Alignment & taRight) != 0) { if (w < Width) x += Width - w; + if ((Alignment & taBorder) != 0) + x -= max(h / TEXT_ALIGN_BORDER, 1); } else { // taCentered if (w < Width) @@ -1280,11 +1284,15 @@ void cPixmapMemory::DrawText(const cPoint &Point, const char *s, tColor ColorFg, if (Width || Height) { limit = x + cw; if (Width) { - if ((Alignment & taLeft) != 0) - ; + if ((Alignment & taLeft) != 0) { + if ((Alignment & taBorder) != 0) + x += max(h / TEXT_ALIGN_BORDER, 1); + } else if ((Alignment & taRight) != 0) { if (w < Width) x += Width - w; + if ((Alignment & taBorder) != 0) + x -= max(h / TEXT_ALIGN_BORDER, 1); } else { // taCentered if (w < Width) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.h 2.15 2011/12/04 13:38:17 kls Exp $ + * $Id: osd.h 2.16 2012/05/17 15:09:35 kls Exp $ */ #ifndef __OSD_H @@ -25,6 +25,7 @@ #define ALPHA_TRANSPARENT 0x00 #define ALPHA_OPAQUE 0xFF #define IS_OPAQUE(c) ((c >> 24) == ALPHA_OPAQUE) +#define TEXT_ALIGN_BORDER 10 // fraction of the font height used for sizing border enum { //AARRGGBB @@ -151,6 +152,7 @@ enum eTextAlignment { taCenter = 0x00, taRight = 0x02, taTop = 0x04, taBottom = 0x08, + taBorder = 0x10, // keeps some distance from the left or right alignment edge taDefault = taTop | taLeft }; |