darwinfb.h revision 6747b715
16747b715Smrg/*
26747b715Smrg * Copyright (C) 2009 Apple, Inc.
36747b715Smrg * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
46747b715Smrg *
56747b715Smrg * Permission is hereby granted, free of charge, to any person obtaining a
66747b715Smrg * copy of this software and associated documentation files (the "Software"),
76747b715Smrg * to deal in the Software without restriction, including without limitation
86747b715Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
96747b715Smrg * and/or sell copies of the Software, and to permit persons to whom the
106747b715Smrg * Software is furnished to do so, subject to the following conditions:
116747b715Smrg *
126747b715Smrg * The above copyright notice and this permission notice shall be included in
136747b715Smrg * all copies or substantial portions of the Software.
146747b715Smrg *
156747b715Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166747b715Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
176747b715Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
186747b715Smrg * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
196747b715Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
206747b715Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
216747b715Smrg * DEALINGS IN THE SOFTWARE.
226747b715Smrg *
236747b715Smrg * Except as contained in this notice, the name(s) of the above copyright
246747b715Smrg * holders shall not be used in advertising or otherwise to promote the sale,
256747b715Smrg * use or other dealings in this Software without prior written authorization.
266747b715Smrg */
276747b715Smrg
286747b715Smrg#ifndef _DARWIN_FB_H
296747b715Smrg#define _DARWIN_DB_H
306747b715Smrg
316747b715Smrg#include "scrnintstr.h"
326747b715Smrg
336747b715Smrgtypedef struct {
346747b715Smrg    void                *framebuffer;
356747b715Smrg    int                 x;
366747b715Smrg    int                 y;
376747b715Smrg    int                 width;
386747b715Smrg    int                 height;
396747b715Smrg    int                 pitch;
406747b715Smrg    int                 depth;
416747b715Smrg    int                 visuals;
426747b715Smrg    int                 bitsPerRGB;
436747b715Smrg    int                 bitsPerPixel;
446747b715Smrg    int                 preferredCVC;
456747b715Smrg    Pixel               redMask;
466747b715Smrg    Pixel               greenMask;
476747b715Smrg    Pixel               blueMask;
486747b715Smrg} DarwinFramebufferRec, *DarwinFramebufferPtr;
496747b715Smrg
506747b715Smrg#define MASK_LH(l,h) (((1 << (1 + (h) - (l))) - 1) << (l))
516747b715Smrg#define BM_ARGB(a,r,g,b) MASK_LH(0, (b) - 1)
526747b715Smrg#define GM_ARGB(a,r,g,b) MASK_LH(b, (b) + (g) - 1)
536747b715Smrg#define RM_ARGB(a,r,g,b) MASK_LH((b) + (g), (b) + (g) + (r) - 1)
546747b715Smrg#define AM_ARGB(a,r,g,b) MASK_LH((b) + (g) + (r), (b) + (g) + (r) + (a) - 1)
556747b715Smrg
566747b715Smrg#endif  /* _DARWIN_FB_H */
57