gfx.c
changeset 1348 7b598080024c
parent 1336 69391734ce23
child 1349 15979a2e9001
equal deleted inserted replaced
1347:1b8ff901b455 1348:7b598080024c
     3 #include "strings.h"
     3 #include "strings.h"
     4 #include "gfx.h"
     4 #include "gfx.h"
     5 #include "table/palettes.h"
     5 #include "table/palettes.h"
     6 #include "hal.h"
     6 #include "hal.h"
     7 
     7 
     8 static void GfxMainBlitter(byte *sprite, int x, int y, int mode);
     8 static void GfxMainBlitter(Sprite *sprite, int x, int y, int mode);
     9 
     9 
    10 static int _stringwidth_out;
    10 static int _stringwidth_out;
    11 static byte _cursor_backup[64*64];
    11 static byte _cursor_backup[64*64];
    12 static Rect _invalid_rect;
    12 static Rect _invalid_rect;
    13 static byte *_color_remap_ptr;
    13 static byte *_color_remap_ptr;
  1310 	}
  1310 	}
  1311 }
  1311 }
  1312 
  1312 
  1313 typedef void (*BlitZoomFunc)(BlitterParams *bp);
  1313 typedef void (*BlitZoomFunc)(BlitterParams *bp);
  1314 
  1314 
  1315 static void GfxMainBlitter(byte *sprite, int x, int y, int mode)
  1315 static void GfxMainBlitter(Sprite *sprite, int x, int y, int mode)
  1316 {
  1316 {
  1317 	DrawPixelInfo *dpi = _cur_dpi;
  1317 	DrawPixelInfo *dpi = _cur_dpi;
  1318 	int start_x, start_y;
  1318 	int start_x, start_y;
  1319 	byte info;
  1319 	byte info;
  1320 	BlitterParams bp;
  1320 	BlitterParams bp;
  1332 		GfxBlitZoomMediumUncomp,
  1332 		GfxBlitZoomMediumUncomp,
  1333 		GfxBlitZoomOutUncomp
  1333 		GfxBlitZoomOutUncomp
  1334 	};
  1334 	};
  1335 
  1335 
  1336 	/* decode sprite header */
  1336 	/* decode sprite header */
  1337 	x += (int16)READ_LE_UINT16(&((SpriteHdr*)sprite)->x_offs);
  1337 	x += (int16)TO_LE16(sprite->x_offs);
  1338 	y += (int16)READ_LE_UINT16(&((SpriteHdr*)sprite)->y_offs);
  1338 	y += (int16)TO_LE16(sprite->y_offs);
  1339 	bp.width_org = bp.width = READ_LE_UINT16(&((SpriteHdr*)sprite)->width);
  1339 	bp.width_org = bp.width = TO_LE16(sprite->width);
  1340 	bp.height_org = bp.height = ((SpriteHdr*)sprite)->height;
  1340 	bp.height_org = bp.height = sprite->height;
  1341 	info = ((SpriteHdr*)sprite)->info;
  1341 	info = sprite->info;
  1342 	bp.info = info;
  1342 	bp.info = info;
  1343 	bp.sprite_org = bp.sprite = sprite + sizeof(SpriteHdr);
  1343 	bp.sprite_org = bp.sprite = sprite->data;
  1344 	bp.dst = dpi->dst_ptr;
  1344 	bp.dst = dpi->dst_ptr;
  1345 	bp.mode = mode;
  1345 	bp.mode = mode;
  1346 	bp.pitch = dpi->pitch;
  1346 	bp.pitch = dpi->pitch;
  1347 
  1347 
  1348 	assert(bp.height > 0);
  1348 	assert(bp.height > 0);
  1903 }
  1903 }
  1904 
  1904 
  1905 static void SetCursorSprite(uint cursor)
  1905 static void SetCursorSprite(uint cursor)
  1906 {
  1906 {
  1907 	CursorVars *cv = &_cursor;
  1907 	CursorVars *cv = &_cursor;
  1908 	byte *p;
  1908 	const Sprite *p;
  1909 
  1909 
  1910 	if (cv->sprite == cursor)
  1910 	if (cv->sprite == cursor)
  1911 		return;
  1911 		return;
  1912 
  1912 
  1913 	p =	GetSpritePtr(cursor & 0x3FFF);
  1913 	p =	GetSpritePtr(cursor & 0x3FFF);
  1914 	cv->sprite = cursor;
  1914 	cv->sprite = cursor;
  1915 	cv->size.y = *(byte*)(p+1);
  1915 	cv->size.y = p->height;
  1916 	cv->size.x = READ_LE_UINT16(p+2);
  1916 	cv->size.x = TO_LE16(p->width);
  1917 	cv->offs.x = (int16)READ_LE_UINT16(p+4);
  1917 	cv->offs.x = (int16)TO_LE16(p->x_offs);
  1918 	cv->offs.y = (int16)READ_LE_UINT16(p+6);
  1918 	cv->offs.y = (int16)TO_LE16(p->y_offs);
  1919 
  1919 
  1920 	cv->dirty = true;
  1920 	cv->dirty = true;
  1921 }
  1921 }
  1922 
  1922 
  1923 static void SwitchAnimatedCursor(void)
  1923 static void SwitchAnimatedCursor(void)