1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Implemented taBorder alignment flag

This commit is contained in:
Klaus Schmidinger 2012-05-17 16:38:50 +02:00
parent 4f889749b3
commit c1ddc63fda
3 changed files with 20 additions and 7 deletions

View File

@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History
- Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank - Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank
Schmirler). Schmirler).
2012-05-13: Version 1.7.28 2012-05-17: Version 1.7.28
- Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4. - Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4.
- Fixed getting the maximum short channel name length in case there are no short names - 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. more information about the currently played recording.
- Fixed a mismatched 'delete' in cSchedules::SetEpgDataFileName() (thanks to Reinhard - Fixed a mismatched 'delete' in cSchedules::SetEpgDataFileName() (thanks to Reinhard
Mantey). 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.

18
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "osd.h"
@ -553,11 +553,15 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color
if (Width || Height) { if (Width || Height) {
limit = x + cw - x0; limit = x + cw - x0;
if (Width) { 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) { else if ((Alignment & taRight) != 0) {
if (w < Width) if (w < Width)
x += Width - w; x += Width - w;
if ((Alignment & taBorder) != 0)
x -= max(h / TEXT_ALIGN_BORDER, 1);
} }
else { // taCentered else { // taCentered
if (w < Width) if (w < Width)
@ -1280,11 +1284,15 @@ void cPixmapMemory::DrawText(const cPoint &Point, const char *s, tColor ColorFg,
if (Width || Height) { if (Width || Height) {
limit = x + cw; limit = x + cw;
if (Width) { 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) { else if ((Alignment & taRight) != 0) {
if (w < Width) if (w < Width)
x += Width - w; x += Width - w;
if ((Alignment & taBorder) != 0)
x -= max(h / TEXT_ALIGN_BORDER, 1);
} }
else { // taCentered else { // taCentered
if (w < Width) if (w < Width)

4
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __OSD_H
@ -25,6 +25,7 @@
#define ALPHA_TRANSPARENT 0x00 #define ALPHA_TRANSPARENT 0x00
#define ALPHA_OPAQUE 0xFF #define ALPHA_OPAQUE 0xFF
#define IS_OPAQUE(c) ((c >> 24) == ALPHA_OPAQUE) #define IS_OPAQUE(c) ((c >> 24) == ALPHA_OPAQUE)
#define TEXT_ALIGN_BORDER 10 // fraction of the font height used for sizing border
enum { enum {
//AARRGGBB //AARRGGBB
@ -151,6 +152,7 @@ enum eTextAlignment { taCenter = 0x00,
taRight = 0x02, taRight = 0x02,
taTop = 0x04, taTop = 0x04,
taBottom = 0x08, taBottom = 0x08,
taBorder = 0x10, // keeps some distance from the left or right alignment edge
taDefault = taTop | taLeft taDefault = taTop | taLeft
}; };