diff options
Diffstat (limited to 'engines/gob/video.h')
-rw-r--r-- | engines/gob/video.h | 114 |
1 files changed, 34 insertions, 80 deletions
diff --git a/engines/gob/video.h b/engines/gob/video.h index d30a486189..498f6d8650 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -31,25 +31,23 @@ #include "common/ptr.h" #include "gob/gob.h" +#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; @@ -62,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 @@ -128,7 +99,7 @@ public: int16 _scrollOffsetX; int16 _scrollOffsetY; - SurfaceDescPtr _splitSurf; + SurfacePtr _splitSurf; int16 _splitHeight1; int16 _splitHeight2; int16 _splitStart; @@ -138,7 +109,7 @@ public: 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); @@ -148,25 +119,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; @@ -190,7 +145,7 @@ public: virtual char spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 x, int16 y, int16 transp, - SurfaceDesc &destDesc) = 0; + Surface &destDesc) = 0; Video(class GobEngine *vm); virtual ~Video(); @@ -207,12 +162,14 @@ protected: GobEngine *_vm; char initDriver(int16 vidMode); + + 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() {} @@ -221,7 +178,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() {} @@ -230,10 +187,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); + int16 x, int16 y, int16 transp, Surface &destDesc); Video_v6(GobEngine *vm); virtual ~Video_v6() {} @@ -243,13 +197,13 @@ 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); }; @@ -258,13 +212,13 @@ 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; + virtual void drawSprite(Surface &source, Surface &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; + virtual void drawSpriteDouble(Surface &source, Surface &dest, int16 left, int16 top, int16 right, int16 bottom, int16 x, int16 y, int16 transp) = 0; + virtual void fillRect(Surface &dest, int16 left, int16 top, int16 right, int16 bottom, byte color) = 0; + virtual void putPixel(int16 x, int16 y, byte color, Surface &dest) = 0; + virtual void drawLetter(unsigned char item, int16 x, int16 y, const Font &font, byte color1, byte color2, byte transp, Surface &dest) = 0; + virtual void drawLine(Surface &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, Surface &dest) = 0; }; } // End of namespace Gob |