Пример #1
0
/*-------------------------------------------------
    drawgfx_alphastore - render a gfx element with
    a single transparent pen, storing the alpha value
    in alpha field of ARGB32, negative alpha implies alphatable
-------------------------------------------------*/
static void drawgfx_alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, gfx_element *gfx,
		UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
		int fixedalpha)
{
	psikyosh_state *state = gfx->machine().driver_data<psikyosh_state>();
	UINT8 *alphatable = state->m_alphatable;
	DECLARE_NO_PRIORITY;
	const pen_t *paldata;

	assert(dest.bpp() == 32);
	assert(dest.format() == BITMAP_FORMAT_ARGB32);
	assert(gfx != NULL);
	assert(alphatable != NULL);

	/* if we have a fixed alpha, call the standard drawgfx_transpen */
	if (fixedalpha == 0xff)
	{
		drawgfx_transpen(dest, cliprect, gfx, code, color, flipx, flipy, destx, desty, 0);
		return;
	}

	/* get final code and color, and grab lookup tables */
	code %= gfx->elements();
	color %= gfx->colors();
	paldata = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * color];

	/* early out if completely transparent */
	if (gfx->has_pen_usage() && (gfx->pen_usage(code) & ~(1 << 0)) == 0)
		return;

	if (fixedalpha >= 0)
	{
		UINT8 alpha = fixedalpha;
		DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHASTORE32, NO_PRIORITY);
	}
	else
	{
		DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32, NO_PRIORITY);
	}
}