예제 #1
0
void test_fill(uint32_t w, uint32_t h, uint32_t format)
{
	PixmapPtr dest;
	C2D_RECT rect;
	c2d_ts_handle curTimestamp;

	DEBUG_MSG("fill: %04dx%04d-%08x", w, h, format);
	RD_START("fill", "%dx%d-%08x", w, h, format);

	dest = create_pixmap(w, h, format);

	rect.x = 1 + (w / 64);
	rect.y = 2 + (w / 32);
	rect.width = w - 2 * rect.x;
	rect.height = h - 2 * rect.y;

	// note: look for pattern 0xff556677 in memory to find cmdstream:
	CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
	CHK(c2dFlush(dest->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	// second blit.. fill a sub-rect in center of surface:
	rect.x = (w - 10) / 2;
	rect.y = (h - 16) / 2;
	rect.width = 10;
	rect.height = 16;
	CHK(c2dFillSurface(dest->id, 0xff223344, &rect));
	CHK(c2dFlush(dest->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	RD_END();

	dump_pixmap(dest, "fill-%04dx%04d-%08x.bmp", w, h, format);
}
예제 #2
0
void test_copy(uint32_t w, uint32_t h, uint32_t format)
{
	PixmapPtr src, dest;
	C2D_OBJECT blit = {};
	C2D_RECT rect;
	c2d_ts_handle curTimestamp;

	DEBUG_MSG("----------------------------------------------------------------");
	DEBUG_MSG("copy: %04dx%04d-%08x", w, h, format);
	RD_START("copy", "%dx%d format:%08x", w, h, format);

	dest = create_pixmap(w, h, format);
	src  = create_pixmap(13, 17, format);

	rect.x = 1;
	rect.y = 2;
	rect.width = w - 2;
	rect.height = h - 3;
	CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
	CHK(c2dFlush(dest->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	rect.x = 0;
	rect.y = 0;
	rect.width = 13;
	rect.height = 17;
	CHK(c2dFillSurface(src->id, 0xff223344, &rect));
	CHK(c2dFlush(src->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	blit.surface_id = src->id;
	blit.config_mask = DEFAULT_BLIT_MASK;
	blit.next = NULL;

	blit.source_rect.x = FIXED(1);
	blit.source_rect.y = FIXED(2);
	blit.source_rect.width = FIXED(13-1);
	blit.source_rect.height = FIXED(17-2);

	blit.target_rect.x = FIXED((w - 13) / 2);
	blit.target_rect.y = FIXED((h - 17) / 2);
	blit.target_rect.width = FIXED(13);
	blit.target_rect.height = FIXED(17);
	CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
	CHK(c2dFlush(dest->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	RD_END();

	dump_pixmap(dest, "copy-%04dx%04d-%08x.bmp", w, h, format);
}
예제 #3
0
void test_fill(uint32_t w, uint32_t h, uint32_t format,
		uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2)
{
	PixmapPtr dest;
	C2D_RECT rect;
	c2d_ts_handle curTimestamp;

	DEBUG_MSG("----------------------------------------------------------------");
	DEBUG_MSG("fill2: %04dx%04d-%08x-%d,%d,%d,%d", w, h, format, x1, y1, x2, y2);
	RD_START("fill2", "%dx%d-%08x-%d-%d-%d-%d", w, h, format, x1, y1, x2, y2);

	dest = create_pixmap(w, h, format);

	rect.x = x1;
	rect.y = y1;
	rect.width = x2 - x1;
	rect.height = y2 - y1;

	CHK(c2dFillSurface(dest->id, 0x00585a5d, &rect));
	CHK(c2dFlush(dest->id, &curTimestamp));
	CHK(c2dWaitTimestamp(curTimestamp));

	RD_END();

	dump_pixmap(dest, "fill-%04dx%04d-%08x.bmp", w, h, format);
}
예제 #4
0
static void solid(PixmapPtr dest, int x1, int y1, int x2, int y2,
		uint32_t fill)
{
	C2D_RECT rect = {};

	rect.x = x1;
	rect.y = y1;
	rect.width = x2 - x1;
	rect.height = y2 - y1;

	CHK(c2dFillSurface(dest->id, fill, &rect));
}
예제 #5
0
void test_multi(void)
{
	PixmapPtr src, dest;
	C2D_OBJECT blit = {};
	C2D_RECT rect;
	c2d_ts_handle curTimestamp;
	uint32_t w = 1920, h = 1080, format = xRGB;
	int i;

	DEBUG_MSG("multi: %04dx%04d-%08x", w, h, format);
	RD_START("multi", "%dx%d format:%08x", w, h, format);

	dest = create_pixmap(w, h, format);
	src  = create_pixmap(w, h, format);

	for (i = 0; i < 200; i++ ) {

		rect.x = 1;
		rect.y = 2;
		rect.width = w - 2;
		rect.height = h - 3;
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));
		CHK(c2dFillSurface(dest->id, 0xff556677, &rect));

		rect.x = 0;
		rect.y = 0;
		rect.width = 13;
		rect.height = 17;
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));
		CHK(c2dFillSurface(src->id, 0xff223344, &rect));

		blit.surface_id = src->id;
		blit.config_mask = DEFAULT_BLIT_MASK;
		blit.next = NULL;

		blit.source_rect.x = FIXED(1);
		blit.source_rect.y = FIXED(2);
		blit.source_rect.width = FIXED(13-2);
		blit.source_rect.height = FIXED(17-4);

		blit.target_rect.x = FIXED((w - 13) / 2);
		blit.target_rect.y = FIXED((h - 17) / 2);
		blit.target_rect.width = blit.source_rect.width;
		blit.target_rect.height = blit.source_rect.height;
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		// well, identical copy twice is fine, and I'm lazy:
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));
		CHK(c2dDraw(dest->id, 0, NULL, 0, 0, &blit, 1));

		CHK(c2dFlush(dest->id, &curTimestamp));

		if (!(i % 16))
		CHK(c2dWaitTimestamp(curTimestamp));

	}

	free_pixmap(src);
	free_pixmap(dest);

	RD_END();
}