Пример #1
0
int main(int argc, char **argv)
{
	struct fb_fix_screeninfo fixed_info;
	struct fb_var_screeninfo mode_info;
	int fd = open("/dev/fb0", O_RDWR, 0);
	int ret;

	/* Unblank the screen if it was previously blanked */
	ret = ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK);

	/* Make sure the software refresher is on */
	ioctl(fd, MSMFB_RESUME_SW_REFRESHER, 0);

	/* Get the fixed info (par) structure */
	ioctl(fd, FBIOGET_FSCREENINFO, &fixed_info);

	/* Get the current screen setting */
	ioctl(fd, FBIOGET_VSCREENINFO, &mode_info);

	test_fill(640, 480, C2D_COLOR_FORMAT_8888_ARGB | C2D_FORMAT_DISABLE_ALPHA,
			fixed_info.smem_start);

	test_fill(640, 480, C2D_COLOR_FORMAT_8888_ARGB | C2D_FORMAT_DISABLE_ALPHA, 0);

	test_fill(640, 480, C2D_COLOR_FORMAT_8888_ARGB | C2D_FORMAT_DISABLE_ALPHA,
			fixed_info.smem_start);

	return 0;
}
Пример #2
0
/*
 * Run tests for dsize = n
 */
static void do_tests(uint32_t n) {
  cset_t c1, c2;
  bset_t b1, b2, b;
  uint32_t i;

  assert(n > 0);
  printf("\n============================"
	 "\n    DOMAIN SIZE = %"PRIu32
	 "\n============================\n\n", n);

  init_cset(&c1);
  cset_init_empty(&c1, n);
  init_cset(&c2);
  cset_init_empty(&c2, n);
  init_bset(&b1, n);
  init_bset(&b2, n);
  init_bset(&b, n);

  test_empty(&c1, &b1);
  test_empty(&c1, &b1);
  test_fill(&c1, &b1);
  test_fill(&c1, &b1);

  for (i=0; i<20; i++) {
    random_test(&c1, &c2, &b1, &b2, &b);
  }

  delete_bset(&b2);
  delete_bset(&b1);
  delete_bset(&b);
  delete_cset(&c2);
  delete_cset(&c1);
}
Пример #3
0
static void
test_fill (const std::size_t N)
{
    rw_info (0, 0, 0,
            "template <class %s, class %s> "
            "void std::fill (%1$s, %1$s, const %2$s&)",
            "ForwardIterator", "T");

    if (rw_opt_no_fwd_iter) {
        rw_note (0, __FILE__, __LINE__, "ForwardIterator test disabled");
        std_log(LOG_FILENAME_LINE,"ForwardIterator test disabled");  
    }
    else {
        test_fill (N, FwdIter<X>(), (X*)0);
    }

    if (rw_opt_no_bidir_iter) {
        rw_note (0, __FILE__, __LINE__, "BidirectionalIterator test disabled");
        std_log(LOG_FILENAME_LINE,"BidirectionalIterator test disabled");  
    }
    else {
        test_fill (N, BidirIter<X>(), (X*)0);
    }

    if (rw_opt_no_rnd_iter) {
        rw_note (0, __FILE__, __LINE__,  "RandomAccessIterator test disabled");
        std_log(LOG_FILENAME_LINE,"RandomAccessIterator test disabled");  
    }
    else {
        test_fill (N, RandomAccessIter<X>(), (X*)0);
    }
}
Пример #4
0
BOOST_AUTO_TEST_CASE_TEMPLATE( fill_scalar, S, scalar_types )
{
    S v1 = S(1.5f);
    S v2 = S(2.5f);
    S v3 = S(42.0f);
    test_fill(v1, v2, v3, queue);
}
Пример #5
0
BOOST_AUTO_TEST_CASE_TEMPLATE( fill_vec4, S, scalar_types )
{
    typedef typename bc::make_vector_type<S, 4>::type T;
    S s1 = S(1.5f);
    S s2 = S(2.5f);
    S s3 = S(42.0f);
    S s4 = S(84.0f);

    T v1 = T(s1, s2, s3, s4);
    T v2 = T(s3, s4, s1, s2);
    T v3 = T(s4, s3, s2, s1);
    test_fill(v1, v2, v3, queue);
}
Пример #6
0
static int
run_test (int, char*[])
{
    // check that the number of loops is non-negative
    rw_fatal (-1 < rw_opt_nloops, 0, 0,
              "number of loops must be non-negative, got %d",
              rw_opt_nloops);

    const std::size_t N = std::size_t (rw_opt_nloops);

    test_fill (N);

    test_fill_n (N);

    return 0;
}
Пример #7
0
BOOST_AUTO_TEST_CASE_TEMPLATE( fill_vec8, S, scalar_types )
{
    typedef typename bc::make_vector_type<S, 8>::type T;
    S s1 = S(1.5f);
    S s2 = S(2.5f);
    S s3 = S(42.0f);
    S s4 = S(84.0f);
    S s5 = S(122.5f);
    S s6 = S(131.5f);
    S s7 = S(142.0f);
    S s8 = S(254.0f);

    T v1 = T(s1, s2, s3, s4, s5, s6, s7, s8);
    T v2 = T(s3, s4, s1, s2, s7, s8, s5, s6);
    T v3 = T(s4, s3, s2, s1, s8, s7, s6, s5);
    test_fill(v1, v2, v3, queue);
}
Пример #8
0
int main(int argc, char **argv)
{
	/* create dummy pixmap to get initialization out of the way */
	c2d_ts_handle curTimestamp;
	PixmapPtr tmp = create_pixmap(64, 64, xRGB);
	CHK(c2dFlush(tmp->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	test_fill(1920, 1080, xRGB, 0, 0, 1920, 1080);
	test_fill(1920, 1080, xRGB, 717, 395, 718, 685);

	/* test limits of x, y */
	test_fill(1920, 1080, xRGB, 0x100, 0, 0x101, 0);
	test_fill(1920, 1080, xRGB, 0, 0x100, 0, 0x101);

	/* test limits of width, height */
	test_fill(1920, 1080, xRGB, 0, 0, 0x100, 0);
	test_fill(1920, 1080, xRGB, 0, 0, 0, 0x100);

	test_fill(1, 1, xRGB, 0, 0, 1, 1);

	return 0;
}
Пример #9
0
int main(int argc, char **argv)
{
	TEST_START();
	TEST(test_fill(63, 65, xRGB));
	TEST(test_fill(63, 65, xRGB));
	TEST(test_fill(127, 260, xRGB));
/* for now, concentrate on xRGB:
	TEST(test_fill(62, 66, C2D_COLOR_FORMAT_8888_ARGB));
	TEST(test_fill(59, 69, C2D_COLOR_FORMAT_565_RGB));
	TEST(test_fill(21, 0x3ff, C2D_COLOR_FORMAT_8888_ARGB));
	TEST(test_fill(0xff, 22, C2D_COLOR_FORMAT_8888_ARGB));
*/

	/* beyond 0x101, we get an extra dword.. probably means max x coord is 8 bits, and
	 * after that there are extra words in the cmdstream..
	 */
	TEST(test_fill(0x101, 22, xRGB));
	TEST(test_fill(0x102, 22, xRGB));
	TEST(test_fill(1920, 1080, xRGB));
	TEST_END();

	return 0;
}
Пример #10
0
int main(int argc, char **argv)
{
	struct bitvec bv;
	uint8_t i = 8, test[i];

	memset(test, 0, i);
	bv.data_len = i;
	bv.data = test;
	bv.cur_bit = 0;

	printf("test shifting...\n");

	bitvec_set_uint(&bv, 0x0E, 7);
	test_shift(&bv, 3);
	test_shift(&bv, 17);
	bitvec_set_uint(&bv, 0, 32);
	bitvec_set_uint(&bv, 0x0A, 7);
	test_shift(&bv, 24);

	printf("checking RL functions...\n");

	bitvec_zero(&bv);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0x000F, 32);
	test_rl(&bv);
	bitvec_shiftl(&bv, 18);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0x0F, 8);
	test_rl(&bv);
	bitvec_zero(&bv);
	bitvec_set_uint(&bv, 0xFF, 8);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0xFE, 7);
	test_rl(&bv);
	bitvec_set_uint(&bv, 0, 17);
	test_rl(&bv);
	bitvec_shiftl(&bv, 18);
	test_rl(&bv);

	printf("probing bit access...\n");

	bitvec_zero(&bv);
	bitvec_set_uint(&bv, 0x3747817, 32);
	bitvec_shiftl(&bv, 10);

	test_get(&bv, 2);
	test_get(&bv, 7);
	test_get(&bv, 9);
	test_get(&bv, 13);
	test_get(&bv, 16);
	test_get(&bv, 42);

	printf("feeling bit fills...\n");

	test_set(&bv, ONE);
	test_fill(&bv, 3, ZERO);
	test_spare(&bv, 38);
	test_spare(&bv, 43);
	test_spare(&bv, 1);
	test_spare(&bv, 7);
	test_fill(&bv, 5, ONE);
	test_fill(&bv, 3, L);

	printf("byte me...\n");

	test_byte_ops();
	test_unhex("48282407a6a074227201000b2b2b2b2b2b2b2b2b2b2b2b");
	test_unhex("47240c00400000000000000079eb2ac9402b2b2b2b2b2b");
	test_unhex("47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b");
	test_unhex("DEADFACE000000000000000000000000000000BEEFFEED");
	test_unhex("FFFFFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB");

	printf("arrr...\n");

	test_array();

	printf("\nbitvec ok.\n");

	return 0;
}
Пример #11
0
void fill_area_with_mode (hf_type *buffer_in, hf_type *buffer_out, gint xmax, gint ymax,
	hf_type filling_value, hf_type range, gint x, gint y, gint fill_mode, gint select_mode) {

//	Fill area in buffer_out around filling seed (x,y) in buffer_in with filling_value
//	if surrounding pixels value are in a � range
//	1.	Determine first span
//	2.	Fill first span
//	3.	Fill top and bottom spans from shadow

//	buffer_in and buffer_out could be the same (ex. when drawing faults)
//	They would be different, for instance, when buffer_in is used as
//	a select tool

//	2005-04-20 Modified to allow filling up to a maximum

	gint i, x1, x2;
	hf_type v1, v2, value_to_test;	// v1, v2: value to replace (range)

	// Initialize our control structure
	if (xmax<=SPAN_MAX) {
		for (i=0; i<SPAN_LIST_LENGTH; i++)
			span_list[i]=0;
		span_count=0;
	}
		
	// Range & filling_value should be >= 1
	range = MAX(range,1);
	filling_value = MAX(filling_value,MIN_FILLING_VALUE);
	
	if (fill_mode==FILL_MAX) {
		v1 = 0;
		v2 = range;
	}
	else { // fill_mode == FILL_RANGE
		v2 = v1 = *(buffer_in + VECTORIZE(x,y,xmax));
		if (v1 >= range)
			v1 = v1 - range;
		else
			v1 = 0;
		if (range <= (MAX_HF_VALUE - v2))
			v2 = v2 + range;
		else
			v2 = MAX_HF_VALUE;
	}

	*(buffer_out + VECTORIZE(x,y,xmax)) = filling_value;

	// Find the first span
	for (x1=x-1; x1>=0; x1--) {
		value_to_test = *(buffer_in + VECTORIZE(x1,y,xmax));
		if (!test_fill(value_to_test,v1,v2,select_mode,*(buffer_out + VECTORIZE(x1,y,xmax)))) {
			break;
		}
		else
			*(buffer_out + VECTORIZE(x1,y,xmax)) = filling_value;
	} // end for x1
	x1++;

	for (x2=x+1; x2<xmax; x2++) {
		value_to_test = *(buffer_in + VECTORIZE(x2,y,xmax));
		if (!test_fill(value_to_test,v1,v2,select_mode,*(buffer_out + VECTORIZE(x2,y,xmax)))) {
			break;
		}
		else
			*(buffer_out + VECTORIZE(x2,y,xmax)) = filling_value;
	} // end for x2
	x2--;

	fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2,
		filling_value, y, x1, x2, FILL_BOTH, select_mode);
		
