diff options
author | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
commit | 75e8452b6e6a2bf4fb2f588aa00b428a60d873b5 (patch) | |
tree | f29541d55309487a94bd1d38e8b53bb3dde9aec6 /engines/gob/video.h | |
parent | 48ee83b88957dab86bc763e9ef21a70179fa8679 (diff) | |
parent | e9f50882ea5b6beeefa994040be9d3bab6a1f107 (diff) | |
download | scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.gz scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.bz2 scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.zip |
OPENGL: Merged from trunk, from rev 52105 to 53396.
This includes an rather hacky attempt to merge all the recent gp2x backend
changes into the branch. I suppose the gp2x backend and probably all new
backends, i.e. gph, dingux etc., might not compile anymore.
Since I have no way of testing those it would be nice if porters could look
into getting those up to speed in this branch.
svn-id: r53399
Diffstat (limited to 'engines/gob/video.h')
-rw-r--r-- | engines/gob/video.h | 133 |
1 files changed, 26 insertions, 107 deletions
diff --git a/engines/gob/video.h b/engines/gob/video.h index b8a46598b7..5c49042496 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -31,29 +31,23 @@ #include "common/ptr.h" #include "gob/gob.h" - -namespace Graphics { - class PaletteLUT; -} +#include "gob/surface.h" namespace Gob { class Font { public: + Font(const byte *data); + ~Font(); + uint8 getCharWidth (uint8 c) const; uint8 getCharWidth () const; uint8 getCharHeight() const; - uint16 getCharCount () const; - uint8 getFirstChar () const; - uint8 getLastChar () const; - uint8 getCharSize () const; bool isMonospaced() const; - const byte *getCharData(uint8 c) const; - - Font(const byte *data); - ~Font(); + void drawLetter(Surface &surf, uint8 c, uint16 x, uint16 y, + uint32 color1, uint32 color2, bool transp) const; private: const byte *_dataPtr; @@ -66,46 +60,19 @@ private: uint8 _endItem; int8 _itemSize; int8 _bitWidth; -}; - -// Some Surfaces are simultaneous in Draw::spritesArray and discrete -// variables, so if in doubt you should use a SurfaceDescPtr shared -// pointer object to refer to any SurfaceDesc. -class SurfaceDesc { -public: - int16 _vidMode; - - int16 getWidth() const { return _width; } - int16 getHeight() const { return _height; } - byte *getVidMem() { return _vidMem; } - const byte *getVidMem() const { return _vidMem; } - bool hasOwnVidMem() const { return _ownVidMem; } - void setVidMem(byte *vidMem); - void resize(int16 width, int16 height); - void swap(SurfaceDesc &surf); - - SurfaceDesc(int16 vidMode, int16 width, int16 height, byte *vidMem = 0); - ~SurfaceDesc() { if (_ownVidMem) delete[] _vidMem; } - -private: - int16 _width; - int16 _height; - byte *_vidMem; - bool _ownVidMem; + uint16 getCharCount() const; + const byte *getCharData(uint8 c) const; }; -typedef Common::SharedPtr<SurfaceDesc> SurfaceDescPtr; - - class Video { public: -#define GDR_VERSION 4 +#define GDR_VERSION 4 -#define PRIMARY_SURFACE 0x80 -#define RETURN_PRIMARY 0x01 -#define DISABLE_SPR_ALLOC 0x20 -#define SCUMMVM_CURSOR 0x100 +#define PRIMARY_SURFACE 0x80 +#define RETURN_PRIMARY 0x01 +#define DISABLE_SPR_ALLOC 0x20 +#define SCUMMVM_CURSOR 0x100 #include "common/pack-start.h" // START STRUCT PACKING @@ -132,7 +99,7 @@ public: int16 _scrollOffsetX; int16 _scrollOffsetY; - SurfaceDescPtr _splitSurf; + SurfacePtr _splitSurf; int16 _splitHeight1; int16 _splitHeight2; int16 _splitStart; @@ -140,11 +107,8 @@ public: int16 _screenDeltaX; int16 _screenDeltaY; - Graphics::PaletteLUT *_palLUT; - - void freeDriver(); void initPrimary(int16 mode); - SurfaceDescPtr initSurfDesc(int16 vidMode, int16 width, + SurfacePtr initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags); void setSize(bool defaultTo1XScaler); @@ -154,25 +118,9 @@ public: void waitRetrace(bool mouse = true); void sparseRetrace(int max); - void putPixel(int16 x, int16 y, int16 color, SurfaceDesc &dest); - virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, - int16 right, int16 bottom, int16 color); - void drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, - int16 color); - void drawCircle(SurfaceDesc &dest, int16 x0, int16 y0, - int16 radius, int16 color); - void clearSurf(SurfaceDesc &dest); - void drawSprite(SurfaceDesc &source, SurfaceDesc &dest, - int16 left, int16 top, int16 right, int16 bottom, - int16 x, int16 y, int16 transp); - void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, - int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp); - void drawLetter(int16 item, int16 x, int16 y, const Font &font, - int16 color1, int16 color2, int16 transp, SurfaceDesc &dest); void drawPackedSprite(byte *sprBuf, int16 width, int16 height, - int16 x, int16 y, int16 transp, SurfaceDesc &dest); - void drawPackedSprite(const char *path, SurfaceDesc &dest, - int width = 320); + int16 x, int16 y, int16 transp, Surface &dest); + void drawPackedSprite(const char *path, Surface &dest, int width = 320); void setPalColor(byte *pal, byte red, byte green, byte blue) { pal[0] = red << 2; @@ -196,18 +144,12 @@ public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 x, int16 y, int16 transp, - SurfaceDesc &destDesc) = 0; - - virtual void init() {} - - virtual void setPrePalette() { } + Surface &destDesc) = 0; Video(class GobEngine *vm); virtual ~Video(); protected: - class VideoDriver *_videoDriver; - bool _dirtyAll; Common::List<Common::Rect> _dirtyRects; @@ -216,16 +158,13 @@ protected: GobEngine *_vm; - char initDriver(int16 vidMode); - - void initOSD(); - void drawOSDText(const char *text); + void drawPacked(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, Surface &dest); }; class Video_v1 : public Video { public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc &destDesc); + int16 x, int16 y, int16 transp, Surface &destDesc); Video_v1(GobEngine *vm); virtual ~Video_v1() {} @@ -234,7 +173,7 @@ public: class Video_v2 : public Video_v1 { public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc &destDesc); + int16 x, int16 y, int16 transp, Surface &destDesc); Video_v2(GobEngine *vm); virtual ~Video_v2() {} @@ -243,14 +182,7 @@ public: class Video_v6 : public Video_v2 { public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, - int16 x, int16 y, int16 transp, SurfaceDesc &destDesc); - - virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, - int16 right, int16 bottom, int16 color); - - virtual void init(); - - virtual void setPrePalette(); + int16 x, int16 y, int16 transp, Surface &destDesc); Video_v6(GobEngine *vm); virtual ~Video_v6() {} @@ -260,30 +192,17 @@ private: void buildPalLUT(); - void shadeRect(SurfaceDesc &dest, + void shadeRect(Surface &dest, int16 left, int16 top, int16 right, int16 bottom, byte color, byte strength); - void drawPacked(const byte *sprBuf, int16 x, int16 y, SurfaceDesc &surfDesc); - void drawYUVData(const byte *srcData, SurfaceDesc &destDesc, + void drawPacked(const byte *sprBuf, int16 x, int16 y, Surface &surfDesc); + void drawYUVData(const byte *srcData, Surface &destDesc, int16 width, int16 height, int16 x, int16 y); - void drawYUV(SurfaceDesc &destDesc, int16 x, int16 y, + void drawYUV(Surface &destDesc, int16 x, int16 y, int16 dataWidth, int16 dataHeight, int16 width, int16 height, const byte *dataY, const byte *dataU, const byte *dataV); }; -class VideoDriver { -public: - VideoDriver() {} - virtual ~VideoDriver() {} - virtual void drawSprite(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; - virtual void drawSpriteDouble(SurfaceDesc &source, SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; - virtual void fillRect(SurfaceDesc &dest, int16 left, int16 top, int16 right, int16 bottom, byte color) = 0; - virtual void putPixel(int16 x, int16 y, byte color, SurfaceDesc &dest) = 0; - virtual void drawLetter(unsigned char item, int16 x, int16 y, const Font &font, byte color1, byte color2, byte transp, SurfaceDesc &dest) = 0; - virtual void drawLine(SurfaceDesc &dest, int16 x0, int16 y0, int16 x1, int16 y1, byte color) = 0; - virtual void drawPackedSprite(byte *sprBuf, int16 width, int16 height, int16 x, int16 y, byte transp, SurfaceDesc &dest) = 0; -}; - } // End of namespace Gob #endif // GOB_VIDEO_H |