From 704b948b1a3c91ec863a98dc2a024de428302efd Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Thu, 17 May 2012 12:13:07 +0200 Subject: [PATCH] Compilation fixes --- ledwin.h | 2 +- osd.h | 104 +++++------ surfacemvp.h | 496 +++++++++++++++++++++++++-------------------------- 3 files changed, 303 insertions(+), 299 deletions(-) diff --git a/ledwin.h b/ledwin.h index 821f5b6..099bf15 100644 --- a/ledwin.h +++ b/ledwin.h @@ -29,7 +29,7 @@ class LedWin : public Led { public: LedWin(); - ~LedWin(); + virtual ~LedWin(); int init(int device); int shutdown(); diff --git a/osd.h b/osd.h index bd1eba5..f8b0c92 100644 --- a/osd.h +++ b/osd.h @@ -1,50 +1,54 @@ -/* - Copyright 2004-2005 Chris Tallon - - This file is part of VOMP. - - VOMP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - VOMP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef OSD_H -#define OSD_H - -#include - -class Surface; - -class Osd -{ - public: - Osd(); - virtual ~Osd(); - static Osd* getInstance(); - - virtual int init(void* device)=0; - virtual int shutdown()=0; - bool isInitted() {return initted;}; - - virtual int getFD()=0; - - virtual void screenShot(char* fileName)=0; - - protected: - static Osd* instance; - int initted; - Surface* screen; - int fdOsd; -}; - -#endif +/* + Copyright 2004-2005 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef OSD_H +#define OSD_H + +#include + +class Surface; + +class Osd +{ + public: + Osd(); + virtual ~Osd(); + static Osd* getInstance(); + + virtual int init(void* device)=0; + virtual int shutdown()=0; + + virtual Surface * createNewSurface()=0; // For Boxx + virtual int charSet() {return 1;}; + + bool isInitted() {return initted;}; + + virtual int getFD()=0; + + virtual void screenShot(const char* fileName)=0; + + protected: + static Osd* instance; + int initted; + Surface* screen; + int fdOsd; +}; + +#endif diff --git a/surfacemvp.h b/surfacemvp.h index 91598b5..394cede 100644 --- a/surfacemvp.h +++ b/surfacemvp.h @@ -1,248 +1,248 @@ -/* - Copyright 2004-2005 Chris Tallon - Portions copyright 2004 Jon Gettler - - This file is part of VOMP. - - VOMP is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - VOMP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with VOMP; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef SURFACEMVP_H -#define SURFACEMVP_H - -#include -#include -#include -#include -#include - -extern "C" -{ - #include -} - -#include "defines.h" -#include "surface.h" - -// Structures for surface management - -typedef struct -{ - unsigned long num; - unsigned long unknown[4]; - unsigned long width; - unsigned long height; - char unknown2; -} stbgfx_display_t; - -typedef struct -{ - unsigned long unknown; - unsigned long win_unknown; - unsigned long addr; - unsigned long size; - unsigned long unknown2; - unsigned long width; - unsigned long height; - unsigned long unknown3; - unsigned long unknown4; - unsigned long width2; - unsigned long unknown5; - unsigned long unknown6; -} stbgfx_map_item_t; - -typedef struct { - stbgfx_map_item_t map[3]; - unsigned long other[2]; -} stbgfx_map_t; - -typedef struct -{ - unsigned long handle; /* surface handle */ - unsigned long width; - unsigned long height; - unsigned long flags; - long unknown; //unsigned long - unsigned long depth; /* number of subplanes */ -} stbgfx_sfc_t; - -typedef struct -{ - stbgfx_display_t display; - stbgfx_map_t map; - stbgfx_sfc_t sfc; - unsigned char *base[3]; -} osd_surface_t; - - -// Structures for surface drawing - -typedef struct -{ - unsigned long handle; - unsigned long x; - unsigned long y; - unsigned long width; - unsigned long height; - unsigned long colour; -} osd_fillblt_t; - -typedef struct { - unsigned long dst_handle; - unsigned long dst_x; - unsigned long dst_y; - unsigned long width; - unsigned long height; - unsigned long src_handle; - unsigned long src_x; - unsigned long src_y; - unsigned long u1; - unsigned long u2; - unsigned char u3; -} osd_bitblt_t; - -// Surface ioctls - -#define GFX_FB_SFC_ALLOC _IOWR(0xfb,1,int*) -#define GFX_FB_SFC_FREE _IOW(0xfb,2,int) -#define GFX_FB_MAP _IOWR(0xfb,3,int*) -#define GFX_FB_SFC_UNMAP _IOW(0xfb,4,int) -#define GFX_FB_SET_PAL_1 _IOWR(0xfb,5,int*) -#define GFX_FB_SET_PAL_2 _IOW(0xfb,6,int*) -#define GFX_FB_OSD_SURFACE _IO(0xfb,7) -#define GFX_FB_SFC_SET_SHARE _IOW(0xfb,8,int) -#define GFX_FB_OSD_CUR_SETATTR _IOW(0xfb,9,int*) -#define GFX_FB_ATTACH _IOW(0xfb,11,int) -#define GFX_FB_SFC_DETACH _IOW(0xfb,12,int*) -#define GFX_FB_MOVE_DISPLAY _IOWR(0xfb,13,int) -#define GFX_FB_SET_DISPLAY _IOW(0xfb,14,int) -#define GFX_FB_OSD_CUR_MOVE_1 _IOW(0xfb,15,int*) -#define GFX_FB_OSD_CUR_MOVE_2 _IOW(0xfb,16,int) -#define GFX_FB_SET_OSD _IOW(0xfb,18,int) -#define GFX_FB_SET_DISP_CTRL _IOW(0xfb,21,int*) -#define GFX_FB_GET_DISP_CTRL _IOWR(0xfb,22,int*) -#define GFX_FB_SET_VIS_DEV_CTL _IOWR(0xfb,23,int*) -#define GFX_FB_GET_VIS_DEV_CTL _IOWR(0xfb,24,int*) -#define GFX_FB_OSD_BITBLT _IOW(0xfb,51,osd_bitblt_t*) -#define GFX_FB_OSD_FILLBLT _IOW(0xfb,53,osd_fillblt_t*) -#define GFX_FB_OSD_ADVFILLBLT _IOW(0xfb,54,osd_afillblt_t*) -#define GFX_FB_OSD_BLEND _IOW(0xfb,55,int*) -#define GFX_FB_OSD_ADVBLEND _IOW(0xfb,56,int*) -#define GFX_FB_OSD_RESIZE _IOW(0xfb,58,int*) -#define GFX_FB_ENGINE_WAIT _IOW(0xfb,60,int) -#define GFX_FB_RESET_ENGINE _IO(0xfb,61) -#define GFX_FB_SET_ENGINE_MODE _IOW(0xfb,62,int) -#define GFX_FB_GET_ENGINE_MODE _IO(0xfb,63) -#define GFX_FB_GET_SFC_INFO _IO(0xfb,64,int*) -#define GFX_FB_OSD_SFC_CLIP _IOW(0xfb,65,osd_clip_rec_t*) -#define GFX_FB_OSD_COLOURKEY _IOW(0xfb,67,int*) -#define GFX_FB_GET_SFC_PSEUDO _IOWR(0xfb,68,int*) - -class SurfaceMVP : public Surface -{ - public: - SurfaceMVP(int id = 0); - ~SurfaceMVP(); - - int create(UINT width, UINT height); - void display(); - unsigned long getSurfaceHandle(); - - int fillblt(int x, int y, int width, int height, unsigned int rgba); - void drawPixel(int x, int y, unsigned int c, bool fastdraw=false); - void drawPixel(int x, int y, Colour& c, bool fastdraw=false); - void drawHorzLine(int x1, int x2, int y, unsigned int c); - void drawVertLine(int x, int y1, int y2, unsigned int c); - void drawBitmap(int x, int y, const Bitmap& bm); - int updateToScreen(int sx, int sy, int w, int h, int dx, int dy); - void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b); - void screenShot(char* fileName); - - static void initConversionTables() - { - initConversionTables(100,100,100); - } - //init tables with factors for R,G,B - each in percent - static void initConversionTables(int r, int g, int b); - - int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy); - - private: - int fdOsd; - osd_surface_t surface; - - void yuv2rgb(int y, int u, int v, unsigned char* pr, unsigned char* pg, unsigned char* pb); - /* - * rgb2yuv() - convert an RGB pixel to YUV - */ - inline void rgb2yuv(unsigned char r, unsigned char g, unsigned char b, unsigned char *y, unsigned char *u, unsigned char *v) - { - int Y, U, V; - - Y = conv_YB[b] + conv_YG[g] + conv_YR[r]; - U = conv_UB[b] + conv_UG[g] + conv_UR[r] + 128; - V = conv_VB[b] + conv_VG[g] + conv_VR[r] + 128; - - if (Y > 255) - Y = 255; - else if (Y < 0) - Y = 0; - if (U > 255) - U = 255; - else if (U < 0) - U = 0; - if (V > 255) - V = 255; - else if (V < 0) - V = 0; - - *y = Y; - *u = U; - *v = V; - } - - - // Implicit inlines - void c2rgba(unsigned long c, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) - { - *a = (c & 0xff000000) >> 24; - *r = (c & 0x00ff0000) >> 16; - *g = (c & 0x0000ff00) >> 8; - *b = (c & 0x000000ff); - } - - static int conv_YB[256]; - static int conv_YG[256]; - static int conv_YR[256]; - static int conv_UB[256]; - static int conv_UG[256]; - static int conv_UR[256]; - static int conv_VB[256]; - static int conv_VG[256]; - static int conv_VR[256]; - - static int conv_BY[256]; - static int conv_GY[256]; - static int conv_RY[256]; - static int conv_BU[256]; - static int conv_GU[256]; - static int conv_RU[256]; - static int conv_BV[256]; - static int conv_GV[256]; - static int conv_RV[256]; - -}; - -#endif +/* + Copyright 2004-2005 Chris Tallon + Portions copyright 2004 Jon Gettler + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef SURFACEMVP_H +#define SURFACEMVP_H + +#include +#include +#include +#include +#include + +extern "C" +{ + #include +} + +#include "defines.h" +#include "surface.h" + +// Structures for surface management + +typedef struct +{ + unsigned long num; + unsigned long unknown[4]; + unsigned long width; + unsigned long height; + char unknown2; +} stbgfx_display_t; + +typedef struct +{ + unsigned long unknown; + unsigned long win_unknown; + unsigned long addr; + unsigned long size; + unsigned long unknown2; + unsigned long width; + unsigned long height; + unsigned long unknown3; + unsigned long unknown4; + unsigned long width2; + unsigned long unknown5; + unsigned long unknown6; +} stbgfx_map_item_t; + +typedef struct { + stbgfx_map_item_t map[3]; + unsigned long other[2]; +} stbgfx_map_t; + +typedef struct +{ + unsigned long handle; /* surface handle */ + unsigned long width; + unsigned long height; + unsigned long flags; + long unknown; //unsigned long + unsigned long depth; /* number of subplanes */ +} stbgfx_sfc_t; + +typedef struct +{ + stbgfx_display_t display; + stbgfx_map_t map; + stbgfx_sfc_t sfc; + unsigned char *base[3]; +} osd_surface_t; + + +// Structures for surface drawing + +typedef struct +{ + unsigned long handle; + unsigned long x; + unsigned long y; + unsigned long width; + unsigned long height; + unsigned long colour; +} osd_fillblt_t; + +typedef struct { + unsigned long dst_handle; + unsigned long dst_x; + unsigned long dst_y; + unsigned long width; + unsigned long height; + unsigned long src_handle; + unsigned long src_x; + unsigned long src_y; + unsigned long u1; + unsigned long u2; + unsigned char u3; +} osd_bitblt_t; + +// Surface ioctls + +#define GFX_FB_SFC_ALLOC _IOWR(0xfb,1,int*) +#define GFX_FB_SFC_FREE _IOW(0xfb,2,int) +#define GFX_FB_MAP _IOWR(0xfb,3,int*) +#define GFX_FB_SFC_UNMAP _IOW(0xfb,4,int) +#define GFX_FB_SET_PAL_1 _IOWR(0xfb,5,int*) +#define GFX_FB_SET_PAL_2 _IOW(0xfb,6,int*) +#define GFX_FB_OSD_SURFACE _IO(0xfb,7) +#define GFX_FB_SFC_SET_SHARE _IOW(0xfb,8,int) +#define GFX_FB_OSD_CUR_SETATTR _IOW(0xfb,9,int*) +#define GFX_FB_ATTACH _IOW(0xfb,11,int) +#define GFX_FB_SFC_DETACH _IOW(0xfb,12,int*) +#define GFX_FB_MOVE_DISPLAY _IOWR(0xfb,13,int) +#define GFX_FB_SET_DISPLAY _IOW(0xfb,14,int) +#define GFX_FB_OSD_CUR_MOVE_1 _IOW(0xfb,15,int*) +#define GFX_FB_OSD_CUR_MOVE_2 _IOW(0xfb,16,int) +#define GFX_FB_SET_OSD _IOW(0xfb,18,int) +#define GFX_FB_SET_DISP_CTRL _IOW(0xfb,21,int*) +#define GFX_FB_GET_DISP_CTRL _IOWR(0xfb,22,int*) +#define GFX_FB_SET_VIS_DEV_CTL _IOWR(0xfb,23,int*) +#define GFX_FB_GET_VIS_DEV_CTL _IOWR(0xfb,24,int*) +#define GFX_FB_OSD_BITBLT _IOW(0xfb,51,osd_bitblt_t*) +#define GFX_FB_OSD_FILLBLT _IOW(0xfb,53,osd_fillblt_t*) +#define GFX_FB_OSD_ADVFILLBLT _IOW(0xfb,54,osd_afillblt_t*) +#define GFX_FB_OSD_BLEND _IOW(0xfb,55,int*) +#define GFX_FB_OSD_ADVBLEND _IOW(0xfb,56,int*) +#define GFX_FB_OSD_RESIZE _IOW(0xfb,58,int*) +#define GFX_FB_ENGINE_WAIT _IOW(0xfb,60,int) +#define GFX_FB_RESET_ENGINE _IO(0xfb,61) +#define GFX_FB_SET_ENGINE_MODE _IOW(0xfb,62,int) +#define GFX_FB_GET_ENGINE_MODE _IO(0xfb,63) +#define GFX_FB_GET_SFC_INFO _IO(0xfb,64,int*) +#define GFX_FB_OSD_SFC_CLIP _IOW(0xfb,65,osd_clip_rec_t*) +#define GFX_FB_OSD_COLOURKEY _IOW(0xfb,67,int*) +#define GFX_FB_GET_SFC_PSEUDO _IOWR(0xfb,68,int*) + +class SurfaceMVP : public Surface +{ + public: + SurfaceMVP(int id = 0); + ~SurfaceMVP(); + + int create(UINT width, UINT height); + void display(); + unsigned long getSurfaceHandle(); + + int fillblt(int x, int y, int width, int height, unsigned int rgba); + void drawPixel(int x, int y, unsigned int c, bool fastdraw=false); + void drawPixel(int x, int y, Colour& c, bool fastdraw=false); + void drawHorzLine(int x1, int x2, int y, unsigned int c); + void drawVertLine(int x, int y1, int y2, unsigned int c); + void drawBitmap(int x, int y, const Bitmap& bm); + int updateToScreen(int sx, int sy, int w, int h, int dx, int dy); + void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b); + void screenShot(const char* fileName); + + static void initConversionTables() + { + initConversionTables(100,100,100); + } + //init tables with factors for R,G,B - each in percent + static void initConversionTables(int r, int g, int b); + + int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy); + + private: + int fdOsd; + osd_surface_t surface; + + void yuv2rgb(int y, int u, int v, unsigned char* pr, unsigned char* pg, unsigned char* pb); + /* + * rgb2yuv() - convert an RGB pixel to YUV + */ + inline void rgb2yuv(unsigned char r, unsigned char g, unsigned char b, unsigned char *y, unsigned char *u, unsigned char *v) + { + int Y, U, V; + + Y = conv_YB[b] + conv_YG[g] + conv_YR[r]; + U = conv_UB[b] + conv_UG[g] + conv_UR[r] + 128; + V = conv_VB[b] + conv_VG[g] + conv_VR[r] + 128; + + if (Y > 255) + Y = 255; + else if (Y < 0) + Y = 0; + if (U > 255) + U = 255; + else if (U < 0) + U = 0; + if (V > 255) + V = 255; + else if (V < 0) + V = 0; + + *y = Y; + *u = U; + *v = V; + } + + + // Implicit inlines + void c2rgba(unsigned long c, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) + { + *a = (c & 0xff000000) >> 24; + *r = (c & 0x00ff0000) >> 16; + *g = (c & 0x0000ff00) >> 8; + *b = (c & 0x000000ff); + } + + static int conv_YB[256]; + static int conv_YG[256]; + static int conv_YR[256]; + static int conv_UB[256]; + static int conv_UG[256]; + static int conv_UR[256]; + static int conv_VB[256]; + static int conv_VG[256]; + static int conv_VR[256]; + + static int conv_BY[256]; + static int conv_GY[256]; + static int conv_RY[256]; + static int conv_BU[256]; + static int conv_GU[256]; + static int conv_RU[256]; + static int conv_BV[256]; + static int conv_GV[256]; + static int conv_RV[256]; + +}; + +#endif -- 2.39.2