summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spuencoder.c25
-rw-r--r--spuencoder.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/spuencoder.c b/spuencoder.c
index fe6425f..61a5ae8 100644
--- a/spuencoder.c
+++ b/spuencoder.c
@@ -75,6 +75,8 @@ void cSpuEncoder::encode(cBitmap *bmap, int top, int left)
this->left = left;
// prepare datastructures
+ memset(rleData.top, 0, sizeof(rleData.top));
+ memset(rleData.bottom, 0, sizeof(rleData.bottom));
memset(&spu, 0, sizeof(spu));
// get needed informations about used colors
@@ -82,9 +84,26 @@ void cSpuEncoder::encode(cBitmap *bmap, int top, int left)
dsyslog("[dxr3-spuencoder] num colors %d", numColors);
-
// generate and upload color palette
generateColorPalette();
+
+ // as we have only small space for all our spu data, we do here
+ // a little trick. If we run out of space, when using
+ // top and odd bottom, we try to use two times the top lines.
+ // this will gain some more free space. the osd may not look
+ // as good as with top and bottom lines, but its better to
+ // have a working and maybe not so sexy looking osd instead of a
+ // a broken osd.
+
+ try {
+ generateSpuData(true);
+ } catch (char const* e) {
+
+ dsyslog("[dxr3-spuencoder] %s", e);
+
+ // make a try with only even lines
+ generateSpuData(false);
+ }
}
void cSpuEncoder::writeNibble(uint8_t val)
@@ -121,3 +140,7 @@ void cSpuEncoder::generateColorPalette()
// upload color palette
cDxr3Interface::instance()->SetPalette(palcolors);
}
+
+void cSpuEncoder::generateSpuData(bool topAndBottom) throw (char const* )
+{
+}
diff --git a/spuencoder.h b/spuencoder.h
index 3124157..f190636 100644
--- a/spuencoder.h
+++ b/spuencoder.h
@@ -63,6 +63,7 @@ private:
void writeNibble(uint8_t val);
void generateColorPalette();
+ void generateSpuData(bool topAndBottom) throw (char const* );
};
#endif // SPUENCODER_H