darwinfb.h revision 35c4bbdf
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
2935c4bbdfSmrg#define _DARWIN_FB_H
306747b715Smrg
316747b715Smrg#include "scrnintstr.h"
326747b715Smrg
336747b715Smrgtypedef struct {
346747b715Smrg    void                *framebuffer;
3535c4bbdfSmrg    int x;
3635c4bbdfSmrg    int y;
3735c4bbdfSmrg    int width;
3835c4bbdfSmrg    int height;
3935c4bbdfSmrg    int pitch;
4035c4bbdfSmrg    int depth;
4135c4bbdfSmrg    int visuals;
4235c4bbdfSmrg    int bitsPerRGB;
4335c4bbdfSmrg    int bitsPerPixel;
4435c4bbdfSmrg    int preferredCVC;
4535c4bbdfSmrg    Pixel redMask;
4635c4bbdfSmrg    Pixel greenMask;
4735c4bbdfSmrg    Pixel blueMask;
486747b715Smrg} DarwinFramebufferRec, *DarwinFramebufferPtr;
496747b715Smrg
5035c4bbdfSmrg#define MASK_LH(l, h)       (((1 << (1 + (h) - (l))) - 1) << (l))
5135c4bbdfSmrg#define BM_ARGB(a, r, g, b) MASK_LH(0, (b) - 1)
5235c4bbdfSmrg#define GM_ARGB(a, r, g, b) MASK_LH(b, (b) + (g) - 1)
5335c4bbdfSmrg#define RM_ARGB(a, r, g, b) MASK_LH((b) + (g), (b) + (g) + (r) - 1)
5435c4bbdfSmrg#define AM_ARGB(a, r, g, b) MASK_LH((b) + (g) + (r), \
5535c4bbdfSmrg                                    (b) + (g) + (r) + (a) - 1)
566747b715Smrg
576747b715Smrg#endif  /* _DARWIN_FB_H */
58