diff -r b5c2449616b5 -r 66dde6412125 src/blitter/base.hpp --- a/src/blitter/base.hpp Sun Jun 17 21:31:00 2007 +0000 +++ b/src/blitter/base.hpp Tue Jun 26 23:40:58 2007 +0000 @@ -31,6 +31,12 @@ int pitch; ///< The pitch of the destination buffer }; + enum PaletteAnimation { + PALETTE_ANIMATION_NONE, ///< No palette animation + PALETTE_ANIMATION_VIDEO_BACKEND, ///< Palette animation should be done by video backend (8bpp only!) + PALETTE_ANIMATION_BLITTER, ///< The blitter takes care of the palette animation + }; + typedef void *AllocatorProc(size_t size); /** @@ -94,7 +100,20 @@ * @param width The lenght of the line. * @param color A 8bpp mapping color. */ - virtual void SetHorizontalLine(void *video, int width, uint8 color) = 0; + virtual void DrawRect(void *video, int width, int height, uint8 color) = 0; + + /** + * Draw a line with a given color. + * @param video The destination pointer (video-buffer). + * @param x The x coordinate from where the line starts. + * @param y The y coordinate from where the line starts. + * @param x2 The x coordinate to where the line goes. + * @param y2 The y coordinate to where the lines goes. + * @param screen_width The width of the screen you are drawing in (to avoid buffer-overflows). + * @param screen_height The height of the screen you are drawing in (to avoid buffer-overflows). + * @param color A 8bpp mapping color. + */ + virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 color) = 0; /** * Copy from a buffer to the screen. @@ -102,9 +121,9 @@ * @param src The buffer from which the data will be read. * @param width The width of the buffer. * @param height The height of the buffer. - * @param src_pitch The pitch (byte per line) of the source buffer. + * @note You can not do anything with the content of the buffer, as the blitter can store non-pixel data in it too! */ - virtual void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch) = 0; + virtual void CopyFromBuffer(void *video, const void *src, int width, int height) = 0; /** * Copy from the screen to a buffer. @@ -112,18 +131,31 @@ * @param dst The buffer in which the data will be stored. * @param width The width of the buffer. * @param height The height of the buffer. - * @param dst_pitch The pitch (byte per line) of the destination buffer. + * @note You can not do anything with the content of the buffer, as the blitter can store non-pixel data in it too! */ - virtual void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0; + virtual void CopyToBuffer(const void *video, void *dst, int width, int height) = 0; /** - * Move the videobuffer some places (via memmove). - * @param video_dst The destination pointer (video-buffer). - * @param video_src The source pointer (video-buffer). - * @param width The width of the buffer to move. - * @param height The height of the buffer to move. + * Copy from the screen to a buffer in a palette format for 8bpp and RGBA format for 32bpp. + * @param video The destination pointer (video-buffer). + * @param dst The buffer in which the data will be stored. + * @param width The width of the buffer. + * @param height The height of the buffer. + * @param dst_pitch The pitch (byte per line) of the destination buffer. */ - virtual void MoveBuffer(void *video_dst, const void *video_src, int width, int height) = 0; + virtual void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) = 0; + + /** + * Scroll the videobuffer some 'x' and 'y' value. + * @param video The buffer to scroll into. + * @param left The left value of the screen to scroll. + * @param top The top value of the screen to scroll. + * @param width The width of the screen to scroll. + * @param height The height of the screen to scroll. + * @param scroll_x How much to scroll in X. + * @param scroll_y How much to scroll in Y. + */ + virtual void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) = 0; /** * Calculate how much memory there is needed for an image of this size in the video-buffer. @@ -133,6 +165,25 @@ */ virtual int BufferSize(int width, int height) = 0; + /** + * Called when the 8bpp palette is changed; you should redraw all pixels on the screen that + * are equal to the 8bpp palette indexes 'start' to 'start + count'. + * @param start The start index in the 8bpp palette. + * @param count The amount of indexes that are (possible) changed. + */ + virtual void PaletteAnimate(uint start, uint count) = 0; + + /** + * Check if the blitter uses palette animation at all. + * @return True if it uses palette animation. + */ + virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0; + + /** + * Get the naem of the blitter, the same as the Factory-instance returns. + */ + virtual const char *GetName() = 0; + virtual ~Blitter() { } };