diff -X .diffignore -ru vdr-1.3.22.thus3/osd.c vdr-1.3.22.thus4/osd.c --- vdr-1.3.22.thus3/osd.c 2004-12-19 13:27:38.000000000 +0100 +++ vdr-1.3.22.thus4/osd.c 2005-04-19 23:27:44.166111401 +0200 @@ -15,6 +15,7 @@ #include #include #include "tools.h" +#include "assert.h" // --- cPalette -------------------------------------------------------------- @@ -27,6 +28,8 @@ { numColors = 0; modified = false; + int i= Index(0x00000000); //clrTransparent + assert(i==0); //default indices are 0 and shall be shown transparent } int cPalette::Index(tColor Color) diff -X .diffignore -ru vdr-1.3.22.thus3/PLUGINS/src/dxr3/dxr3colormanager.c vdr-1.3.22.thus4/PLUGINS/src/dxr3/dxr3colormanager.c --- vdr-1.3.22.thus3/PLUGINS/src/dxr3/dxr3colormanager.c 2004-09-13 18:23:16.000000000 +0200 +++ vdr-1.3.22.thus4/PLUGINS/src/dxr3/dxr3colormanager.c 2005-04-19 23:31:15.065839033 +0200 @@ -115,43 +116,36 @@ // ================================== void cColorManager::EncodeColors(int width, int height, unsigned char* map, unsigned char* dmap) { - unsigned char color = 0xFF, ccol = 0xFF; - unsigned char ColorIndex = 0xFF; - unsigned char buffer[1024] = {0}; - - for (int y = 0; y < height; ++y) - { - color = 0xFF; - for(int x = 0; x < width; ++x) - { - ccol = map[y * width + x]; - if (ccol != 0) MaxY = y; - if (ccol != color) - { - color = ccol; // save this color - if (!AddColor(x,y,color, ColorIndex)) - { - // add this color to highlight regions - color = 0xFF; - x = -1; - } - else - { - // color successfully added - buffer[x] = ColorIndex; - } - } - else - { - buffer[x] = ColorIndex;//*(dmap+(y * width + x)) = ColorIndex; - } - } - dxr3_memcpy(dmap+y*width, buffer,width); + for (int y = 0; y < height; ++y) + { + unsigned char *buffer = dmap+y*width; + unsigned char currColor = 0xFF; + unsigned char currColorIndex = 0; + int currColorMaxX = 0; + for(int x = 0; x < width; ++x) + { + unsigned char ccol = map[y * width + x]; + if ( ccol != 0) MaxY = y; + if ((ccol != currColor) || (x>currColorMaxX)) + { + currColor = ccol; // save this color + currColorMaxX = width; + if (!AddColor(x,y,currColor, currColorIndex,currColorMaxX)) + { + // add this color to highlight regions + y--;//once more this line + break; + } + } + buffer[x] = currColorIndex; } + //dxr3_memcpy(dmap+y*width, buffer,width); + } + CloseRegion(height-1); } // ================================== -unsigned char cColorManager::AddColor(int x, int y, unsigned char color, unsigned char &ColorIndex) { +unsigned char cColorManager::AddColor(int x, int y, unsigned char color, unsigned char &ColorIndex,int &maxX) { static int yold = -1; xSection* Section = 0; int SectionIndex = 0; @@ -168,7 +162,7 @@ if (!Section->HasColor(color, ColorIndex)) { // this color is new for this section - if (Section->AllColorsUsed()) + if (Section->AllColorsUsed(yold == y)) { // no more free colors if (yold != y) @@ -176,9 +170,6 @@ CloseRegion(y-1); // terminate region return(0); - yold = y; - // open new region - OpenRegion(y,SectionIndex+1); } // create new section Section = NewSection(x); @@ -214,6 +205,7 @@ // and add new color ColorIndex = Section->AddColor(color); } + maxX=Section->X2; return(1); } @@ -313,6 +305,7 @@ if (N > 0) hlr[NrOfRegions]->Section[hlr[NrOfRegions]->N - 1]->X2 = x-1; (hlr[NrOfRegions]->N)++; + assert(hlr[NrOfRegions]->N < MAX_NO_OF_SECTIONS); return(sec); } diff -X .diffignore -ru vdr-1.3.22.thus3/PLUGINS/src/dxr3/dxr3colormanager.h vdr-1.3.22.thus4/PLUGINS/src/dxr3/dxr3colormanager.h --- vdr-1.3.22.thus3/PLUGINS/src/dxr3/dxr3colormanager.h 2004-08-06 01:05:21.000000000 +0200 +++ vdr-1.3.22.thus4/PLUGINS/src/dxr3/dxr3colormanager.h 2005-04-19 23:31:17.207541607 +0200 @@ -58,7 +58,9 @@ xSection(int x); bool HasColor(unsigned int color, unsigned char &ColorIndex); unsigned char AddColor(unsigned int color); - bool AllColorsUsed() {/*DIAG("AllColorsUsed: %d\n",NrOfColors)*/;if(NrOfColors >= 4) return(true); else return (false); }; + bool AllColorsUsed(bool firstLine) {/*DIAG("AllColorsUsed: %d\n",NrOfColors)*/ + return NrOfColors >= (firstLine?3:4); + }; int X1; int X2; int NrOfColors; @@ -91,7 +93,7 @@ void EncodeColors(int width, int height, unsigned char* smap, unsigned char* dmap); /** Sets a new color on the OSD */ - unsigned char AddColor(int x, int y, unsigned char color, unsigned char &ColorIndex); + unsigned char AddColor(int x, int y, unsigned char color, unsigned char &ColorIndex,int &maxX); /** encodes the color information as highlight spu data*/ unsigned char* GetSpuData(int &len);