Port the SB128 code to AROS.
[AROS.git] / rom / hidds / graphics / chunkybm.c
blob4aaeae8cabd6f97730d4a12ad91e33d40917c616
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics chunky bitmap class implementation.
6 Lang: english
7 */
9 /****************************************************************************************/
11 #include <proto/exec.h>
12 #include <proto/utility.h>
13 #include <proto/oop.h>
15 #include <exec/memory.h>
16 #include <utility/tagitem.h>
17 #include <oop/oop.h>
19 #include <hidd/graphics.h>
21 #include "graphics_intern.h"
23 #include <string.h>
25 #define DEBUG 0
26 #include <aros/debug.h>
28 /****************************************************************************************/
30 OOP_Object *CBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
32 struct chunkybm_data *data;
33 OOP_Object *pf;
34 IPTR bytesperrow, bytesperpixel;
35 struct TagItem *tag;
36 OOP_MethodID dispose_mid;
38 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
39 if (NULL == o)
40 return NULL;
42 /* Initialize the instance data to 0 */
43 data = OOP_INST_DATA(cl, o);
44 memset(data, 0, sizeof (*data));
46 OOP_GetAttr(o, aHidd_BitMap_PixFmt, (APTR)&pf);
47 OOP_GetAttr(o, aHidd_BitMap_GfxHidd, (APTR)&data->gfxhidd);
48 /* Get some dimensions of the bitmap */
49 OOP_GetAttr(o, aHidd_BitMap_BytesPerRow, &bytesperrow);
50 OOP_GetAttr(pf, aHidd_PixFmt_BytesPerPixel, &bytesperpixel);
52 data->bytesperpixel = bytesperpixel;
53 data->bytesperrow = bytesperrow;
55 tag = FindTagItem(aHidd_ChunkyBM_Buffer, msg->attrList);
56 if (tag)
59 * NULL user-supplied buffer is valid.
60 * In this case we create a bitmap with no buffer. We can attach it later.
62 data->own_buffer = FALSE;
63 data->buffer = (APTR)tag->ti_Data;
65 return o;
67 else
69 IPTR height;
71 OOP_GetAttr(o, aHidd_BitMap_Height, &height);
73 data->own_buffer = TRUE;
74 data->buffer = AllocVec(height * bytesperrow, MEMF_ANY | MEMF_CLEAR);
76 if (data->buffer)
77 return o;
80 /* free all on error */
81 dispose_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose);
83 OOP_CoerceMethod(cl, o, (OOP_Msg)&dispose_mid);
84 return NULL;
87 /****************************************************************************************/
89 void CBM__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
91 struct chunkybm_data *data;
93 data = OOP_INST_DATA(cl, o);
95 if (data->own_buffer)
96 FreeVec(data->buffer);
98 OOP_DoSuperMethod(cl, o, msg);
100 return;
103 /****************************************************************************************/
105 VOID CBM__Hidd_BitMap__PutPixel(OOP_Class *cl, OOP_Object *o,
106 struct pHidd_BitMap_PutPixel *msg)
108 UBYTE *dest;
110 struct chunkybm_data *data;
112 data = OOP_INST_DATA(cl, o);
114 /* bitmap in chunky-mode */
115 dest = data->buffer + msg->x * data->bytesperpixel + msg->y * data->bytesperrow;
117 switch(data->bytesperpixel)
119 case 1:
120 *((UBYTE *) dest) = (UBYTE) msg->pixel;
121 break;
123 case 2:
124 *((UWORD *) dest) = (UWORD) msg->pixel;
125 break;
127 case 3:
128 #if AROS_BIG_ENDIAN
129 dest[0] = (UBYTE)(msg->pixel >> 16) & 0x000000FF;
130 dest[1] = (UBYTE)(msg->pixel >> 8) & 0x000000FF;
131 dest[2] = (UBYTE)msg->pixel & 0x000000FF;
132 #else
133 dest[0] = (UBYTE)msg->pixel & 0x000000FF;
134 dest[1] = (UBYTE)(msg->pixel >> 8) & 0x000000FF;
135 dest[2] = (UBYTE)(msg->pixel >> 16) & 0x000000FF;
136 #endif
137 break;
139 /* if (1 == ( ((IPTR)dest) & 1) )
141 *((UBYTE *) dest++) = (UBYTE) msg->pixel >> 16;
142 *((UWORD *) dest ) = (UWORD) msg->pixel;
144 else
146 *((UWORD *) dest++) = (UWORD) msg->pixel >> 8;
147 *((UBYTE *) dest ) = (UBYTE) msg->pixel;
149 break;
151 case 4:
152 *((ULONG *) dest) = (ULONG) msg->pixel;
153 break;
158 /****************************************************************************************/
160 ULONG CBM__Hidd_BitMap__GetPixel(OOP_Class *cl, OOP_Object *o,
161 struct pHidd_BitMap_GetPixel *msg)
163 HIDDT_Pixel retval = 0;
164 UBYTE *src;
165 struct chunkybm_data *data;
167 data = OOP_INST_DATA(cl, o);
169 src = data->buffer + msg->x * data->bytesperpixel + msg->y * data->bytesperrow;
171 switch(data->bytesperpixel)
173 case 1:
174 retval = (HIDDT_Pixel) *((UBYTE *) src);
175 break;
177 case 2:
178 retval = (HIDDT_Pixel) *((UWORD *) src);
179 break;
181 case 3:
182 #if AROS_BIG_ENDIAN
183 retval = (HIDDT_Pixel) (src[0] << 16) + (src[1] << 8) + src[2];
184 #else
185 retval = (HIDDT_Pixel) (src[2] << 16) + (src[1] << 8) + src[0];
186 #endif
187 break;
189 //(*((UBYTE *) src++) << 16) | *((UWORD *) src));
190 //break;
192 case 4:
193 retval = ((ULONG) *((ULONG *) src));
194 break;
197 return retval;
200 /****************************************************************************************/
202 VOID CBM__Hidd_BitMap__FillRect(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_DrawRect *msg)
204 struct chunkybm_data *data =OOP_INST_DATA(cl, o);
205 HIDDT_Pixel fg = GC_FG(msg->gc);
206 HIDDT_DrawMode mode = GC_DRMD(msg->gc);
207 ULONG mod;
209 mod = data->bytesperrow;
211 switch(mode)
213 case vHidd_GC_DrawMode_Copy:
214 switch(data->bytesperpixel)
216 case 1:
217 HIDD_BM_FillMemRect8(o,
218 data->buffer,
219 msg->minX,
220 msg->minY,
221 msg->maxX,
222 msg->maxY,
223 mod,
224 fg);
225 break;
227 case 2:
228 HIDD_BM_FillMemRect16(o,
229 data->buffer,
230 msg->minX,
231 msg->minY,
232 msg->maxX,
233 msg->maxY,
234 mod,
235 fg);
236 break;
238 case 3:
239 HIDD_BM_FillMemRect24(o,
240 data->buffer,
241 msg->minX,
242 msg->minY,
243 msg->maxX,
244 msg->maxY,
245 mod,
246 fg);
247 break;
249 case 4:
250 HIDD_BM_FillMemRect32(o,
251 data->buffer,
252 msg->minX,
253 msg->minY,
254 msg->maxX,
255 msg->maxY,
256 mod,
257 fg);
258 break;
261 break;
263 case vHidd_GC_DrawMode_Invert:
264 HIDD_BM_InvertMemRect(o,
265 data->buffer,
266 msg->minX * data->bytesperpixel,
267 msg->minY,
268 msg->maxX * data->bytesperpixel + data->bytesperpixel - 1,
269 msg->maxY,
270 mod);
271 break;
273 default:
274 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
275 break;
277 } /* switch(mode) */
281 /****************************************************************************************/
283 VOID CBM__Hidd_BitMap__PutImage(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImage *msg)
285 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
286 APTR dst_pixels, src_pixels;
287 OOP_Object *srcpf;
289 switch(msg->pixFmt)
291 case vHidd_StdPixFmt_Native:
292 switch(data->bytesperpixel)
294 case 1:
295 HIDD_BM_CopyMemBox8(o,
296 msg->pixels,
299 data->buffer,
300 msg->x,
301 msg->y,
302 msg->width,
303 msg->height,
304 msg->modulo,
305 data->bytesperrow);
306 break;
308 case 2:
309 HIDD_BM_CopyMemBox16(o,
310 msg->pixels,
313 data->buffer,
314 msg->x,
315 msg->y,
316 msg->width,
317 msg->height,
318 msg->modulo,
319 data->bytesperrow);
320 break;
322 case 3:
323 HIDD_BM_CopyMemBox24(o,
324 msg->pixels,
327 data->buffer,
328 msg->x,
329 msg->y,
330 msg->width,
331 msg->height,
332 msg->modulo,
333 data->bytesperrow);
334 break;
336 case 4:
337 HIDD_BM_CopyMemBox32(o,
338 msg->pixels,
341 data->buffer,
342 msg->x,
343 msg->y,
344 msg->width,
345 msg->height,
346 msg->modulo,
347 data->bytesperrow);
348 break;
350 } /* switch(data->bytesperpixel) */
351 break;
353 case vHidd_StdPixFmt_Native32:
354 switch(data->bytesperpixel)
356 case 1:
357 HIDD_BM_PutMem32Image8(o,
358 msg->pixels,
359 data->buffer,
360 msg->x,
361 msg->y,
362 msg->width,
363 msg->height,
364 msg->modulo,
365 data->bytesperrow);
366 break;
368 case 2:
369 HIDD_BM_PutMem32Image16(o,
370 msg->pixels,
371 data->buffer,
372 msg->x,
373 msg->y,
374 msg->width,
375 msg->height,
376 msg->modulo,
377 data->bytesperrow);
378 break;
380 case 3:
381 HIDD_BM_PutMem32Image24(o,
382 msg->pixels,
383 data->buffer,
384 msg->x,
385 msg->y,
386 msg->width,
387 msg->height,
388 msg->modulo,
389 data->bytesperrow);
390 break;
392 case 4:
393 HIDD_BM_CopyMemBox32(o,
394 msg->pixels,
397 data->buffer,
398 msg->x,
399 msg->y,
400 msg->width,
401 msg->height,
402 msg->modulo,
403 data->bytesperrow);
404 break;
406 } /* switch(data->bytesperpixel) */
407 break;
409 default:
410 src_pixels = msg->pixels;
411 dst_pixels = data->buffer + msg->y * data->bytesperrow
412 + msg->x * data->bytesperpixel;
413 srcpf = HIDD_Gfx_GetPixFmt(data->gfxhidd, msg->pixFmt);
415 HIDD_BM_ConvertPixels(o, &src_pixels,
416 (HIDDT_PixelFormat *)srcpf, msg->modulo, &dst_pixels,
417 BM_PIXFMT(o), data->bytesperrow, msg->width, msg->height,
418 NULL);
420 } /* switch(msg->pixFmt) */
424 /**************************************************************************/
426 int static inline
427 __attribute__((always_inline, const)) do_alpha(int a, int v)
429 int tmp = a * v;
430 return (tmp + (tmp >> 8) + 0x80) >> 8;
433 VOID CBM__Hidd_BitMap__PutAlphaImage(OOP_Class *cl, OOP_Object *o,
434 struct pHidd_BitMap_PutAlphaImage *msg)
436 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
437 HIDDT_StdPixFmt pixFmt = BM_PIXFMT(o)->stdpixfmt;
438 WORD x, y, src_step, dst_step;
439 UBYTE *p, *q;
440 UBYTE src_red, src_green, src_blue, src_alpha;
441 UBYTE dst_red, dst_green, dst_blue;
443 switch(pixFmt)
445 case vHidd_StdPixFmt_BGR032:
447 p = msg->pixels;
448 q = data->buffer + msg->y * data->bytesperrow
449 + msg->x * data->bytesperpixel;
450 src_step = msg->modulo - msg->width * 4;
451 dst_step = data->bytesperrow - data->bytesperpixel * msg->width;
453 for(y = 0; y < msg->height; y++)
455 for(x = 0; x < msg->width; x++)
457 src_alpha = *p++;
458 src_red = *p++;
459 src_green = *p++;
460 src_blue = *p++;
462 switch(src_alpha)
464 case 0:
465 q += 4;
466 break;
468 case 0xff:
469 *q++ = src_blue;
470 *q++ = src_green;
471 *q++ = src_red;
472 *q++ = 0;
473 break;
475 default:
476 dst_blue = *q;
477 dst_blue += do_alpha(src_alpha, src_blue - dst_blue);
478 *q++ = dst_blue;
480 dst_green = *q;
481 dst_green += do_alpha(src_alpha, src_green - dst_green);
482 *q++ = dst_green;
484 dst_red = *q;
485 dst_red += do_alpha(src_alpha, src_red - dst_red);
486 *q++ = dst_red;
488 *q++ = 0;
491 p += src_step;
492 q += dst_step;
494 break;
496 case vHidd_StdPixFmt_RGB16_LE:
498 p = msg->pixels;
499 q = data->buffer + msg->y * data->bytesperrow
500 + msg->x * data->bytesperpixel;
501 src_step = msg->modulo - msg->width * 4;
502 dst_step = data->bytesperrow - data->bytesperpixel * msg->width;
504 for(y = 0; y < msg->height; y++)
506 for(x = 0; x < msg->width; x++)
508 src_alpha = *p++;
509 src_red = *p++;
510 src_green = *p++;
511 src_blue = *p++;
513 switch(src_alpha)
515 case 0:
516 q += 2;
517 break;
519 case 0xff:
520 *q++ = (src_green << 3) & 0xe0 | src_blue >> 3;
521 *q++ = src_red & 0xf8 | src_green >> 5;
522 break;
524 default:
525 dst_blue = *q;
526 dst_red = *(q + 1);
527 dst_green = dst_red << 5 | dst_blue >> 3 & 0x1c;
528 dst_blue <<= 3;
529 dst_red &= 0xf8;
531 dst_blue += do_alpha(src_alpha, src_blue - dst_blue);
532 dst_green += do_alpha(src_alpha, src_green - dst_green);
533 dst_red += do_alpha(src_alpha, src_red - dst_red);
535 *q++ = (dst_green << 3) & 0xe0 | dst_blue >> 3;
536 *q++ = dst_red & 0xf8 | dst_green >> 5;
539 p += src_step;
540 q += dst_step;
542 break;
544 default:
545 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
546 break;
550 /****************************************************************************************/
552 VOID CBM__Hidd_BitMap__GetImage(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_GetImage *msg)
554 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
555 APTR src_pixels, dst_pixels;
556 OOP_Object *dstpf;
558 switch(msg->pixFmt)
560 case vHidd_StdPixFmt_Native:
561 switch(data->bytesperpixel)
563 case 1:
564 HIDD_BM_CopyMemBox8(o,
565 data->buffer,
566 msg->x,
567 msg->y,
568 msg->pixels,
571 msg->width,
572 msg->height,
573 data->bytesperrow,
574 msg->modulo);
575 break;
577 case 2:
578 HIDD_BM_CopyMemBox16(o,
579 data->buffer,
580 msg->x,
581 msg->y,
582 msg->pixels,
585 msg->width,
586 msg->height,
587 data->bytesperrow,
588 msg->modulo);
589 break;
591 case 3:
592 HIDD_BM_CopyMemBox24(o,
593 data->buffer,
594 msg->x,
595 msg->y,
596 msg->pixels,
599 msg->width,
600 msg->height,
601 data->bytesperrow,
602 msg->modulo);
603 break;
605 case 4:
606 HIDD_BM_CopyMemBox32(o,
607 data->buffer,
608 msg->x,
609 msg->y,
610 msg->pixels,
613 msg->width,
614 msg->height,
615 data->bytesperrow,
616 msg->modulo);
617 break;
619 } /* switch(data->bytesperpix) */
620 break;
622 case vHidd_StdPixFmt_Native32:
623 switch(data->bytesperpixel)
625 case 1:
626 HIDD_BM_GetMem32Image8(o,
627 data->buffer,
628 msg->x,
629 msg->y,
630 msg->pixels,
631 msg->width,
632 msg->height,
633 data->bytesperrow,
634 msg->modulo);
635 break;
637 case 2:
638 HIDD_BM_GetMem32Image16(o,
639 data->buffer,
640 msg->x,
641 msg->y,
642 msg->pixels,
643 msg->width,
644 msg->height,
645 data->bytesperrow,
646 msg->modulo);
647 break;
649 case 3:
650 HIDD_BM_GetMem32Image24(o,
651 data->buffer,
652 msg->x,
653 msg->y,
654 msg->pixels,
655 msg->width,
656 msg->height,
657 data->bytesperrow,
658 msg->modulo);
659 break;
661 case 4:
662 HIDD_BM_CopyMemBox32(o,
663 data->buffer,
664 msg->x,
665 msg->y,
666 msg->pixels,
669 msg->width,
670 msg->height,
671 data->bytesperrow,
672 msg->modulo);
673 break;
675 } /* switch(data->bytesperpixel) */
676 break;
678 default:
679 src_pixels = data->buffer + msg->y * data->bytesperrow
680 + msg->x * data->bytesperpixel;
681 dst_pixels = msg->pixels;
682 dstpf = HIDD_Gfx_GetPixFmt(data->gfxhidd, msg->pixFmt);
684 HIDD_BM_ConvertPixels(o, &src_pixels, BM_PIXFMT(o),
685 data->bytesperrow, &dst_pixels, (HIDDT_PixelFormat *)dstpf,
686 msg->modulo, msg->width, msg->height, NULL);
688 } /* switch(msg->pixFmt) */
692 /****************************************************************************************/
694 VOID CBM__Hidd_BitMap__PutImageLUT(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImageLUT *msg)
696 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
698 switch(data->bytesperpixel)
700 case 2:
701 HIDD_BM_CopyLUTMemBox16(o,
702 msg->pixels,
705 data->buffer,
706 msg->x,
707 msg->y,
708 msg->width,
709 msg->height,
710 msg->modulo,
711 data->bytesperrow,
712 msg->pixlut);
713 break;
715 case 3:
716 HIDD_BM_CopyLUTMemBox24(o,
717 msg->pixels,
720 data->buffer,
721 msg->x,
722 msg->y,
723 msg->width,
724 msg->height,
725 msg->modulo,
726 data->bytesperrow,
727 msg->pixlut);
728 break;
730 case 4:
731 HIDD_BM_CopyLUTMemBox32(o,
732 msg->pixels,
735 data->buffer,
736 msg->x,
737 msg->y,
738 msg->width,
739 msg->height,
740 msg->modulo,
741 data->bytesperrow,
742 msg->pixlut);
743 break;
745 default:
746 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
748 } /* switch(data->bytesperpixel) */
752 /****************************************************************************************/
754 VOID CBM__Hidd_BitMap__PutTemplate(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutTemplate *msg)
756 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
758 switch(data->bytesperpixel)
760 case 1:
761 HIDD_BM_PutMemTemplate8(o,
762 msg->gc,
763 msg->template,
764 msg->modulo,
765 msg->srcx,
766 data->buffer,
767 data->bytesperrow,
768 msg->x,
769 msg->y,
770 msg->width,
771 msg->height,
772 msg->inverttemplate);
773 break;
775 case 2:
776 HIDD_BM_PutMemTemplate16(o,
777 msg->gc,
778 msg->template,
779 msg->modulo,
780 msg->srcx,
781 data->buffer,
782 data->bytesperrow,
783 msg->x,
784 msg->y,
785 msg->width,
786 msg->height,
787 msg->inverttemplate);
788 break;
790 case 3:
791 HIDD_BM_PutMemTemplate24(o,
792 msg->gc,
793 msg->template,
794 msg->modulo,
795 msg->srcx,
796 data->buffer,
797 data->bytesperrow,
798 msg->x,
799 msg->y,
800 msg->width,
801 msg->height,
802 msg->inverttemplate);
803 break;
805 case 4:
806 HIDD_BM_PutMemTemplate32(o,
807 msg->gc,
808 msg->template,
809 msg->modulo,
810 msg->srcx,
811 data->buffer,
812 data->bytesperrow,
813 msg->x,
814 msg->y,
815 msg->width,
816 msg->height,
817 msg->inverttemplate);
818 break;
820 default:
821 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
822 break;
824 } /* switch(data->bytesperpixel) */
828 /****************************************************************************************/
830 VOID CBM__Hidd_BitMap__PutPattern(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutPattern *msg)
832 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
834 switch(data->bytesperpixel)
836 case 1:
837 HIDD_BM_PutMemPattern8(o,
838 msg->gc,
839 msg->pattern,
840 msg->patternsrcx,
841 msg->patternsrcy,
842 msg->patternheight,
843 msg->patterndepth,
844 msg->patternlut,
845 msg->invertpattern,
846 msg->mask,
847 msg->maskmodulo,
848 msg->masksrcx,
849 data->buffer,
850 data->bytesperrow,
851 msg->x,
852 msg->y,
853 msg->width,
854 msg->height);
855 break;
857 case 2:
858 HIDD_BM_PutMemPattern16(o,
859 msg->gc,
860 msg->pattern,
861 msg->patternsrcx,
862 msg->patternsrcy,
863 msg->patternheight,
864 msg->patterndepth,
865 msg->patternlut,
866 msg->invertpattern,
867 msg->mask,
868 msg->maskmodulo,
869 msg->masksrcx,
870 data->buffer,
871 data->bytesperrow,
872 msg->x,
873 msg->y,
874 msg->width,
875 msg->height);
876 break;
878 case 3:
879 HIDD_BM_PutMemPattern24(o,
880 msg->gc,
881 msg->pattern,
882 msg->patternsrcx,
883 msg->patternsrcy,
884 msg->patternheight,
885 msg->patterndepth,
886 msg->patternlut,
887 msg->invertpattern,
888 msg->mask,
889 msg->maskmodulo,
890 msg->masksrcx,
891 data->buffer,
892 data->bytesperrow,
893 msg->x,
894 msg->y,
895 msg->width,
896 msg->height);
897 break;
899 case 4:
900 HIDD_BM_PutMemPattern32(o,
901 msg->gc,
902 msg->pattern,
903 msg->patternsrcx,
904 msg->patternsrcy,
905 msg->patternheight,
906 msg->patterndepth,
907 msg->patternlut,
908 msg->invertpattern,
909 msg->mask,
910 msg->maskmodulo,
911 msg->masksrcx,
912 data->buffer,
913 data->bytesperrow,
914 msg->x,
915 msg->y,
916 msg->width,
917 msg->height);
918 break;
920 default:
921 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
922 break;
924 } /* switch(data->bytesperpixel) */
928 /****************************************************************************************/
930 VOID CBM__Root__Get(OOP_Class *cl, OOP_Object *o, struct pRoot_Get *msg)
932 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
933 ULONG idx;
935 EnterFunc(bug("BitMap::Get() attrID: %i storage: %p\n", msg->attrID, msg->storage));
937 if (IS_CHUNKYBM_ATTR(msg->attrID, idx))
939 switch (idx)
941 case aoHidd_ChunkyBM_Buffer:
942 *msg->storage = (IPTR)data->buffer;
943 return;
947 OOP_DoSuperMethod(cl, o, &msg->mID);
950 /****************************************************************************************/
952 VOID CBM__Root__Set(OOP_Class *cl, OOP_Object *o, struct pRoot_Set *msg)
954 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
955 struct TagItem *tag, *tstate;
956 ULONG idx;
958 tstate = msg->attrList;
959 while((tag = NextTagItem((const struct TagItem **)&tstate)))
961 if(IS_CHUNKYBM_ATTR(tag->ti_Tag, idx))
963 switch(idx)
965 case aoHidd_ChunkyBM_Buffer:
966 if (data->own_buffer)
968 FreeVec(data->buffer);
969 data->own_buffer = FALSE;
971 data->buffer = (UBYTE *)tag->ti_Data;
972 D(bug("[CBM] New buffer now 0x%p\n", data->buffer));
973 break;
978 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);