Beispiel #1
0
/* internal engine routines */
static void *
_output_setup(int w, int h)
{
   Render_Engine *re;
   int i;
   u16 width, height;
   DATA32 *image_data = NULL;
   int image_size;

   printf ("_output_setup called : %dx%d\n", w, h);
   re = calloc(1, sizeof(Render_Engine));
   if (!re)
     return NULL;

   /* Allocate a 1Mb buffer, alligned to a 1Mb boundary
    * to be our shared IO memory with the RSX. */
   re->host_addr = memalign (1024 * 1024, HOST_SIZE);
   if (re->host_addr == NULL)
     {
        free (re);
        return NULL;
     }
   re->context = initScreen (re->host_addr, HOST_SIZE);
   if (re->context == NULL)
     {
        free (re->host_addr);
        free (re);
        return NULL;
     }
   width = w;
   height = h;
   setResolution (re->context, &width, &height);
   re->currentBuffer = 0;
   re->width = width;
   re->height = height;

   for (i = 0; i < MAX_BUFFERS; i++)
     makeBuffer (&re->buffers[i], width, height, i);

   flipBuffer(re->context, MAX_BUFFERS - 1);

   re->tb = evas_common_tilebuf_new(w, h);

   /* in preliminary tests 16x16 gave highest framerates */
   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);

   /* Allocate our memaligned backbuffer */
   image_size = ((w * h * sizeof(u32)) + 0xfffff) & - 0x100000;
   image_data = memalign (1024 * 1024, image_size);
   re->rgba_image = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
                                                        w, h, image_data, 1, EVAS_COLORSPACE_ARGB8888);
   gcmMapMainMemory(image_data, image_size, &re->rgba_image_offset);

   return re;
}
Beispiel #2
0
/*
 *
 * Clear the screen (mode 4)
 *
 */
void clearScreen(void) {
	int x;
	int y;

	for(y = 0; y < 160; y++) {
		for(x = 0; x < 120; x++) {
			drawPixel(x, y, 0x0000);
		}
	}
	waitForVerticalBlank();
	flipBuffer();
}
Beispiel #3
0
void clearBuffers(void)
{
    uint8 i;
    int16 y;
    uint8 buffer = 0;

    for (i = 0; i < 3; ++i)
    {
        for (y = 0; y < 240; y += 24)
            draw(0x000B6F80, 160, 24, 0, y, false);

        flipBuffer(&buffer);
    }
}