From d79f880ef6f91614d2257c5bef158678ea9a387f Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Tue, 29 Sep 2009 17:19:56 +0200 Subject: correct writeRegionInformation --- spuencoder.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/spuencoder.c b/spuencoder.c index d4f1e8a..a78424d 100644 --- a/spuencoder.c +++ b/spuencoder.c @@ -182,18 +182,28 @@ void cSpuEncoder::writeRegionInformation() spu[written++] = 0x00; // total size of parameter area spu[written++] = 0x00; // will be filled later - for (size_t i = 1; i < regions.size(); i++) { + for (size_t i = 0; i < regions.size(); i++) { cSpuRegion *reg = regions[i]; + // we need to modify start and end line + // because both are values for the whole screen and + // we are working only on the bitmap to show. + // se simply add top coordinate to startLine and endLine + reg->startLine += this->top; + reg->endLine += this->top - 1; + // define region (LN_CTLI) spu[written++] = (reg->startLine >> 8); spu[written++] = reg->startLine & 0xff; spu[written++] = (((reg->openSections() & 0x0f) << 4)| ((reg->endLine >> 8) & 0x0f)); spu[written++] = reg->endLine & 0xff; - for (size_t j = 0; j < reg->openSections(); j++) { + for (uint8_t j = 0; j < reg->openSections(); j++) { + + sSection *sec = reg->section(j); - sSection *sec = reg->section(i); + // we also need to modify startColumn value + sec->startColumn += this->left; // define section (PXCTLI) spu[written++] = (sec->startColumn >> 8) & 0x0f; -- cgit v1.2.3