/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Cache routines
Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008
Copyright (C) Jeroen Meijer <jeroen@oldambt7.com> 2005
Copyright 2003-2011 Peter Astrand <astrand@cendio.se> for Cendio AB
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the General Public License version 2 (GPLv2) at this time for any software where
* a choice of GPL license versions is made available with the language indicating
* that GPLv2 or any later version may be used, or where a choice of which version
* of the GPL is applied is otherwise unspecified.
*/
#include "rdesktop.h"
/* BITMAP CACHE */
extern int g_pstcache_fd[];
/*
* TODO: Test for optimal value of BUMP_COUNT. TO_TOP gives lowest cpu utilisation but using
* a positive value will hopefully result in less frequently used bitmaps having a greater chance
* of being evicted from the cache, and therby reducing the need to load bitmaps from disk.
* (Jeroen)
*/
struct bmpcache_entry
{
};
void
{
int n = count, c = 0;
/* find top, skip evicted bitmaps */
if (n < 0)
{
return;
}
c++;
/* link list */
while (n >= 0)
{
/* skip evicted bitmaps */
if (n < 0)
break;
c++;
}
if (c != g_bmpcache_count[id])
{
error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c,
}
}
/* Move a bitmap to a new position in the linked list. */
void
{
if (!IS_PERSISTENT(id))
return;
return;
{
/* remove */
--g_bmpcache_count[id];
else
else
}
else
{
}
if (bump >= 0)
{
{
}
}
else
{
}
/* insert */
++g_bmpcache_count[id];
if (p_idx >= 0)
else
if (n_idx >= 0)
else
}
/* Evict the least-recently used bitmap from the cache */
void
{
int n_idx;
if (!IS_PERSISTENT(id))
return;
--g_bmpcache_count[id];
}
/* Retrieve a bitmap from the cache */
{
{
{
if (IS_PERSISTENT(id))
}
}
{
return g_volatile_bc[id];
}
return NULL;
}
/* Store a bitmap in the cache */
void
{
{
if (IS_PERSISTENT(id))
{
}
}
{
}
else
{
}
}
/* Updates the persistent bitmap cache MRU information on exit */
void
cache_save_state(void)
{
int idx;
if (IS_PERSISTENT(id))
{
while (idx >= 0)
{
}
DEBUG_RDP5((" %d stamps written.\n", t));
}
}
/* FONT CACHE */
/* Retrieve a glyph from the font cache */
{
{
return glyph;
}
return NULL;
}
/* Store a glyph in the font cache */
void
{
{
}
else
{
}
}
/* TEXT CACHE */
/* Retrieve a text item from the cache */
DATABLOB *
{
return text;
}
/* Store a text item in the cache */
void
{
}
/* DESKTOP CACHE */
/* Retrieve desktop data from the cache */
uint8 *
{
if (offset > sizeof(g_deskcache))
offset = 0;
{
return &g_deskcache[offset];
}
return NULL;
}
/* Store desktop data in the cache */
void
{
if (offset > sizeof(g_deskcache))
offset = 0;
{
cx *= bytes_per_pixel;
while (cy--)
{
}
}
else
{
}
}
/* CURSOR CACHE */
/* Retrieve cursor from cache */
{
{
return cursor;
}
return NULL;
}
/* Store cursor in cache */
void
{
{
}
else
{
}
}
/* BRUSH CACHE */
/* index 0 is 2 colour brush, index 1 is muti colour brush */
/* Retrieve brush from cache */
{
{
}
return NULL;
}
/* Store brush in cache */
/* this function takes over the data pointer in struct, eg, caller gives it up */
void
{
{
{
}
}
else
{
}
}