Added a test for MUIA_Listview_SelectChange.
[AROS.git] / arch / all-linux / hidd / linuxfb / bmclass.c
blobc4e527b799aed96f760c34e8f28593dde9817e97
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Onscreen bitmap class for linux fb device
6 Lang: English.
7 */
9 #define DEBUG 0
11 #include <aros/debug.h>
12 #include <aros/symbolsets.h>
13 #include <hidd/graphics.h>
14 #include <hidd/unixio.h>
15 #include <oop/oop.h>
16 #include <proto/oop.h>
17 #include <proto/utility.h>
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <string.h>
23 #include "linuxfb_intern.h"
24 #include "bitmap.h"
26 /*********** BitMap::New() *************************************/
28 OOP_Object *LinuxBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
30 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg);
31 D(bug("[LinuxBM] Created base bitmap %p\n", o));
33 if (NULL != o)
35 struct BitmapData *data = OOP_INST_DATA(cl, o);
36 OOP_Object *pf;
38 data->fbdev = GetTagData(aHidd_LinuxFBBitmap_FBDevInfo, -1, msg->attrList);
40 OOP_GetAttr(o, aHidd_BitMap_PixFmt, (IPTR *)&pf);
41 OOP_GetAttr(pf, aHidd_PixFmt_BitsPerPixel, &data->bpp);
44 return o;
47 BOOL LinuxBM__Hidd_BitMap__SetColors(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_SetColors *msg)
49 struct BitmapData *data = OOP_INST_DATA(cl, o);
51 if ((msg->firstColor + msg->numColors) > (1 << (data->bpp)))
53 return FALSE;
56 if (!OOP_DoSuperMethod(cl, o, (OOP_Msg)msg))
58 return FALSE;
61 if (data->fbdev != -1)
63 struct LinuxFB_staticdata *fsd = LSD(cl);
64 ULONG xc_i, col_i;
66 for ( xc_i = msg->firstColor, col_i = 0;
67 col_i < msg->numColors;
68 xc_i ++, col_i ++)
70 struct fb_cmap col =
72 xc_i, 1,
73 &msg->colors[col_i].red,
74 &msg->colors[col_i].green,
75 &msg->colors[col_i].blue,
76 &msg->colors[col_i].alpha
79 Hidd_UnixIO_IOControlFile(fsd->unixio, data->fbdev, FBIOPUTCMAP, &col, NULL);
82 return TRUE;