~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xnest/Visual.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: Visual.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1993 by Davor Matic
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software
 
7
and its documentation for any purpose is hereby granted without fee,
 
8
provided that the above copyright notice appear in all copies and that
 
9
both that copyright notice and this permission notice appear in
 
10
supporting documentation.  Davor Matic makes no representations about
 
11
the suitability of this software for any purpose.  It is provided "as
 
12
is" without express or implied warranty.
 
13
 
 
14
*/
 
15
/* $XFree86$ */
 
16
 
 
17
#ifdef HAVE_XNEST_CONFIG_H
 
18
#include <xnest-config.h>
 
19
#endif
 
20
 
 
21
#include <X11/X.h>
 
22
#include <X11/Xproto.h>
 
23
#include "scrnintstr.h"
 
24
#include "dix.h"
 
25
#include "mi.h"
 
26
#include "mibstore.h"
 
27
#include "Xnest.h"
 
28
 
 
29
#include "Display.h"
 
30
#include "Visual.h"
 
31
 
 
32
Visual *
 
33
xnestVisual(VisualPtr pVisual)
 
34
{
 
35
  int i;
 
36
 
 
37
  for (i = 0; i < xnestNumVisuals; i++)
 
38
    if (pVisual->class == xnestVisuals[i].class &&
 
39
        pVisual->bitsPerRGBValue == xnestVisuals[i].bits_per_rgb &&
 
40
        pVisual->ColormapEntries == xnestVisuals[i].colormap_size &&
 
41
        pVisual->nplanes == xnestVisuals[i].depth &&
 
42
        pVisual->redMask == xnestVisuals[i].red_mask &&
 
43
        pVisual->greenMask == xnestVisuals[i].green_mask &&
 
44
        pVisual->blueMask == xnestVisuals[i].blue_mask)
 
45
      return xnestVisuals[i].visual;
 
46
 
 
47
  return NULL;
 
48
}
 
49
 
 
50
Visual *
 
51
xnestVisualFromID(ScreenPtr pScreen, VisualID visual)
 
52
{
 
53
  int i;
 
54
  
 
55
  for (i = 0; i < pScreen->numVisuals; i++)
 
56
    if (pScreen->visuals[i].vid == visual)
 
57
      return xnestVisual(&pScreen->visuals[i]);
 
58
 
 
59
  return NULL;
 
60
}
 
61
 
 
62
Colormap
 
63
xnestDefaultVisualColormap(Visual *visual)
 
64
{
 
65
  int i;
 
66
  
 
67
  for (i = 0; i < xnestNumVisuals; i++)
 
68
    if (xnestVisuals[i].visual == visual)
 
69
      return xnestDefaultColormaps[i];
 
70
  
 
71
  return None;
 
72
}