File:  [RetroPC.NET] / np2 / x11 / drawmng.c
Revision 1.1: download - view: text, annotated - select for diffs
Fri Dec 12 00:11:56 2003 JST (21 years, 10 months ago) by monaka
Branches: MAIN
CVS tags: VER_0_82_x64, VER_0_82, VER_0_81A, VER_0_81, VER_0_80, VER_0_79, VER_0_78, VER_0_77, VER_0_76, VER_0_75, VER_0_74, VER_0_73, HEAD
revolve conflict filename.
(add viewer, but disable. viewer isn't fully function yet.)

#include "compiler.h"

#include "drawmng.h"


void
drawmng_make16mask(PAL16MASK *pal16, UINT32 bmask, UINT32 rmask, UINT32 gmask)
{
	BYTE sft;

	if (pal16 == NULL)
		return;

	sft = 0;
	while ((!(bmask & 0x80)) && (sft < 32)) {
		bmask <<= 1;
		sft++;
	}
	pal16->mask.p.b = (BYTE)bmask;
	pal16->r16b = sft;

	sft = 0;
	while ((rmask & 0xffffff00) && (sft < 32)) {
		rmask >>= 1;
		sft++;
	}
	pal16->mask.p.r = (BYTE)rmask;
	pal16->l16r = sft;

	sft = 0;
	while ((gmask & 0xffffff00) && (sft < 32)) {
		gmask >>= 1;
		sft++;
	}
	pal16->mask.p.g = (BYTE)gmask;
	pal16->l16g = sft;
}

RGB16
drawmng_makepal16(PAL16MASK *pal16, RGB32 pal32)
{
	RGB32 pal;

	pal.d = pal32.d & pal16->mask.d;
	return (RGB16)((pal.p.g << pal16->l16g) + (pal.p.r << pal16->l16r) + (pal.p.b >> pal16->r16b));
}

RetroPC.NET-CVS <cvs@retropc.net>