src/gfx.cpp
branch0.6
changeset 11130 488ecb9d3296
parent 9166 b37d9f4017e5
child 11150 4e3726a46a72
equal deleted inserted replaced
11129:72b8e47f86d8 11130:488ecb9d3296
   667 	} else {
   667 	} else {
   668 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL, sub);
   668 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL, sub);
   669 	}
   669 	}
   670 }
   670 }
   671 
   671 
   672 static inline void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
   672 static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
   673 {
   673 {
   674 	const DrawPixelInfo *dpi = _cur_dpi;
   674 	const DrawPixelInfo *dpi = _cur_dpi;
   675 	Blitter::BlitterParams bp;
   675 	Blitter::BlitterParams bp;
   676 
   676 
   677 	/* Amount of pixels to clip from the source sprite */
   677 	/* Amount of pixels to clip from the source sprite */
   693 	bp.sprite_height = sprite->height;
   693 	bp.sprite_height = sprite->height;
   694 	bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, dpi->zoom);
   694 	bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, dpi->zoom);
   695 	bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, dpi->zoom);
   695 	bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, dpi->zoom);
   696 	bp.top = 0;
   696 	bp.top = 0;
   697 	bp.left = 0;
   697 	bp.left = 0;
   698 	bp.skip_left = UnScaleByZoom(clip_left, dpi->zoom);
   698 	bp.skip_left = UnScaleByZoomLower(clip_left, dpi->zoom);
   699 	bp.skip_top = UnScaleByZoom(clip_top, dpi->zoom);
   699 	bp.skip_top = UnScaleByZoomLower(clip_top, dpi->zoom);
   700 
   700 
   701 	x += ScaleByZoom(bp.skip_left, dpi->zoom);
   701 	x += ScaleByZoom(bp.skip_left, dpi->zoom);
   702 	y += ScaleByZoom(bp.skip_top, dpi->zoom);
   702 	y += ScaleByZoom(bp.skip_top, dpi->zoom);
   703 
   703 
   704 	bp.dst = dpi->dst_ptr;
   704 	bp.dst = dpi->dst_ptr;
   744 	x += ScaleByZoom(bp.width, dpi->zoom) - dpi->width;
   744 	x += ScaleByZoom(bp.width, dpi->zoom) - dpi->width;
   745 	if (x > 0) {
   745 	if (x > 0) {
   746 		bp.width -= UnScaleByZoom(x, dpi->zoom);
   746 		bp.width -= UnScaleByZoom(x, dpi->zoom);
   747 		if (bp.width <= 0) return;
   747 		if (bp.width <= 0) return;
   748 	}
   748 	}
       
   749 
       
   750 	assert(bp.skip_left + bp.width <= UnScaleByZoom(sprite->width, dpi->zoom));
       
   751 	assert(bp.skip_top + bp.height <= UnScaleByZoom(sprite->height, dpi->zoom));
   749 
   752 
   750 	BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, dpi->zoom);
   753 	BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, dpi->zoom);
   751 }
   754 }
   752 
   755 
   753 void DoPaletteAnimations();
   756 void DoPaletteAnimations();