Lines Matching refs:idx

40 #define IS_SET(idx) (idx >= 0)
67 cache_rebuild_bmpcache_linked_list(uint8 id, sint16 * idx, int count)
73 while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL);
80 g_bmpcache_mru[id] = idx[n];
81 g_bmpcache[id][idx[n]].next = NOT_SET;
82 n_idx = idx[n];
89 while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL);
94 g_bmpcache[id][n_idx].previous = idx[n];
95 g_bmpcache[id][idx[n]].next = n_idx;
96 n_idx = idx[n];
113 cache_bump_bitmap(uint8 id, uint16 idx, int bump)
120 if (g_bmpcache_mru[id] == idx)
123 DEBUG_RDP5(("bump bitmap: id=%d, idx=%d, bump=%d\n", id, idx, bump));
125 n_idx = g_bmpcache[id][idx].next;
126 p_idx = g_bmpcache[id][idx].previous;
163 g_bmpcache[id][idx].previous = p_idx;
164 g_bmpcache[id][idx].next = n_idx;
167 g_bmpcache[id][p_idx].next = idx;
169 g_bmpcache_lru[id] = idx;
172 g_bmpcache[id][n_idx].previous = idx;
174 g_bmpcache_mru[id] = idx;
181 uint16 idx;
187 idx = g_bmpcache_lru[id];
188 n_idx = g_bmpcache[id][idx].next;
189 DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=%p\n", id, idx, n_idx,
190 g_bmpcache[id][idx].bitmap));
192 ui_destroy_bitmap(g_bmpcache[id][idx].bitmap);
194 g_bmpcache[id][idx].bitmap = 0;
199 pstcache_touch_bitmap(id, idx, 0);
204 cache_get_bitmap(uint8 id, uint16 idx)
206 if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
208 if (g_bmpcache[id][idx].bitmap || pstcache_load_bitmap(id, idx))
211 cache_bump_bitmap(id, idx, BUMP_COUNT);
213 return g_bmpcache[id][idx].bitmap;
216 else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
221 error("get bitmap %d:%d\n", id, idx);
227 cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap)
231 if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0])))
233 old = g_bmpcache[id][idx].bitmap;
236 g_bmpcache[id][idx].bitmap = bitmap;
241 g_bmpcache[id][idx].previous = g_bmpcache[id][idx].next = NOT_SET;
243 cache_bump_bitmap(id, idx, TO_TOP);
248 else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff))
257 error("put bitmap %d:%d\n", id, idx);
266 int idx;
272 idx = g_bmpcache_lru[id];
273 while (idx >= 0)
275 pstcache_touch_bitmap(id, idx, ++t);
276 idx = g_bmpcache[id][idx].next;
450 cache_get_brush_data(uint8 colour_code, uint8 idx)
453 if (idx < NUM_ELEMENTS(g_brushcache[0]))
455 return &g_brushcache[colour_code][idx];
457 error("get brush %d %d\n", colour_code, idx);
464 cache_put_brush_data(uint8 colour_code, uint8 idx, BRUSHDATA * brush_data)
469 if (idx < NUM_ELEMENTS(g_brushcache[0]))
471 bd = &g_brushcache[colour_code][idx];
480 error("put brush %d %d\n", colour_code, idx);