/[rdesktop]/jpeg/rdesktop/trunk/cache.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /jpeg/rdesktop/trunk/cache.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1364 by jsorg71, Thu Jan 4 04:55:56 2007 UTC revision 1483 by jsorg71, Sat Nov 1 02:37:10 2008 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     Cache routines     Cache routines
4     Copyright (C) Matthew Chapman 1999-2005     Copyright (C) Matthew Chapman 1999-2008
5     Copyright (C) Jeroen Meijer 2005     Copyright (C) Jeroen Meijer 2005
6    
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
# Line 430  cache_put_cursor(uint16 cache_idx, RD_HC Line 430  cache_put_cursor(uint16 cache_idx, RD_HC
430                  error("put cursor %d\n", cache_idx);                  error("put cursor %d\n", cache_idx);
431          }          }
432  }  }
433    
434    /* BRUSH CACHE */
435    /* index 0 is 2 colour brush, index 1 is muti colour brush */
436    static BRUSHDATA g_brushcache[2][64];
437    
438    /* Retrieve brush from cache */
439    BRUSHDATA *
440    cache_get_brush_data(uint8 colour_code, uint8 idx)
441    {
442            colour_code = colour_code == 1 ? 0 : 1;
443            if (idx < NUM_ELEMENTS(g_brushcache[0]))
444            {
445                    return &g_brushcache[colour_code][idx];
446            }
447            error("get brush %d %d\n", colour_code, idx);
448            return NULL;
449    }
450    
451    /* Store brush in cache */
452    /* this function takes over the data pointer in struct, eg, caller gives it up */
453    void
454    cache_put_brush_data(uint8 colour_code, uint8 idx, BRUSHDATA * brush_data)
455    {
456            BRUSHDATA * bd;
457    
458            colour_code = colour_code == 1 ? 0 : 1;
459            if (idx < NUM_ELEMENTS(g_brushcache[0]))
460            {
461                    bd = &g_brushcache[colour_code][idx];
462                    if (bd->data != 0)
463                    {
464                            xfree(bd->data);
465                    }
466                    memcpy(bd, brush_data, sizeof(BRUSHDATA));
467            }
468            else
469            {
470                    error("put brush %d %d\n", colour_code, idx);
471            }
472    }

Legend:
Removed from v.1364  
changed lines
  Added in v.1483

  ViewVC Help
Powered by ViewVC 1.1.26