grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / cgfx / getcyberidattr.c
blob643aac6681d12c0587327899c876815c734d62ef
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <cybergraphx/cybergraphics.h>
11 #include <hidd/graphics.h>
12 #include <proto/graphics.h>
13 #include <proto/oop.h>
15 #include "cybergraphics_intern.h"
16 #include "gfxfuncsupport.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/cybergraphics.h>
23 AROS_LH2(ULONG, GetCyberIDAttr,
25 /* SYNOPSIS */
26 AROS_LHA(ULONG, attribute, D0),
27 AROS_LHA(ULONG, DisplayModeID, D1),
29 /* LOCATION */
30 struct Library *, CyberGfxBase, 17, Cybergraphics)
32 /* FUNCTION
33 Provides information about a specific RTG screenmode.
35 INPUTS
36 attribute - one of the following display attributes:
37 CYBERIDATTR_PIXFMT - the display's pixel format. See
38 LockBitMapTagList() for possible values.
39 CYBERIDATTR_WIDTH - the display's width (in pixels).
40 CYBERIDATTR_HEIGHT - the display's height (in pixels).
41 CYBERIDATTR_DEPTH - the number of bits per pixel.
42 CYBERIDATTR_BPPIX - the number of bytes per pixel.
43 DisplayModeID - an RTG screenmode ID.
45 RESULT
46 value - the value associated with the requested attribute.
48 NOTES
49 If an unknown attribute is requested, -1 is returned.
51 EXAMPLE
53 BUGS
55 SEE ALSO
57 INTERNALS
58 The function relies on pixelformat object being passed in
59 DimensionInfo.reserved[1] by graphics.library/GetDisplayInfoData().
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 IPTR retval = (IPTR)-1;
66 struct DimensionInfo info;
68 if (GetDisplayInfoData(NULL, (UBYTE *)&info, sizeof(info), DTAG_DIMS, DisplayModeID) == sizeof(info)) {
69 OOP_Object *pf = (OOP_Object *)info.reserved[1];
71 switch (attribute)
73 case CYBRIDATTR_PIXFMT:
74 OOP_GetAttr(pf, aHidd_PixFmt_CgxPixFmt, &retval);
75 D(if (-1 == retval) bug("!!! NO CGFX PIXFMT IN GetCyberIDAttr() !!!\n");)
76 break;
78 case CYBRIDATTR_DEPTH:
79 retval = info.MaxDepth;
80 break;
82 case CYBRIDATTR_WIDTH:
83 retval = info.Nominal.MaxX - info.Nominal.MinX + 1;
84 break;
86 case CYBRIDATTR_HEIGHT:
87 retval = info.Nominal.MaxY - info.Nominal.MinY + 1;
88 break;
90 case CYBRIDATTR_BPPIX:
91 OOP_GetAttr(pf, aHidd_PixFmt_BytesPerPixel, &retval);
92 break;
94 default:
95 D(bug("!!! UNKNOWN ATTRIBUTE IN GetCyberIDAttr(): %x !!!\n",
96 attribute));
97 break;
100 return retval;
102 AROS_LIBFUNC_EXIT
103 } /* GetCyberIDAttr */