2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <clib/macros.h>
8 #include <graphics/gfxbase.h>
9 #include <graphics/rastport.h>
10 #include <proto/graphics.h>
12 #include "gfxfuncsupport.h"
14 /****************************************************************************************/
16 static const UBYTE rectfmt_bytes_per_pixel
[] =
25 static const UBYTE ext_rectfmt_bytes_per_pixel
[] =
27 2, /* RECTFMT_RGB15 */
28 2, /* RECTFMT_BGR15 */
29 2, /* RECTFMT_RGB15PC */
30 2, /* RECTFMT_BGR15PC */
31 2, /* RECTFMT_RGB16 */
32 2, /* RECTFMT_BGR16 */
33 2, /* RECTFMT_RGB16PC */
34 2, /* RECTFMT_BGR16PC */
36 3, /* RECTFMT_BGR24 */
38 4, /* RECTFMT_BGRA32 */
40 4, /* RECTFMT_ABGR32 */
41 4, /* RECTFMT_0RGB32 */
42 4, /* RECTFMT_BGR032 */
43 4, /* RECTFMT_RGB032 */
44 4 /* RECTFMT_0BGR32 */
47 static const HIDDT_StdPixFmt hidd_rectfmt
[] =
49 vHidd_StdPixFmt_RGB24
,
50 vHidd_StdPixFmt_RGBA32
,
51 vHidd_StdPixFmt_ARGB32
,
54 vHidd_StdPixFmt_Native
57 static const HIDDT_StdPixFmt ext_hidd_rectfmt
[] =
59 vHidd_StdPixFmt_RGB15
,
60 vHidd_StdPixFmt_BGR15
,
61 vHidd_StdPixFmt_RGB15_LE
,
62 vHidd_StdPixFmt_BGR15_LE
,
63 vHidd_StdPixFmt_RGB16
,
64 vHidd_StdPixFmt_BGR16
,
65 vHidd_StdPixFmt_RGB16_LE
,
66 vHidd_StdPixFmt_BGR16_LE
,
68 vHidd_StdPixFmt_BGR24
,
70 vHidd_StdPixFmt_BGRA32
,
72 vHidd_StdPixFmt_ABGR32
,
73 vHidd_StdPixFmt_0RGB32
,
74 vHidd_StdPixFmt_BGR032
,
75 vHidd_StdPixFmt_RGB032
,
76 vHidd_StdPixFmt_0BGR32
79 UBYTE
GetRectFmtBytesPerPixel(UBYTE rectfmt
, struct RastPort
*rp
,
80 struct Library
*CyberGfxBase
)
86 if (rectfmt
== RECTFMT_RAW
)
88 OOP_GetAttr(HIDD_BM_OBJ(rp
->BitMap
), aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
89 OOP_GetAttr(pf
, aHidd_PixFmt_BytesPerPixel
, &oop_result
);
92 else if (rectfmt
< RECTFMT_RGB15
)
93 result
= rectfmt_bytes_per_pixel
[rectfmt
];
95 result
= ext_rectfmt_bytes_per_pixel
[rectfmt
- RECTFMT_RGB15
];
100 HIDDT_StdPixFmt
GetHIDDRectFmt(UBYTE rectfmt
, struct RastPort
*rp
,
101 struct Library
*CyberGfxBase
)
103 HIDDT_StdPixFmt result
;
105 if (rectfmt
< RECTFMT_RGB15
)
106 result
= hidd_rectfmt
[rectfmt
];
108 result
= ext_hidd_rectfmt
[rectfmt
- RECTFMT_RGB15
];