/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include	"v.h"
#include	"gbgraph.h"
#include	"viewindex.h"


GB_POINT
v2gb_point(VPOINT v)
{
GB_POINT ret;
	ret.x = v.x;
	ret.y = v.y;
	return ret;
}


void
index_move(unsigned long * dest,unsigned long * src,
		VPOINT * index,int w,int h,unsigned long no_data,
		unsigned long dirty_bit)
{
int x,y;
int ix;
	for ( y = 0 ; y < h ; y ++ )
		for ( x = 0 ; x < w ; x ++ , dest ++ , index ++ ) {
			if ( index->x < 0 )
				goto no_data;
			if ( index->y < 0 )
				goto no_data;
			*dest = src[index->x + index->y * w]|dirty_bit;
			continue;
		no_data:
			*dest = no_data;
		}
}