Beispiel #1
0
/* Store a bitmap in the cache */
void
cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap)
{
	RD_HBITMAP old;

	if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
	{
		old = g_bmpcache[id][idx].bitmap;
		if (old != NULL)
			ui_destroy_bitmap(old);
		g_bmpcache[id][idx].bitmap = bitmap;

		if (IS_PERSISTENT(id))
		{
			if (old == NULL)
				g_bmpcache[id][idx].previous = g_bmpcache[id][idx].next = NOT_SET;

			cache_bump_bitmap(id, idx, TO_TOP);
			if (g_bmpcache_count[id] > BMPCACHE2_C2_CELLS)
				cache_evict_bitmap(id);
		}
	}
	else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
	{
		old = g_volatile_bc[id];
		if (old != NULL)
			ui_destroy_bitmap(old);
		g_volatile_bc[id] = bitmap;
	}
	else
	{
		error("put bitmap %d:%d\n", id, idx);
	}
}
Beispiel #2
0
/* Store a bitmap in the cache */
void
cache_put_bitmap(rdcConnection conn, uint8 id, uint16 idx, HBITMAP bitmap)
{
	HBITMAP old;

	if ((id < NUM_ELEMENTS(conn->bmpcache)) && (idx < NUM_ELEMENTS(conn->bmpcache[0])))
	{
		old = conn->bmpcache[id][idx].bitmap;
		if (old != NULL)
			ui_destroy_bitmap(old);
		conn->bmpcache[id][idx].bitmap = bitmap;
				
		if (IS_PERSISTENT(id))
		{
			if (old == NULL)
				conn->bmpcache[id][idx].previous = conn->bmpcache[id][idx].next = NOT_SET;

			cache_bump_bitmap(conn, id, idx, TO_TOP);
			if (conn->bmpcacheCount[id] > BMPCACHE2_C2_CELLS)
				cache_evict_bitmap(conn, id);
		}
	}
	else if ((id < NUM_ELEMENTS(conn->volatileBc)) && (idx == 0x7fff))
	{
		old = conn->volatileBc[id];
		if (old != NULL)
			ui_destroy_bitmap(old);
		conn->volatileBc[id] = bitmap;
	}
	else
	{
		error("put bitmap %d:%d\n", id, idx);
	}
}
Beispiel #3
0
/* Retrieve a bitmap from the cache */
RD_HBITMAP
cache_get_bitmap(uint8 id, uint16 idx)
{
	if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
	{
		if (g_bmpcache[id][idx].bitmap || pstcache_load_bitmap(id, idx))
		{
			if (IS_PERSISTENT(id))
				cache_bump_bitmap(id, idx, BUMP_COUNT);

			return g_bmpcache[id][idx].bitmap;
		}
	}
	else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
	{
		return g_volatile_bc[id];
	}

	error("get bitmap %d:%d\n", id, idx);
	return NULL;
}
Beispiel #4
0
/* Retrieve a bitmap from the cache */
HBITMAP
cache_get_bitmap(rdcConnection conn, uint8 id, uint16 idx)
{
	if ((id < NUM_ELEMENTS(conn->bmpcache)) && (idx < NUM_ELEMENTS(conn->bmpcache[0])))
	{
		if (conn->bmpcache[id][idx].bitmap || pstcache_load_bitmap(conn, id, idx))
		{
			if (IS_PERSISTENT(id))
				cache_bump_bitmap(conn, id, idx, BUMP_COUNT);

			return conn->bmpcache[id][idx].bitmap;
		}
	}
	else if ((id < NUM_ELEMENTS(conn->volatileBc)) && (idx == 0x7fff))
	{
		return conn->volatileBc[id];
	}

	error("get bitmap %d:%d\n", id, idx);
	return NULL;
}