From ea4193d60fe772e88c8b7461ba0671a7e3fac9da Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sat, 29 Jun 2013 17:32:46 +0200 Subject: [PATCH] Add support for gradients, slightly facelift of menues --- boxx.cc | 2 +- boxx.h | 2 +- colour.cc | 205 ++++++++++++++++++++++++++++++++++++++++++++-- colour.h | 31 ++++++- command.cc | 6 ++ defines.h | 1 + osdopenvg.cc | 73 +++++++++++++++-- surface.cc | 2 +- surface.h | 2 +- surfacevector.cc | 4 +- surfacevector.h | 2 +- vchannellist.cc | 27 +++--- vchannellist.h | 3 +- vepg.cc | 27 ++---- vrecordinglist.cc | 27 +++--- vrecordinglist.h | 3 +- vtimerlist.cc | 35 ++++---- vtimerlist.h | 1 + wsymbol.h | 2 +- 19 files changed, 374 insertions(+), 81 deletions(-) diff --git a/boxx.cc b/boxx.cc index a1b31b1..08683a5 100644 --- a/boxx.cc +++ b/boxx.cc @@ -403,7 +403,7 @@ void Boxx::drawJpeg(const char *fileName,int x, int y,int *width, int *height) else if (surface) surface->drawJpeg(fileName,x,y,width,height); } -void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour) +void Boxx::drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour) { if (parent) parent->drawMonoBitmap(base, area.x +dx,area.y +dy, height,width, nextColour); else if (surface) surface->drawMonoBitmap(base, dx,dy, height,width, nextColour); diff --git a/boxx.h b/boxx.h index 06b3c92..a90a070 100644 --- a/boxx.h +++ b/boxx.h @@ -111,7 +111,7 @@ class Boxx void drawJpeg(const char *fileName,int x, int y,int *width, int *height); void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c); - void drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); + void drawMonoBitmap(UCHAR*base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour); /* This is for system which need a locking of the drawing surface to speed up drawing */ void startFastDraw(); diff --git a/colour.cc b/colour.cc index 82bfa83..b4083e6 100644 --- a/colour.cc +++ b/colour.cc @@ -20,12 +20,12 @@ #include "colour.h" -/* -Real colours -*/ + DrawStyle DrawStyle::BLACK(0, 0, 0); DrawStyle DrawStyle::RED(255, 0, 0); DrawStyle DrawStyle::GREEN(0, 255, 0); +DrawStyle DrawStyle::GREY(180, 180, 180); +DrawStyle DrawStyle::DARKGREY(100, 100, 100); DrawStyle DrawStyle::BLUE(0, 0, 255); DrawStyle DrawStyle::YELLOW(255, 255, 0); DrawStyle DrawStyle::VIDEOBLUE(0, 0, 150); @@ -43,7 +43,34 @@ DrawStyle DrawStyle::PROGRAMMEA(40, 40, 120); // TODO fit epg style (colours) in DrawStyle DrawStyle::NOPROGRAMME(180, 180, 180); // no programme details colour -/* +void SkinFactory::InitDefaultSkin() +{ + /* +Real colours + */ + DrawStyle::BLACK=DrawStyle(0, 0, 0); + DrawStyle::RED=DrawStyle(255, 0, 0); + DrawStyle::GREY=DrawStyle(180, 180, 180); + DrawStyle::DARKGREY=DrawStyle(100, 100, 100); + DrawStyle::GREEN=DrawStyle(0, 255, 0); + DrawStyle::BLUE=DrawStyle(0, 0, 255); + DrawStyle::YELLOW=DrawStyle(255, 255, 0); + DrawStyle::VIDEOBLUE=DrawStyle(0, 0, 150); + DrawStyle::VIEWBACKGROUND=DrawStyle(0, 0, 100); + DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120); + DrawStyle::TITLEBARBACKGROUND=DrawStyle(0, 0, 200); + DrawStyle::SELECTHIGHLIGHT=DrawStyle(240, 250, 80); + DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(120, 125, 40); + DrawStyle::LIGHTTEXT=DrawStyle(255, 255, 255); + DrawStyle::DARKTEXT=DrawStyle(0, 0, 100); + DrawStyle::DANGER=DrawStyle(200, 0, 0); + DrawStyle::BUTTONBACKGROUND=DrawStyle(0, 0, 200); + DrawStyle::PROGRAMMEB=DrawStyle(80, 80, 240); // two colours used as alterating backgrounds for individual programmes in EPG + DrawStyle::PROGRAMMEA=DrawStyle(40, 40, 120); // TODO fit epg style (colours) in with rest of application + DrawStyle::NOPROGRAMME=DrawStyle(180, 180, 180); // no programme details colour + + + /* Silly colours Colour Colour::VIDEOBLUE(250, 0, 0); @@ -54,4 +81,172 @@ Colour Colour::LIGHTTEXT(255, 0, 255); Colour Colour::DARKTEXT(0, 0, 255); Colour Colour::DANGER(200, 200, 0); Colour Colour::BUTTONBACKGROUND(255, 255, 255); -*/ + */ +} + +void SkinFactory::InitEnhancedSkin() +{ + /* +Real colours + */ + DrawStyle::BLACK=DrawStyle(0, 0, 0); + + DrawStyle::RED=DrawStyle(100, 0, 0); + DrawStyle::RED.grad_col[0]=Colour(255, 0, 0); + DrawStyle::RED.grad_col[1]=Colour(100, 0, 0); + DrawStyle::RED.grad_pos[0]=0.5; + DrawStyle::RED.num_colors=2; + DrawStyle::RED.ft=DrawStyle::GradientLinear; + DrawStyle::RED.x1=0.0; + DrawStyle::RED.y1=0.0; + DrawStyle::RED.x2=0.0; + DrawStyle::RED.y2=1.0; + + DrawStyle::GREEN=DrawStyle(0, 100, 0); + DrawStyle::GREEN.grad_col[0]=Colour(0, 255, 0); + DrawStyle::GREEN.grad_col[1]=Colour(0, 100, 0); + DrawStyle::GREEN.grad_pos[0]=0.5; + DrawStyle::GREEN.num_colors=2; + DrawStyle::GREEN.ft=DrawStyle::GradientLinear; + DrawStyle::GREEN.x1=0.0; + DrawStyle::GREEN.y1=0.0; + DrawStyle::GREEN.x2=0.0; + DrawStyle::GREEN.y2=1.0; + + DrawStyle::BLUE=DrawStyle(0, 0, 100); + DrawStyle::BLUE.grad_col[0]=Colour(0, 0, 255); + DrawStyle::BLUE.grad_col[1]=Colour(0, 0, 100); + DrawStyle::BLUE.grad_pos[0]=0.5; + DrawStyle::BLUE.num_colors=2; + DrawStyle::BLUE.ft=DrawStyle::GradientLinear; + DrawStyle::BLUE.x1=0.0; + DrawStyle::BLUE.y1=0.0; + DrawStyle::BLUE.x2=0.0; + DrawStyle::BLUE.y2=1.0; + + DrawStyle::YELLOW=DrawStyle(100, 100, 0); + DrawStyle::YELLOW.grad_col[0]=Colour(255, 255, 0); + DrawStyle::YELLOW.grad_col[1]=Colour(100, 100, 0); + DrawStyle::YELLOW.grad_pos[0]=0.5; + DrawStyle::YELLOW.num_colors=2; + DrawStyle::YELLOW.ft=DrawStyle::GradientLinear; + DrawStyle::YELLOW.x1=0.0; + DrawStyle::YELLOW.y1=0.0; + DrawStyle::YELLOW.x2=0.0; + DrawStyle::YELLOW.y2=1.0; + + DrawStyle::GREY=DrawStyle(100, 100, 100); + DrawStyle::GREY.grad_col[0]=Colour(180, 180, 180); + DrawStyle::GREY.grad_col[1]=Colour(100, 100, 100); + DrawStyle::GREY.grad_pos[0]=0.5; + DrawStyle::GREY.num_colors=2; + DrawStyle::GREY.ft=DrawStyle::GradientLinear; + DrawStyle::GREY.x1=0.0; + DrawStyle::GREY.y1=0.0; + DrawStyle::GREY.x2=0.0; + DrawStyle::GREY.y2=1.0; + + DrawStyle::DARKGREY=DrawStyle(50, 50, 50); + DrawStyle::DARKGREY.grad_col[0]=Colour(100, 100, 100); + DrawStyle::DARKGREY.grad_col[1]=Colour(50, 50, 50); + DrawStyle::DARKGREY.grad_pos[0]=0.5; + DrawStyle::DARKGREY.num_colors=2; + DrawStyle::DARKGREY.ft=DrawStyle::GradientLinear; + DrawStyle::DARKGREY.x1=0.0; + DrawStyle::DARKGREY.y1=0.0; + DrawStyle::DARKGREY.x2=0.0; + DrawStyle::DARKGREY.y2=1.0; + + + DrawStyle::VIDEOBLUE=DrawStyle(0, 0, 150); + + DrawStyle::VIEWBACKGROUND=DrawStyle(0, 0, 100); + DrawStyle::VIEWBACKGROUND.grad_col[0]=Colour(0,0,160); + DrawStyle::VIEWBACKGROUND.num_colors=1; + DrawStyle::VIEWBACKGROUND.ft=DrawStyle::GradientLinear; + DrawStyle::VIEWBACKGROUND.x1=0.0; + DrawStyle::VIEWBACKGROUND.y1=0.0; + DrawStyle::VIEWBACKGROUND.x2=0.0; + DrawStyle::VIEWBACKGROUND.y2=1.0; + + DrawStyle::TABVIEWBACKGROUND=DrawStyle(0, 0, 120); + + + DrawStyle::TITLEBARBACKGROUND=DrawStyle(0, 0, 160); + DrawStyle::TITLEBARBACKGROUND.grad_col[0]=Colour(0,0,250); + DrawStyle::TITLEBARBACKGROUND.num_colors=1; + DrawStyle::TITLEBARBACKGROUND.ft=DrawStyle::GradientLinear; + DrawStyle::TITLEBARBACKGROUND.x1=0.0; + DrawStyle::TITLEBARBACKGROUND.y1=0.0; + DrawStyle::TITLEBARBACKGROUND.x2=0.0; + DrawStyle::TITLEBARBACKGROUND.y2=1.0; + + + DrawStyle::SELECTHIGHLIGHT=DrawStyle(120, 125, 40); + DrawStyle::SELECTHIGHLIGHT.grad_col[0]=DrawStyle(240, 250, 80); + DrawStyle::SELECTHIGHLIGHT.num_colors=1; + DrawStyle::SELECTHIGHLIGHT.ft=DrawStyle::GradientLinear; + DrawStyle::SELECTHIGHLIGHT.x1=0.0; + DrawStyle::SELECTHIGHLIGHT.y1=0.0; + DrawStyle::SELECTHIGHLIGHT.x2=0.0; + DrawStyle::SELECTHIGHLIGHT.y2=1.0; + + + DrawStyle::SELECTDARKHIGHLIGHT=DrawStyle(120, 125, 40); + DrawStyle::LIGHTTEXT=DrawStyle(255, 255, 255); + DrawStyle::DARKTEXT=DrawStyle(0, 0, 100); + DrawStyle::DANGER=DrawStyle(200, 0, 0); + + DrawStyle::BUTTONBACKGROUND=DrawStyle(0, 0, 100); + DrawStyle::BUTTONBACKGROUND.grad_col[0]=DrawStyle(0, 0, 200); + DrawStyle::BUTTONBACKGROUND.num_colors=1; + DrawStyle::BUTTONBACKGROUND.ft=DrawStyle::GradientLinear; + DrawStyle::BUTTONBACKGROUND.x1=0.0; + DrawStyle::BUTTONBACKGROUND.y1=0.0; + DrawStyle::BUTTONBACKGROUND.x2=0.0; + DrawStyle::BUTTONBACKGROUND.y2=1.0; + + + DrawStyle::PROGRAMMEB=DrawStyle(40, 40, 120); // two colours used as alterating backgrounds for individual programmes in EPG + DrawStyle::PROGRAMMEB.grad_col[0]=DrawStyle(80, 80, 240); + DrawStyle::PROGRAMMEB.num_colors=1; + DrawStyle::PROGRAMMEB.ft=DrawStyle::GradientLinear; + DrawStyle::PROGRAMMEB.x1=0.0; + DrawStyle::PROGRAMMEB.y1=0.0; + DrawStyle::PROGRAMMEB.x2=0.0; + DrawStyle::PROGRAMMEB.y2=1.0; + + + DrawStyle::PROGRAMMEA=DrawStyle(80, 80, 240); // TODO fit epg style (colours) in with rest of application + DrawStyle::PROGRAMMEA.grad_col[0]=DrawStyle(40, 40, 120); + DrawStyle::PROGRAMMEA.num_colors=1; + DrawStyle::PROGRAMMEA.ft=DrawStyle::GradientLinear; + DrawStyle::PROGRAMMEA.x1=0.0; + DrawStyle::PROGRAMMEA.y1=0.0; + DrawStyle::PROGRAMMEA.x2=0.0; + DrawStyle::PROGRAMMEA.y2=1.0; + + + DrawStyle::NOPROGRAMME=DrawStyle(180, 180, 180); // no programme details colour + DrawStyle::NOPROGRAMME.grad_col[0]=DrawStyle(90, 90, 90); + DrawStyle::NOPROGRAMME.num_colors=1; + DrawStyle::NOPROGRAMME.ft=DrawStyle::GradientLinear; + DrawStyle::NOPROGRAMME.x1=0.0; + DrawStyle::NOPROGRAMME.y1=0.0; + DrawStyle::NOPROGRAMME.x2=0.0; + DrawStyle::NOPROGRAMME.y2=1.0; + + + /* +Silly colours + +Colour Colour::VIDEOBLUE(250, 0, 0); +Colour Colour::VIEWBACKGROUND(100, 0, 100); +Colour Colour::TITLEBARBACKGROUND(100, 0, 200); +Colour Colour::SELECTHIGHLIGHT(240, 250, 180); +Colour Colour::LIGHTTEXT(255, 0, 255); +Colour Colour::DARKTEXT(0, 0, 255); +Colour Colour::DANGER(200, 200, 0); +Colour Colour::BUTTONBACKGROUND(255, 255, 255); + */ +} diff --git a/colour.h b/colour.h index 9f358c3..9b620f8 100644 --- a/colour.h +++ b/colour.h @@ -59,19 +59,38 @@ class DrawStyle: public Colour { public: DrawStyle() - { red = 0; green = 0; blue = 0; alpha = 255; } + { red = 0; green = 0; blue = 0; alpha = 255; ft=Color;ct=Global; } DrawStyle(int Tred, int Tgreen, int Tblue) - { red = Tred; green = Tgreen; blue = Tblue; alpha = 255; } + { red = Tred; green = Tgreen; blue = Tblue; alpha = 255 ;ft=Color;ct=Global; } DrawStyle(int Tred, int Tgreen, int Tblue, int Talpha) - { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; } + { red = Tred; green = Tgreen; blue = Tblue; alpha = Talpha; ft=Color;ct=Global;} + + enum FillType { + Color, + GradientLinear, + GradientRadial, + }; + enum CoordType { + Global, + Local + }; + + enum FillType ft; + enum CoordType ct; //not implemented yet + float x1,y1,x2,y2,r; // Parameter for gradient either relative to object or to global coordinate system + int num_colors; //max is 4, min is 0 + Colour grad_col[4]; + float grad_pos[3]; //Last position is alway 1.0 and first 0.0 static DrawStyle BLACK; static DrawStyle RED; static DrawStyle GREEN; static DrawStyle YELLOW; static DrawStyle BLUE; + static DrawStyle GREY; + static DrawStyle DARKGREY; static DrawStyle VIDEOBLUE; static DrawStyle VIEWBACKGROUND; static DrawStyle TABVIEWBACKGROUND; @@ -88,4 +107,10 @@ public: }; +class SkinFactory { +public: + static void InitDefaultSkin(); + static void InitEnhancedSkin(); +}; + #endif diff --git a/command.cc b/command.cc index 789fb7e..6fb521e 100644 --- a/command.cc +++ b/command.cc @@ -99,6 +99,12 @@ int Command::init(bool tcrashed, char* tServer) initted = 0; return 0; } +#ifdef GRADIENT_DRAWING + SkinFactory::InitEnhancedSkin(); +#else + SkinFactory::InitDefaultSkin(); +#endif + #ifndef WIN32 pthread_mutex_init(&masterLock, NULL); #else diff --git a/defines.h b/defines.h index 7578553..c5d6f79 100644 --- a/defines.h +++ b/defines.h @@ -120,6 +120,7 @@ long long getTimeMS(); #define PLAYER_MAX_STREAMING_BUFFERS 120 // for video in uints of 50000 KB #define TV_NORM_SWITCHABLE #define HANDLE_VT_SWITCHING + #define GRADIENT_DRAWING #define VOMP_LINUX_CLOCK CLOCK_MONOTONIC diff --git a/osdopenvg.cc b/osdopenvg.cc index 388d47e..740272b 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -809,6 +809,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command) { VGfloat save_matrix[9]; + VGfloat save_matrix2[9]; switch (command.instr) { case DrawPath: { vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); @@ -829,16 +830,24 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command) vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); vgGetMatrix(save_matrix); vgTranslate(command.x,command.y); + + + + //vgScale(command.w,command.h); + VGfloat imagewidth=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_WIDTH); + VGfloat imageheight=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_HEIGHT); if (command.reference) { //special behaviout for bw images they act as a mask on the current paint vgSetPaint((VGPaint) command.reference,VG_FILL_PATH); vgSetPaint((VGPaint) command.reference,VG_STROKE_PATH); vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_STENCIL); vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); vgScale(aspect_correction,1.f); + vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER); + vgGetMatrix(save_matrix2); + vgScale(0.2f,0.2f); } else { - VGfloat imagewidth=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_WIDTH); - VGfloat imageheight=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_HEIGHT); + //vgScale(720.f/((float)BACKBUFFER_WIDTH), 576.f/((float)BACKBUFFER_HEIGHT)); float scalex=command.w/imagewidth; float scaley=command.h/imageheight; @@ -859,7 +868,11 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command) if (command.reference) { vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_NORMAL); vgSeti(VG_BLEND_MODE, VG_BLEND_SRC); + vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER); + vgLoadMatrix(save_matrix2); } + + vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); vgLoadMatrix(save_matrix); } break; case DrawGlyph: { @@ -1022,11 +1035,57 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) case OVGcreateColorRef :{ VGPaint handle; handle=vgCreatePaint(); - vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); - vgSetColor(handle,command.param1); - VGuint rgba; - rgba = vgGetColor((VGPaint)handle); - Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint %d %x %x",handle,command.param1,rgba); + DrawStyle *style=(DrawStyle*)command.data; + switch (style->ft) { + case DrawStyle::Color: { + vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); + vgSetColor(handle,command.param1); + VGuint rgba; + rgba = vgGetColor((VGPaint)handle); + Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint %d %x %x",handle,command.param1,rgba); + } break; + case DrawStyle::GradientLinear: { + vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT); + VGfloat params[]={style->x1,style->y1,style->x2,style->y2,style->r}; + Log::getInstance()->log("OSD", Log::DEBUG, "Draw Gradient %d %g %g %g %g",handle,params[0],params[1],params[2],params[3]); + vgSetParameterfv(handle,VG_PAINT_LINEAR_GRADIENT,4,params); + + + + } break; + case DrawStyle::GradientRadial: { + vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT); + VGfloat params[]={style->x1,style->y1,style->x2,style->y2,style->r}; + vgSetParameterfv(handle,VG_PAINT_RADIAL_GRADIENT,5,params); + + + + } break; + }; + if (style->ft==DrawStyle::GradientLinear ||style->ft==DrawStyle::GradientRadial) { + VGfloat colorramp[5*5]; + colorramp[0+0*5]=0.f; + colorramp[1+0*5]=((float)style->red)/255.f; + colorramp[2+0*5]=((float)style->green)/255.f; + colorramp[3+0*5]=((float)style->blue)/255.f; + colorramp[4+0*5]=((float)style->alpha)/255.f; + for (int i=0;i<(style->num_colors-1);i++) { + colorramp[0+(i+1)*5]=style->grad_pos[i]; + colorramp[1+(i+1)*5]=((float)style->grad_col[i].red)/255.f; + colorramp[2+(i+1)*5]=((float)style->grad_col[i].green)/255.f; + colorramp[3+(i+1)*5]=((float)style->grad_col[i].blue)/255.f; + colorramp[4+(i+1)*5]=((float)style->grad_col[i].alpha)/255.f; + } + colorramp[0+(style->num_colors)*5]=1.f; + colorramp[1+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].red)/255.f; + colorramp[2+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].green)/255.f; + colorramp[3+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].blue)/255.f; + colorramp[4+(style->num_colors)*5]=((float)style->grad_col[style->num_colors-1].alpha)/255.f; + vgSetParameteri(handle, VG_PAINT_COLOR_RAMP_SPREAD_MODE,VG_COLOR_RAMP_SPREAD_REFLECT); + vgSetParameteri(handle, VG_PAINT_COLOR_RAMP_PREMULTIPLIED,VG_FALSE); + vgSetParameterfv(handle,VG_PAINT_COLOR_RAMP_STOPS,5+(style->num_colors)*5,colorramp); + } + return handle; } break; case OVGimageUploadLine: { diff --git a/surface.cc b/surface.cc index ba8f747..a1f7b60 100644 --- a/surface.cc +++ b/surface.cc @@ -301,7 +301,7 @@ void Surface::drawTTChar(int ox, int oy, int x, int y, cTeletextChar c) } void Surface::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, - unsigned int width, Colour& nextColour) { + unsigned int width, DrawStyle& nextColour) { startFastDraw(); int x, y; unsigned int bytesIn, bitsIn; diff --git a/surface.h b/surface.h index 4c5d4e6..b723256 100644 --- a/surface.h +++ b/surface.h @@ -76,7 +76,7 @@ class Surface virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c)=0; virtual void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)=0; virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel - virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); + virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour); virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0; virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0; virtual void screenShot(const char* fileName)=0; diff --git a/surfacevector.cc b/surfacevector.cc index aa2cc7b..fa9659f 100644 --- a/surfacevector.cc +++ b/surfacevector.cc @@ -235,11 +235,11 @@ void SurfaceVector::drawPoint(int x, int y, DrawStyle& c, bool fastdraw){ commands.push_back(SVGCommand(x,y,1,1,Point,ref)); if (!fastdraw) command_mutex.Unlock(); } -void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour) +void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour) { command_mutex.Lock(); ImageIndex image=osd->getMonoBitmapRef(base,width,height); - unsigned int ref=osd->getColorRef(nextColour); + unsigned int ref=osd->getStyleRef(nextColour); commands.push_back(SVGCommand(dx,dy,height,width,image,ref)); command_mutex.Unlock(); } diff --git a/surfacevector.h b/surfacevector.h index 76a882f..519abcd 100644 --- a/surfacevector.h +++ b/surfacevector.h @@ -52,7 +52,7 @@ class SurfaceVector : public Surface void drawVertLine(int x, int y1, int y2, const DrawStyle& c); void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region); void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel - void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); + void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour); int updateToScreen(int sx, int sy, int w, int h, int dx, int dy); diff --git a/vchannellist.cc b/vchannellist.cc index 65a4859..1646896 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -148,11 +148,21 @@ void VChannelList::doShowingBar() char showing[200]; sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions()); - +#ifndef GRADIENT_DRAWING rectangle(220, 385,160, 25, DrawStyle::VIEWBACKGROUND); +#endif drawText(showing, 220, 385, DrawStyle::LIGHTTEXT); } +void VChannelList::quickUpdate() { //only quick for plattform that need it! +#ifdef GRADIENT_DRAWING + draw(); +#else + sl.draw(); + doShowingBar(); +#endif +} + int VChannelList::handleCommand(int command) { switch(command) @@ -161,9 +171,8 @@ int VChannelList::handleCommand(int command) case Remote::UP: { sl.up(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } @@ -171,27 +180,24 @@ int VChannelList::handleCommand(int command) case Remote::DOWN: { sl.down(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } case Remote::SKIPBACK: { sl.pageUp(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } case Remote::SKIPFORWARD: { sl.pageDown(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } @@ -249,8 +255,7 @@ void VChannelList::processMessage(Message* m) { if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - sl.draw(); - doShowingBar(); + quickUpdate(); boxstack->update(this); } } diff --git a/vchannellist.h b/vchannellist.h index 3d60db2..589f6ab 100644 --- a/vchannellist.h +++ b/vchannellist.h @@ -38,7 +38,7 @@ class VChannelList : public TBBoxx { public: VChannelList(ULONG type); - ~VChannelList(); + virtual ~VChannelList(); void setList(ChannelList* chanList); void highlightChannel(Channel* channel); @@ -53,6 +53,7 @@ class VChannelList : public TBBoxx WSelectList sl; void doShowingBar(); + void quickUpdate(); }; #endif diff --git a/vepg.cc b/vepg.cc index 72edcae..7839ca4 100644 --- a/vepg.cc +++ b/vepg.cc @@ -237,8 +237,7 @@ void VEpg::draw() UINT keyx = chanListbox.getRootBoxOffsetX(); UINT keyy = chanListbox.getRootBoxOffsetY() + chanListbox.getHeight() + 2; - DrawStyle ref1 = DrawStyle(100, 100, 100, 255); //to do global definition for skin - rectangle(keyx, keyy, 605, getFontHeight() * 2 + 14, ref1); + rectangle(keyx, keyy, 605, getFontHeight() * 2 + 14, DrawStyle::DARKGREY); WSymbol w; TEMPADD(&w); @@ -261,40 +260,32 @@ void VEpg::draw() drawText(tr("OK"), keyx + 18, keyy + 20, DrawStyle::LIGHTTEXT); - DrawStyle ref2 = DrawStyle(200, 0, 0, 255); - rectangle(keyx + 72, keyy + 4, 104, getFontHeight() + 2, ref2); + rectangle(keyx + 72, keyy + 4, 104, getFontHeight() + 2, DrawStyle::RED); drawText(tr("Page up"), keyx + 74, keyy + 5, DrawStyle::LIGHTTEXT); - DrawStyle ref3 = DrawStyle(0, 200, 0, 255); - rectangle(keyx + 72, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, ref3); + rectangle(keyx + 72, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, DrawStyle::GREEN); drawText(tr("Page down"), keyx + 74, keyy + getFontHeight() + 9, DrawStyle::LIGHTTEXT); - DrawStyle ref4 = DrawStyle(200, 200, 0, 255); - rectangle(keyx + 180, keyy + 4, 104, getFontHeight() + 2, ref4); + rectangle(keyx + 180, keyy + 4, 104, getFontHeight() + 2, DrawStyle::YELLOW); drawText(tr("-24 hours"), keyx + 182, keyy + 5, DrawStyle::LIGHTTEXT); - DrawStyle ref5 = DrawStyle(0, 0, 200, 255); - rectangle(keyx + 180, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, ref5); + rectangle(keyx + 180, keyy + getFontHeight() + 8, 104, getFontHeight() + 2, DrawStyle::BLUE); drawText(tr("+24 hours"), keyx + 182, keyy + getFontHeight() + 9, DrawStyle::LIGHTTEXT); - DrawStyle ref6 = DrawStyle(180, 180, 180, 255); - rectangle(keyx + 290, keyy + 4, 180, getFontHeight() + 2, ref6); + rectangle(keyx + 290, keyy + 4, 180, getFontHeight() + 2, DrawStyle::GREY); drawText(tr("Guide / Back: Close"), keyx + 292 , keyy + 5, DrawStyle::LIGHTTEXT); - DrawStyle ref7 = DrawStyle(180, 180, 180, 255); - rectangle(keyx + 290, keyy + getFontHeight() + 8, 180, getFontHeight() + 2, ref7); + rectangle(keyx + 290, keyy + getFontHeight() + 8, 180, getFontHeight() + 2, DrawStyle::GREY); DrawStyle red = DrawStyle(130, 0, 0); drawText(tr("Rec: Set timer"), keyx + 292, keyy + getFontHeight() + 9, red); - DrawStyle ref8 = DrawStyle(180, 180, 180, 255); - rectangle(keyx + 474, keyy + 4, 128, getFontHeight() + 2, ref8); + rectangle(keyx + 474, keyy + 4, 128, getFontHeight() + 2, DrawStyle::GREY); w.nextSymbol = WSymbol::PLAY; w.setPosition(keyx + 476, keyy + 5); w.draw(); drawText(tr("Sel channel"), keyx + 496, keyy + 5, DrawStyle::LIGHTTEXT); - DrawStyle ref9 = DrawStyle(180, 180, 180, 255); - rectangle(keyx + 474, keyy + getFontHeight() + 8, 128, getFontHeight() + 2, ref9); + rectangle(keyx + 474, keyy + getFontHeight() + 8, 128, getFontHeight() + 2, DrawStyle::GREY); drawText(tr("Go: Preview"), keyx + 476, keyy + getFontHeight() + 9, DrawStyle::LIGHTTEXT); diff --git a/vrecordinglist.cc b/vrecordinglist.cc index 6689ddd..65dd572 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -187,13 +187,23 @@ void VRecordingList::doShowingBar() { int topOption = sl.getTopOption() + 1; if (sl.getNumOptions() == 0) topOption = 0; - +#ifndef GRADIENT_DRAWING rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND); +#endif char showing[200]; sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions()); drawText(showing, 220, 385, DrawStyle::LIGHTTEXT); } +void VRecordingList::quickUpdate() { //only quick for plattform that need it! +#ifdef GRADIENT_DRAWING + draw(); +#else + sl.draw(); + doShowingBar(); +#endif +} + void VRecordingList::processMessage(Message* m) { Log::getInstance()->log("VRecordingList", Log::DEBUG, "Got message value %lu", m->message); @@ -202,8 +212,7 @@ void VRecordingList::processMessage(Message* m) { if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - sl.draw(); - doShowingBar(); + quickUpdate(); boxstack->update(this); } } @@ -425,9 +434,8 @@ int VRecordingList::handleCommand(int command) case Remote::UP: { sl.up(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } @@ -435,27 +443,24 @@ int VRecordingList::handleCommand(int command) case Remote::DOWN: { sl.down(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } case Remote::SKIPBACK: { sl.pageUp(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } case Remote::SKIPFORWARD: { sl.pageDown(); - sl.draw(); + quickUpdate(); - doShowingBar(); boxstack->update(this); return 2; } diff --git a/vrecordinglist.h b/vrecordinglist.h index 0e60dba..d2f11db 100644 --- a/vrecordinglist.h +++ b/vrecordinglist.h @@ -40,7 +40,7 @@ class VRecordingList : public TBBoxx { public: VRecordingList(); - ~VRecordingList(); + virtual ~VRecordingList(); int handleCommand(int command); void processMessage(Message* m); @@ -56,6 +56,7 @@ class VRecordingList : public TBBoxx WSelectList sl; + void quickUpdate(); void doShowingBar(); void doDeleteSelected(); int doPlay(bool resume); diff --git a/vtimerlist.cc b/vtimerlist.cc index 58e0501..e781354 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -176,22 +176,33 @@ void VTimerList::drawShowing() { int topOption = sl.getTopOption() + 1; if (sl.getNumOptions() == 0) topOption = 0; - +#ifndef GRADIENT_DRAWING rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND); +#endif char showing[200]; sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions()); drawText(showing, 220, 385, DrawStyle::LIGHTTEXT); } +void VTimerList::quickUpdate() { //only quick for plattform that need it! +#ifdef GRADIENT_DRAWING + draw(); +#else + sl.draw(); + drawShowing(); + drawIndicators(); +#endif +} + void VTimerList::drawIndicators() { int top = sl.getTopOption(); int bottom = sl.getBottomOption(); int yinc = getFontHeight() + 1; RecTimer* recTimer; - +#ifndef GRADIENT_DRAWING rectangle(6, 44, 18, 15*yinc, DrawStyle::VIEWBACKGROUND); - +#endif // The indexes recorded from the wselectlist into the index member of the RecTimer // Is the same as the position in the vector of RecTimers // Because they are in order, they don't change order and wselectlist starts from 0 up consecutively @@ -246,9 +257,7 @@ int VTimerList::handleCommand(int command) case Remote::UP: { sl.up(); - sl.draw(); - drawShowing(); - drawIndicators(); + quickUpdate(); BoxStack::getInstance()->update(this); return 2; } @@ -256,27 +265,21 @@ int VTimerList::handleCommand(int command) case Remote::DOWN: { sl.down(); - sl.draw(); - drawShowing(); - drawIndicators(); + quickUpdate(); BoxStack::getInstance()->update(this); return 2; } case Remote::SKIPBACK: { sl.pageUp(); - sl.draw(); - drawShowing(); - drawIndicators(); + quickUpdate(); BoxStack::getInstance()->update(this); return 2; } case Remote::SKIPFORWARD: { sl.pageDown(); - sl.draw(); - drawShowing(); - drawIndicators(); + quickUpdate(); BoxStack::getInstance()->update(this); return 2; } @@ -309,7 +312,7 @@ void VTimerList::processMessage(Message* m) { if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY())) { - sl.draw(); + quickUpdate(); BoxStack::getInstance()->update(this); } } diff --git a/vtimerlist.h b/vtimerlist.h index a7f6a10..8bd0d3b 100644 --- a/vtimerlist.h +++ b/vtimerlist.h @@ -55,6 +55,7 @@ class VTimerList : public TBBoxx, public TimerReceiver void drawShowing(); void drawData(); void drawIndicators(); + void quickUpdate(); Region clockRegion; Region indicatorsRegion; diff --git a/wsymbol.h b/wsymbol.h index 026627d..4975470 100644 --- a/wsymbol.h +++ b/wsymbol.h @@ -32,7 +32,7 @@ class WSymbol : public Boxx //TODO add vector based Symbols void draw(); UCHAR nextSymbol; - Colour nextColour; + DrawStyle nextColour; bool mouseLBDOWN(int x, int y); -- 2.39.2