Annotation of researchv9/X11/src/X.V11R1/server/ddx/cfb/cfbmisc.c, revision 1.1.1.1

1.1       root        1: /***********************************************************
                      2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
                      3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
                      4: 
                      5:                         All Rights Reserved
                      6: 
                      7: Permission to use, copy, modify, and distribute this software and its 
                      8: documentation for any purpose and without fee is hereby granted, 
                      9: provided that the above copyright notice appear in all copies and that
                     10: both that copyright notice and this permission notice appear in 
                     11: supporting documentation, and that the names of Digital or MIT not be
                     12: used in advertising or publicity pertaining to distribution of the
                     13: software without specific, written prior permission.  
                     14: 
                     15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     21: SOFTWARE.
                     22: 
                     23: ******************************************************************/
                     24: 
                     25: #include "X.h"
                     26: #include "misc.h"
                     27: #include "cursor.h"
                     28: #include "screenint.h"
                     29: 
                     30: #include "cfb.h"
                     31: 
                     32: void cfbQueryBestSize(class, pwidth, pheight)
                     33: int class;
                     34: short *pwidth;
                     35: short *pheight;
                     36: {
                     37:     unsigned width, test;
                     38: 
                     39:     switch(class)
                     40:     {
                     41:       case CursorShape:
                     42:          *pwidth = 16;
                     43:          *pheight = 16;
                     44:          break;
                     45:       case TileShape:
                     46:       case StippleShape:
                     47:          width = *pwidth;
                     48:          /* Return the closes power of two not less than what they gave me */
                     49:          test = 0x80000000;
                     50:          /* Find the highest 1 bit in the width given */
                     51:          while(!(test & width))
                     52:             test >>= 1;
                     53:          /* If their number is greater than that, bump up to the next
                     54:           *  power of two */
                     55:          if((test - 1) & width)
                     56:             test <<= 1;
                     57:          *pwidth = test;
                     58:          /* We don't care what height they use */
                     59:          break;
                     60:     }
                     61: }
                     62: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.