Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 244 | chris | 1 | #ifndef __MEMORYIMAGE_H__ |
| 2 | #define __MEMORYIMAGE_H__ |
||
| 3 | |||
| 4 | #include "Image.h" |
||
| 5 | |||
| 6 | #define OPTIMIZE_SOFTWARE_DRAWING |
||
| 7 | #ifdef OPTIMIZE_SOFTWARE_DRAWING |
||
| 8 | extern bool gOptimizeSoftwareDrawing; |
||
| 9 | #endif |
||
| 10 | |||
| 11 | namespace Sexy |
||
| 12 | { |
||
| 13 | |||
| 14 | const ulong MEMORYCHECK_ID = 0x4BEEFADE; |
||
| 15 | |||
| 16 | class NativeDisplay; |
||
| 17 | class SexyAppBase; |
||
| 18 | |||
| 19 | class MemoryImage : public Image |
||
| 20 | { |
||
| 21 | public: |
||
| 22 | ulong* mBits; |
||
| 23 | int mBitsChangedCount; |
||
| 24 | void* mD3DData; |
||
| 25 | DWORD mD3DFlags; // see D3DInterface.h for possible values |
||
| 26 | |||
| 27 | ulong* mColorTable; |
||
| 28 | uchar* mColorIndices; |
||
| 29 | |||
| 30 | bool mForcedMode; |
||
| 31 | bool mHasTrans; |
||
| 32 | bool mHasAlpha; |
||
| 33 | bool mIsVolatile; |
||
| 34 | bool mPurgeBits; |
||
| 35 | bool mWantPal; |
||
| 36 | |||
| 37 | ulong* mNativeAlphaData; |
||
| 38 | uchar* mRLAlphaData; |
||
| 39 | uchar* mRLAdditiveData; |
||
| 40 | |||
| 41 | bool mBitsChanged; |
||
| 42 | SexyAppBase* mApp; |
||
| 43 | |||
| 44 | private: |
||
| 45 | void Init(); |
||
| 46 | |||
| 47 | public: |
||
| 48 | virtual void* GetNativeAlphaData(NativeDisplay *theNative); |
||
| 49 | virtual uchar* GetRLAlphaData(); |
||
| 50 | virtual uchar* GetRLAdditiveData(NativeDisplay *theNative); |
||
| 51 | virtual void PurgeBits(); |
||
| 52 | virtual void DeleteSWBuffers(); |
||
| 53 | virtual void Delete3DBuffers(); |
||
| 54 | virtual void DeleteExtraBuffers(); |
||
| 55 | virtual void ReInit(); |
||
| 56 | |||
| 57 | virtual void BitsChanged(); |
||
| 58 | virtual void CommitBits(); |
||
| 59 | |||
| 60 | virtual void DeleteNativeData(); |
||
| 61 | |||
| 62 | void NormalBlt(Image* theImage, int theX, int theY, const Rect& theSrcRect, const Color& theColor); |
||
| 63 | void AdditiveBlt(Image* theImage, int theX, int theY, const Rect& theSrcRect, const Color& theColor); |
||
| 64 | |||
| 65 | void NormalDrawLine(double theStartX, double theStartY, double theEndX, double theEndY, const Color& theColor); |
||
| 66 | void AdditiveDrawLine(double theStartX, double theStartY, double theEndX, double theEndY, const Color& theColor); |
||
| 67 | |||
| 68 | void NormalDrawLineAA(double theStartX, double theStartY, double theEndX, double theEndY, const Color& theColor); |
||
| 69 | void AdditiveDrawLineAA(double theStartX, double theStartY, double theEndX, double theEndY, const Color& theColor); |
||
| 70 | |||
| 71 | void SlowStretchBlt(Image* theImage, const Rect& theDestRect, const FRect& theSrcRect, const Color& theColor, int theDrawMode); |
||
| 72 | void FastStretchBlt(Image* theImage, const Rect& theDestRect, const FRect& theSrcRect, const Color& theColor, int theDrawMode); |
||
| 73 | bool BltRotatedClipHelper(float &theX, float &theY, const Rect &theSrcRect, const Rect &theClipRect, double theRot, FRect &theDestRect, float theRotCenterX, float theRotCenterY); |
||
| 74 | bool StretchBltClipHelper(const Rect &theSrcRect, const Rect &theClipRect, const Rect &theDestRect, FRect &theSrcRectOut, Rect &theDestRectOut); |
||
| 75 | bool StretchBltMirrorClipHelper(const Rect &theSrcRect, const Rect &theClipRect, const Rect &theDestRect, FRect &theSrcRectOut, Rect &theDestRectOut); |
||
| 76 | void BltMatrixHelper(Image* theImage, float x, float y, const SexyMatrix3 &theMatrix, const Rect& theClipRect, const Color& theColor, int theDrawMode, const Rect &theSrcRect, void *theSurface, int theBytePitch, int thePixelFormat, bool blend); |
||
| 77 | void BltTrianglesTexHelper(Image *theTexture, const TriVertex theVertices[][3], int theNumTriangles, const Rect &theClipRect, const Color &theColor, int theDrawMode, void *theSurface, int theBytePitch, int thePixelFormat, float tx, float ty, bool blend); |
||
| 78 | |||
| 79 | void FillScanLinesWithCoverage(Span* theSpans, int theSpanCount, const Color& theColor, int theDrawMode, const BYTE* theCoverage, int theCoverX, int theCoverY, int theCoverWidth, int theCoverHeight); |
||
| 80 | |||
| 81 | |||
| 82 | public: |
||
| 83 | MemoryImage(); |
||
| 84 | MemoryImage(SexyAppBase* theApp); |
||
| 85 | MemoryImage(const MemoryImage& theMemoryImage); |
||
| 86 | virtual ~MemoryImage(); |
||
| 87 | |||
| 88 | virtual void Clear(); |
||
| 89 | virtual void SetBits(ulong* theBits, int theWidth, int theHeight, bool commitBits = true); |
||
| 90 | virtual void Create(int theWidth, int theHeight); |
||
| 91 | virtual ulong* GetBits(); |
||
| 92 | |||
| 93 | virtual void FillRect(const Rect& theRect, const Color& theColor, int theDrawMode); |
||
| 94 | virtual void ClearRect(const Rect& theRect); |
||
| 95 | virtual void DrawLine(double theStartX, double theStartY, double theEndX, double theEndY, const Color& theColor, int theDrawMode); |
||
| 96 | virtual void DrawLineAA(double theStartX, double theStartY, double theEndX, double theEndY, const Color& theColor, int theDrawMode); |
||
| 97 | |||
| 98 | virtual void Blt(Image* theImage, int theX, int theY, const Rect& theSrcRect, const Color& theColor, int theDrawMode); |
||
| 99 | virtual void BltF(Image* theImage, float theX, float theY, const Rect& theSrcRect, const Rect &theClipRect, const Color& theColor, int theDrawMode); |
||
| 100 | virtual void BltRotated(Image* theImage, float theX, float theY, const Rect &theSrcRect, const Rect& theClipRect, const Color& theColor, int theDrawMode, double theRot, float theRotCenterX, float theRotCenterY); |
||
| 101 | virtual void StretchBlt(Image* theImage, const Rect& theDestRect, const Rect& theSrcRect, const Rect& theClipRect, const Color& theColor, int theDrawMode, bool fastStretch); |
||
| 102 | virtual void BltMatrix(Image* theImage, float x, float y, const SexyMatrix3 &theMatrix, const Rect& theClipRect, const Color& theColor, int theDrawMode, const Rect &theSrcRect, bool blend); |
||
| 103 | virtual void BltTrianglesTex(Image *theTexture, const TriVertex theVertices[][3], int theNumTriangles, const Rect& theClipRect, const Color &theColor, int theDrawMode, float tx, float ty, bool blend); |
||
| 104 | |||
| 105 | virtual void SetImageMode(bool hasTrans, bool hasAlpha); |
||
| 106 | virtual void SetVolatile(bool isVolatile); |
||
| 107 | |||
| 108 | virtual bool Palletize(); |
||
| 109 | }; |
||
| 110 | |||
| 111 | } |
||
| 112 | |||
| 113 | #endif //__MEMORYIMAGE_H__ |