//	printf("LAST COUNT: %d\n",span_count);
}
Пример #12
0
void fill_span_from_shadow (hf_type *buffer_in, hf_type *buffer_out, gint xmax, gint ymax,
	hf_type v1, hf_type v2, hf_type filling_value,
	gint y, gint x1, gint x2, gint direction, gint select_mode) {
	
	gint i, mark1, mark2;
	glong value_to_test;
	hf_type output_value;
	gboolean span_end, filled, to_fill;

	filled = FALSE;

//	printf("FILLING y = %d, from x = %d to %d, direction = %d; value: %d\n",y, x1, x2, direction, filling_value);

	if (write_span(y,encode_span(direction,x1,x2))) { 
	
//		printf("FILLING in DOUBLE y = %d, from x = %d to %d, direction = %s; value: %d; mode: %s\n",y, x1, x2, 
//		((direction==0)?"FILL_UP":((direction==1)?"FILL_DOWN":"FILL_BOTH")), filling_value,
//		 ((select_mode==0)?"SELECT_REPLACE":((select_mode==1)?"SELECT_ADD":"SELECT_SUBTRACT")));
		return;
	}
//	Direction: FILL_UP (North), FILL_DOWN (South), FILL_BOTH

	if ( direction==FILL_BOTH ) {

		if ( (y-1) >= 0 )
			fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2,
				filling_value, y, x1, x2, FILL_UP, select_mode);
		if ( (y+1) <= ymax)
			fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2,
				filling_value, y, x1, x2, FILL_DOWN, select_mode);
		return;
	}

	// 1. Calculate direction (FILL_UP or FILL_DOWN)

	if ( direction==FILL_UP )
		y--;
	else
		y++;

	// Test the boundaries in case the function is called
	// at the first recursivity level with direction <> FILL_BOTH
	if ( (y<0) || (y>=ymax) )
		return;

	// 2. Process span

	// 2.1 Backup original span
	mark1 = x1;
	mark2 = x2;

	// 2.2 For x1, if the filling test is true, extend the span as needed

	output_value = *(buffer_out + VECTORIZE(x1,y,xmax));
	if ( (buffer_out==buffer_in) || (select_mode==SELECT_SUBTRACT))
		value_to_test  = *(buffer_in + VECTORIZE(x1,y,xmax));
	else // select_mode==SELECT_ADD / REPLACE || buffer_in != buffer_out
		value_to_test = ((glong) *(buffer_in + VECTORIZE(x1,y,xmax))) + ((glong) output_value);

	if ( test_fill (value_to_test, v1, v2, select_mode, output_value) ) {
	
		// Filling test is true, we extend the span backwards, filling pixels
		for (mark1 = x1-1; mark1>=0; mark1--) {
				
			output_value = *(buffer_out + VECTORIZE(mark1,y,xmax));
			if ( (buffer_out==buffer_in) || (select_mode==SELECT_SUBTRACT))
				value_to_test  = *(buffer_in + VECTORIZE(mark1,y,xmax));
			else // select_mode==SELECT_ADD / REPLACE || buffer_in != buffer_out
				value_to_test = ((glong) *(buffer_in + VECTORIZE(mark1,y,xmax))) + ((glong) output_value);
				
			// Stop when the filling test is false
			if (! test_fill (value_to_test, v1, v2, select_mode, output_value)){
				break;
			}
			else
				*(buffer_out + VECTORIZE(mark1,y,xmax)) = filling_value;
		}
		mark1++;
	}
	else {
	//	If the filling test is false, narrow the span as needed
		while ( mark1<=mark2 ) {
			mark1++;
			
			output_value = 	*(buffer_out + VECTORIZE(mark1,y,xmax));	
			if ( (buffer_out==buffer_in) || (select_mode==SELECT_SUBTRACT))
				value_to_test  = *(buffer_in + VECTORIZE(mark1,y,xmax));
			else // select_mode==SELECT_ADD / REPLACE || buffer_in != buffer_out
				value_to_test = ((glong) *(buffer_in + VECTORIZE(mark1,y,xmax))) + ((glong) output_value);
			
			if ( test_fill (value_to_test, v1, v2, select_mode, output_value) ) 
				break;
		}
	}

	if (mark1>mark2)
		return;

	// Run from mark1 through mark2, filling pixels and calling recursively fill_from_shadow
	// for the current span, each time a discontinuity is encountered

	// At this point, the filling test is true for mark1
	// If mark1 < x1, then the mark1-x1 range is already filled, including x1

	span_end = FALSE;

	// 	We don't need to fill pixels before x1,
 	//	but we need mark1 to specify the shadow for the span on the next y
	i = MAX(x1,mark1);

	// We need to fill the shadow between x1 and mark1, if mark1<(x1-1)
	
	if (mark1<(x1-1))
		fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2, filling_value, y, mark1, x1, ((direction==FILL_UP) ? FILL_DOWN : FILL_UP ), select_mode );
	
	to_fill = TRUE;
	while (i<=mark2) {
//		count++;
//		if (i==384)
//		printf("Count: %d; I: %d; Mark1: %d; Mark2: %d\n",count, i, mark1, mark2);
		if ( to_fill ) {
			*(buffer_out + VECTORIZE(i,y,xmax)) = filling_value;
			if (span_end) // begin a new span
				mark1 = i;
			span_end = FALSE;
			filled = TRUE;
		}
		else {
			// The first time the fill condition is false, a span has ended,
			// we must call "fill_from_shadow" for this span
			// After, we're looking for the beginning of a new span
			if ( (!span_end) && (i>x1)) {
				fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1, v2, filling_value, y, mark1, i-1, direction, select_mode);
				// If the new span boundary exceeds the old one by more than one pixel,
				// we start a filling movement on the other direction
				if ( (i-1) > x2 )
					fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2, filling_value, y, x2+1, i-1,
					((direction==FILL_UP) ? FILL_DOWN : FILL_UP ), select_mode );
				span_end = TRUE;
				filled = TRUE;
			}
			mark1 = i+1;
			if (mark1>=x2)
				break;
		}
		i++;
		if (i==xmax)
			break;

		output_value = *(buffer_out + VECTORIZE(i,y,xmax));
		if ( (buffer_out==buffer_in) || (select_mode==SELECT_SUBTRACT))
			value_to_test  = *(buffer_in + VECTORIZE(i,y,xmax));
		else // select_mode==SELECT_ADD / REPLACE || buffer_in != buffer_out
			value_to_test = ((glong) *(buffer_in + VECTORIZE(i,y,xmax))) + ((glong) output_value);
					
		if ( test_fill (value_to_test, v1, v2, select_mode, output_value) ) {	
			to_fill = TRUE;
			if (i>x2) {
				mark2++; // We extend the span as necessary
				if (mark2==xmax) {
					mark2--;
					break;
				}
			}
		}
		else
			to_fill = FALSE;
	}

	// "Flush" the last span if required

	if (filled && ((i>mark2) || (i==xmax-1))) {
		fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2,
			filling_value, y, mark1, mark2, direction, select_mode);

			// If the new span boundary exceeds the old one by more than one pixel,
			// we start a filling movement on the other direction
		if ( mark2 > x2 )
			fill_span_from_shadow (buffer_in, buffer_out, xmax,ymax, v1,v2, filling_value, y, x2+1, mark2, ((direction==FILL_UP) ? FILL_DOWN : FILL_UP ), select_mode );
	}
}