src/gfx.cpp
changeset 10948 66145f71ebb9
parent 10775 7061477bfbcf
child 10969 e5fd50b81dc7
equal deleted inserted replaced
10947:10533a7545b6 10948:66145f71ebb9
   687 	} else {
   687 	} else {
   688 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL, sub);
   688 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL, sub);
   689 	}
   689 	}
   690 }
   690 }
   691 
   691 
   692 static inline void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
   692 static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
   693 {
   693 {
   694 	const DrawPixelInfo *dpi = _cur_dpi;
   694 	const DrawPixelInfo *dpi = _cur_dpi;
   695 	Blitter::BlitterParams bp;
   695 	Blitter::BlitterParams bp;
   696 
   696 
   697 	/* Amount of pixels to clip from the source sprite */
   697 	/* Amount of pixels to clip from the source sprite */
   713 	bp.sprite_height = sprite->height;
   713 	bp.sprite_height = sprite->height;
   714 	bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, dpi->zoom);
   714 	bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, dpi->zoom);
   715 	bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, dpi->zoom);
   715 	bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, dpi->zoom);
   716 	bp.top = 0;
   716 	bp.top = 0;
   717 	bp.left = 0;
   717 	bp.left = 0;
   718 	bp.skip_left = UnScaleByZoom(clip_left, dpi->zoom);
   718 	bp.skip_left = UnScaleByZoomLower(clip_left, dpi->zoom);
   719 	bp.skip_top = UnScaleByZoom(clip_top, dpi->zoom);
   719 	bp.skip_top = UnScaleByZoomLower(clip_top, dpi->zoom);
   720 
   720 
   721 	x += ScaleByZoom(bp.skip_left, dpi->zoom);
   721 	x += ScaleByZoom(bp.skip_left, dpi->zoom);
   722 	y += ScaleByZoom(bp.skip_top, dpi->zoom);
   722 	y += ScaleByZoom(bp.skip_top, dpi->zoom);
   723 
   723 
   724 	bp.dst = dpi->dst_ptr;
   724 	bp.dst = dpi->dst_ptr;
   764 	x += ScaleByZoom(bp.width, dpi->zoom) - dpi->width;
   764 	x += ScaleByZoom(bp.width, dpi->zoom) - dpi->width;
   765 	if (x > 0) {
   765 	if (x > 0) {
   766 		bp.width -= UnScaleByZoom(x, dpi->zoom);
   766 		bp.width -= UnScaleByZoom(x, dpi->zoom);
   767 		if (bp.width <= 0) return;
   767 		if (bp.width <= 0) return;
   768 	}
   768 	}
       
   769 
       
   770 	assert(bp.skip_left + bp.width <= UnScaleByZoom(sprite->width, dpi->zoom));
       
   771 	assert(bp.skip_top + bp.height <= UnScaleByZoom(sprite->height, dpi->zoom));
   769 
   772 
   770 	BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, dpi->zoom);
   773 	BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, dpi->zoom);
   771 }
   774 }
   772 
   775 
   773 void DoPaletteAnimations();
   776 void DoPaletteAnimations();