summaryrefslogtreecommitdiff
path: root/bitmap.c
diff options
context:
space:
mode:
authorThomas Günther <tom@toms-cafe.de>2006-04-25 01:26:30 +0200
committerThomas Günther <tom@toms-cafe.de>2006-04-25 01:26:30 +0200
commit9a7e5e080aa9920ce62d9d16cb009bcb491746ac (patch)
treec04367faa793b8b23bc4a55b1522732e64dbb45c /bitmap.c
parent1becd81a2986fd9b594a01a80941261ccb1e44b0 (diff)
downloadvdr-plugin-spider-9a7e5e080aa9920ce62d9d16cb009bcb491746ac.tar.gz
vdr-plugin-spider-9a7e5e080aa9920ce62d9d16cb009bcb491746ac.tar.bz2
Removed compatibility to VDR < 1.3.47
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c99
1 files changed, 1 insertions, 98 deletions
diff --git a/bitmap.c b/bitmap.c
index ecb5846..425c6ae 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: bitmap.c 2 2005-05-14 22:25:56Z tom $
+ * $Id: bitmap.c 22 2006-04-24 23:26:30Z tom $
*/
#include "bitmap.h"
@@ -12,13 +12,6 @@
#include <vdr/osd.h>
#include <ctype.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
- #define DrawRectangle Fill
- #define DrawPixel SetPixel
-#endif
-
/** --- class Bitmap ------------------------------------------------------- **/
@@ -62,31 +55,6 @@ void Bitmap::text(const char* text, bool centered)
{
DrawRectangle(0, 0, Width() - 1, Height() - 1, clrWhite);
frame(0, 0, Width() - 1, Height() - 1, clrRed);
-
-#if VDRVERSNUM < 10307
- SetFont(fontOsd);
- int lineCount;
- char* wrapper = textWrapper(text, &lineCount);
- int y = max((Height() - lineCount * cOsd::LineHeight()) / 2, 0);
- char* line = wrapper;
- while (*line)
- {
- char* newline = strchr(line, '\n');
- if (newline)
- *newline = 0;
- int x = 0;
- if (centered)
- x = max((Width() - Width(line)) / 2, 0);
- Text(x, y, line, clrBlack, clrWhite);
- if (newline)
- *newline = '\n';
- if (!newline)
- break;
- line = newline + 1;
- y += cOsd::LineHeight();
- }
- free(wrapper);
-#else
const cFont* font = cFont::GetFont(fontOsd);
cTextWrapper wrapper(text, font, Width());
int y = max((Height() - wrapper.Lines() * font->Height()) / 2, 0);
@@ -97,7 +65,6 @@ void Bitmap::text(const char* text, bool centered)
x = max((Width() - font->Width(wrapper.GetLine(l))) / 2, 0);
DrawText(x, y, wrapper.GetLine(l), clrBlack, clrWhite, font);
}
-#endif
}
/** Draw a frame into the bitmap */
@@ -173,11 +140,7 @@ bool Bitmap::loadXpm(const char* FileName, tColor NoneColor)
ptr += 2;
if (*ptr == '#') {
int col = strtoul(++ptr, NULL, 16);
-#if VDRVERSNUM < 10307
- pal[temp] = 0xff000000 | ((col & 0xff) << 16) | (col & 0xff00) | ((col & 0xff0000) >> 16);
-#else
pal[temp] = 0xff000000 | col;
-#endif
}
else {
pal[temp] = NoneColor;
@@ -211,63 +174,3 @@ bool Bitmap::loadXpm(const char* FileName, tColor NoneColor)
}
return bRet;
}
-
-#if VDRVERSNUM < 10307
-/** Wrap the text to fit into the bitmap - taken from font.c in VDR 1.3.7 */
-char *Bitmap::textWrapper(const char *Text, int *p_lines)
-{
- char *text = strdup(Text);
- int lines = 1;
-
- char *Blank = NULL;
- char *Delim = NULL;
- int w = 0;
-
- stripspace(text); // strips trailing newlines
-
- for (char *p = text; *p; ) {
- if (*p == '\n') {
- lines++;
- w = 0;
- Blank = Delim = NULL;
- p++;
- continue;
- }
- else if (isspace(*p))
- Blank = p;
- int cw = Width(*p);
- if (w + cw > Width()) {
- if (Blank) {
- *Blank = '\n';
- p = Blank;
- continue;
- }
- else {
- // Here's the ugly part, where we don't have any whitespace to
- // punch in a newline, so we need to make room for it:
- if (Delim)
- p = Delim + 1; // let's fall back to the most recent delimiter
- char *s = MALLOC(char, strlen(text) + 2); // The additional '\n' plus the terminating '\0'
- int l = p - text;
- strncpy(s, text, l);
- s[l] = '\n';
- strcpy(s + l + 1, p);
- free(text);
- text = s;
- p = text + l;
- continue;
- }
- }
- else
- w += cw;
- if (strchr("-.,:;!?_", *p)) {
- Delim = p;
- Blank = NULL;
- }
- p++;
- }
- if (p_lines != NULL)
- *p_lines = lines;
- return text;
-}
-#endif