revert between 56095 -> 55830 in arch
[AROS.git] / rom / hidds / gfx / gfx_chunkybitmapclass.c
blob7721d89e22d6ea3d6925084bb3e1549f1da655cf
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Gfx chunky bitmap class implementation.
6 Lang: english
7 */
9 /****************************************************************************************/
11 #include "gfx_debug.h"
13 #include <proto/exec.h>
14 #include <proto/utility.h>
15 #include <proto/oop.h>
17 #include <exec/memory.h>
18 #include <utility/tagitem.h>
19 #include <oop/oop.h>
21 #include <hidd/gfx.h>
23 #include "gfx_intern.h"
25 #include <string.h>
27 /****************************************************************************************/
29 OOP_Object *CBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
31 struct Library *OOPBase = CSD(cl)->cs_OOPBase;
32 struct Library *UtilityBase = CSD(cl)->cs_UtilityBase;
33 struct chunkybm_data *data;
34 OOP_Object *pf;
35 IPTR bytesperrow, bytesperpixel;
36 struct TagItem *tag;
37 OOP_MethodID dispose_mid;
39 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
40 if (NULL == o)
41 return NULL;
43 /* Initialize the instance data to 0 */
44 data = OOP_INST_DATA(cl, o);
45 memset(data, 0, sizeof (*data));
47 OOP_GetAttr(o, aHidd_BitMap_PixFmt, (APTR)&pf);
48 OOP_GetAttr(o, aHidd_BitMap_GfxHidd, (APTR)&data->gfxhidd);
49 /* Get some dimensions of the bitmap */
50 OOP_GetAttr(o, aHidd_BitMap_BytesPerRow, &bytesperrow);
51 OOP_GetAttr(pf, aHidd_PixFmt_BytesPerPixel, &bytesperpixel);
53 data->bytesperpixel = bytesperpixel;
54 data->bytesperrow = bytesperrow;
56 tag = FindTagItem(aHidd_ChunkyBM_Buffer, msg->attrList);
57 if (tag)
60 * NULL user-supplied buffer is valid.
61 * In this case we create a bitmap with no buffer. We can attach it later.
63 data->own_buffer = FALSE;
64 data->buffer = (APTR)tag->ti_Data;
66 return o;
68 else
70 IPTR height;
72 OOP_GetAttr(o, aHidd_BitMap_Height, &height);
74 data->own_buffer = TRUE;
75 data->buffer = AllocVec(height * bytesperrow, MEMF_ANY | MEMF_CLEAR);
77 if (data->buffer)
78 return o;
81 /* free all on error */
82 dispose_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose);
84 OOP_CoerceMethod(cl, o, (OOP_Msg)&dispose_mid);
85 return NULL;
88 /****************************************************************************************/
90 void CBM__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
92 struct chunkybm_data *data;
94 data = OOP_INST_DATA(cl, o);
96 if (data->own_buffer)
97 FreeVec(data->buffer);
99 OOP_DoSuperMethod(cl, o, msg);
101 return;
104 /****************************************************************************************/
106 VOID CBM__Hidd_BitMap__PutPixel(OOP_Class *cl, OOP_Object *o,
107 struct pHidd_BitMap_PutPixel *msg)
109 UBYTE *dest;
111 struct chunkybm_data *data;
113 data = OOP_INST_DATA(cl, o);
115 /* bitmap in chunky-mode */
116 dest = data->buffer + msg->x * data->bytesperpixel + msg->y * data->bytesperrow;
118 switch(data->bytesperpixel)
120 case 1:
121 *((UBYTE *) dest) = (UBYTE) msg->pixel;
122 break;
124 case 2:
125 *((UWORD *) dest) = (UWORD) msg->pixel;
126 break;
128 case 3:
129 #if AROS_BIG_ENDIAN
130 dest[0] = (UBYTE)(msg->pixel >> 16) & 0x000000FF;
131 dest[1] = (UBYTE)(msg->pixel >> 8) & 0x000000FF;
132 dest[2] = (UBYTE)msg->pixel & 0x000000FF;
133 #else
134 dest[0] = (UBYTE)msg->pixel & 0x000000FF;
135 dest[1] = (UBYTE)(msg->pixel >> 8) & 0x000000FF;
136 dest[2] = (UBYTE)(msg->pixel >> 16) & 0x000000FF;
137 #endif
138 break;
140 /* if (1 == ( ((IPTR)dest) & 1) )
142 *((UBYTE *) dest++) = (UBYTE) msg->pixel >> 16;
143 *((UWORD *) dest ) = (UWORD) msg->pixel;
145 else
147 *((UWORD *) dest++) = (UWORD) msg->pixel >> 8;
148 *((UBYTE *) dest ) = (UBYTE) msg->pixel;
150 break;
152 case 4:
153 *((ULONG *) dest) = (ULONG) msg->pixel;
154 break;
159 /****************************************************************************************/
161 ULONG CBM__Hidd_BitMap__GetPixel(OOP_Class *cl, OOP_Object *o,
162 struct pHidd_BitMap_GetPixel *msg)
164 HIDDT_Pixel retval = 0;
165 UBYTE *src;
166 struct chunkybm_data *data;
168 data = OOP_INST_DATA(cl, o);
170 src = data->buffer + msg->x * data->bytesperpixel + msg->y * data->bytesperrow;
172 switch(data->bytesperpixel)
174 case 1:
175 retval = (HIDDT_Pixel) *((UBYTE *) src);
176 break;
178 case 2:
179 retval = (HIDDT_Pixel) *((UWORD *) src);
180 break;
182 case 3:
183 #if AROS_BIG_ENDIAN
184 retval = (HIDDT_Pixel) (src[0] << 16) + (src[1] << 8) + src[2];
185 #else
186 retval = (HIDDT_Pixel) (src[2] << 16) + (src[1] << 8) + src[0];
187 #endif
188 break;
190 //(*((UBYTE *) src++) << 16) | *((UWORD *) src));
191 //break;
193 case 4:
194 retval = ((ULONG) *((ULONG *) src));
195 break;
198 return retval;
201 /****************************************************************************************/
203 VOID CBM__Hidd_BitMap__FillRect(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_DrawRect *msg)
205 struct chunkybm_data *data =OOP_INST_DATA(cl, o);
206 HIDDT_Pixel fg = GC_FG(msg->gc);
207 HIDDT_DrawMode mode = GC_DRMD(msg->gc);
208 ULONG mod;
210 mod = data->bytesperrow;
212 switch(mode)
214 case vHidd_GC_DrawMode_Copy:
215 switch(data->bytesperpixel)
217 case 1:
218 HIDD_BM_FillMemRect8(o,
219 data->buffer,
220 msg->minX,
221 msg->minY,
222 msg->maxX,
223 msg->maxY,
224 mod,
225 fg);
226 break;
228 case 2:
229 HIDD_BM_FillMemRect16(o,
230 data->buffer,
231 msg->minX,
232 msg->minY,
233 msg->maxX,
234 msg->maxY,
235 mod,
236 fg);
237 break;
239 case 3:
240 HIDD_BM_FillMemRect24(o,
241 data->buffer,
242 msg->minX,
243 msg->minY,
244 msg->maxX,
245 msg->maxY,
246 mod,
247 fg);
248 break;
250 case 4:
251 HIDD_BM_FillMemRect32(o,
252 data->buffer,
253 msg->minX,
254 msg->minY,
255 msg->maxX,
256 msg->maxY,
257 mod,
258 fg);
259 break;
262 break;
264 case vHidd_GC_DrawMode_Invert:
265 HIDD_BM_InvertMemRect(o,
266 data->buffer,
267 msg->minX * data->bytesperpixel,
268 msg->minY,
269 msg->maxX * data->bytesperpixel + data->bytesperpixel - 1,
270 msg->maxY,
271 mod);
272 break;
274 default:
275 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
276 break;
278 } /* switch(mode) */
282 /****************************************************************************************/
284 VOID CBM__Hidd_BitMap__PutImage(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImage *msg)
286 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
287 APTR dst_pixels, src_pixels;
288 OOP_Object *srcpf;
290 switch(msg->pixFmt)
292 case vHidd_StdPixFmt_Native:
293 switch(data->bytesperpixel)
295 case 1:
296 HIDD_BM_CopyMemBox8(o,
297 msg->pixels,
300 data->buffer,
301 msg->x,
302 msg->y,
303 msg->width,
304 msg->height,
305 msg->modulo,
306 data->bytesperrow);
307 break;
309 case 2:
310 HIDD_BM_CopyMemBox16(o,
311 msg->pixels,
314 data->buffer,
315 msg->x,
316 msg->y,
317 msg->width,
318 msg->height,
319 msg->modulo,
320 data->bytesperrow);
321 break;
323 case 3:
324 HIDD_BM_CopyMemBox24(o,
325 msg->pixels,
328 data->buffer,
329 msg->x,
330 msg->y,
331 msg->width,
332 msg->height,
333 msg->modulo,
334 data->bytesperrow);
335 break;
337 case 4:
338 HIDD_BM_CopyMemBox32(o,
339 msg->pixels,
342 data->buffer,
343 msg->x,
344 msg->y,
345 msg->width,
346 msg->height,
347 msg->modulo,
348 data->bytesperrow);
349 break;
351 } /* switch(data->bytesperpixel) */
352 break;
354 case vHidd_StdPixFmt_Native32:
355 switch(data->bytesperpixel)
357 case 1:
358 HIDD_BM_PutMem32Image8(o,
359 msg->pixels,
360 data->buffer,
361 msg->x,
362 msg->y,
363 msg->width,
364 msg->height,
365 msg->modulo,
366 data->bytesperrow);
367 break;
369 case 2:
370 HIDD_BM_PutMem32Image16(o,
371 msg->pixels,
372 data->buffer,
373 msg->x,
374 msg->y,
375 msg->width,
376 msg->height,
377 msg->modulo,
378 data->bytesperrow);
379 break;
381 case 3:
382 HIDD_BM_PutMem32Image24(o,
383 msg->pixels,
384 data->buffer,
385 msg->x,
386 msg->y,
387 msg->width,
388 msg->height,
389 msg->modulo,
390 data->bytesperrow);
391 break;
393 case 4:
394 HIDD_BM_CopyMemBox32(o,
395 msg->pixels,
398 data->buffer,
399 msg->x,
400 msg->y,
401 msg->width,
402 msg->height,
403 msg->modulo,
404 data->bytesperrow);
405 break;
407 } /* switch(data->bytesperpixel) */
408 break;
410 default:
411 src_pixels = msg->pixels;
412 dst_pixels = data->buffer + msg->y * data->bytesperrow
413 + msg->x * data->bytesperpixel;
414 srcpf = HIDD_Gfx_GetPixFmt(data->gfxhidd, msg->pixFmt);
416 HIDD_BM_ConvertPixels(o, &src_pixels,
417 (HIDDT_PixelFormat *)srcpf, msg->modulo, &dst_pixels,
418 BM_PIXFMT(o), data->bytesperrow, msg->width, msg->height,
419 NULL);
421 } /* switch(msg->pixFmt) */
425 /**************************************************************************/
427 int static inline
428 __attribute__((always_inline, const)) do_alpha(int a, int v)
430 int tmp = a * v;
431 return (tmp + (tmp >> 8) + 0x80) >> 8;
434 VOID CBM__Hidd_BitMap__PutAlphaImage(OOP_Class *cl, OOP_Object *o,
435 struct pHidd_BitMap_PutAlphaImage *msg)
437 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
438 HIDDT_StdPixFmt pixFmt = BM_PIXFMT(o)->stdpixfmt;
439 WORD x, y, src_step, dst_step;
440 UBYTE *p, *q;
441 UBYTE src_red, src_green, src_blue, src_alpha;
442 UBYTE dst_red, dst_green, dst_blue;
444 switch(pixFmt)
446 case vHidd_StdPixFmt_BGR032:
448 p = msg->pixels;
449 q = data->buffer + msg->y * data->bytesperrow
450 + msg->x * data->bytesperpixel;
451 src_step = msg->modulo - msg->width * 4;
452 dst_step = data->bytesperrow - data->bytesperpixel * msg->width;
454 for(y = 0; y < msg->height; y++)
456 for(x = 0; x < msg->width; x++)
458 src_alpha = *p++;
459 src_red = *p++;
460 src_green = *p++;
461 src_blue = *p++;
463 switch(src_alpha)
465 case 0:
466 q += 4;
467 break;
469 case 0xff:
470 *q++ = src_blue;
471 *q++ = src_green;
472 *q++ = src_red;
473 *q++ = 0;
474 break;
476 default:
477 dst_blue = *q;
478 dst_blue += do_alpha(src_alpha, src_blue - dst_blue);
479 *q++ = dst_blue;
481 dst_green = *q;
482 dst_green += do_alpha(src_alpha, src_green - dst_green);
483 *q++ = dst_green;
485 dst_red = *q;
486 dst_red += do_alpha(src_alpha, src_red - dst_red);
487 *q++ = dst_red;
489 *q++ = 0;
492 p += src_step;
493 q += dst_step;
495 break;
497 case vHidd_StdPixFmt_RGB16_LE:
499 p = msg->pixels;
500 q = data->buffer + msg->y * data->bytesperrow
501 + msg->x * data->bytesperpixel;
502 src_step = msg->modulo - msg->width * 4;
503 dst_step = data->bytesperrow - data->bytesperpixel * msg->width;
505 for(y = 0; y < msg->height; y++)
507 for(x = 0; x < msg->width; x++)
509 src_alpha = *p++;
510 src_red = *p++;
511 src_green = *p++;
512 src_blue = *p++;
514 switch(src_alpha)
516 case 0:
517 q += 2;
518 break;
520 case 0xff:
521 *q++ = (src_green << 3) & 0xe0 | src_blue >> 3;
522 *q++ = src_red & 0xf8 | src_green >> 5;
523 break;
525 default:
526 dst_blue = *q;
527 dst_red = *(q + 1);
528 dst_green = dst_red << 5 | dst_blue >> 3 & 0x1c;
529 dst_blue <<= 3;
530 dst_red &= 0xf8;
532 dst_blue += do_alpha(src_alpha, src_blue - dst_blue);
533 dst_green += do_alpha(src_alpha, src_green - dst_green);
534 dst_red += do_alpha(src_alpha, src_red - dst_red);
536 *q++ = (dst_green << 3) & 0xe0 | dst_blue >> 3;
537 *q++ = dst_red & 0xf8 | dst_green >> 5;
540 p += src_step;
541 q += dst_step;
543 break;
545 default:
546 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
547 break;
551 /****************************************************************************************/
553 VOID CBM__Hidd_BitMap__GetImage(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_GetImage *msg)
555 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
556 APTR src_pixels, dst_pixels;
557 OOP_Object *dstpf;
559 switch(msg->pixFmt)
561 case vHidd_StdPixFmt_Native:
562 switch(data->bytesperpixel)
564 case 1:
565 HIDD_BM_CopyMemBox8(o,
566 data->buffer,
567 msg->x,
568 msg->y,
569 msg->pixels,
572 msg->width,
573 msg->height,
574 data->bytesperrow,
575 msg->modulo);
576 break;
578 case 2:
579 HIDD_BM_CopyMemBox16(o,
580 data->buffer,
581 msg->x,
582 msg->y,
583 msg->pixels,
586 msg->width,
587 msg->height,
588 data->bytesperrow,
589 msg->modulo);
590 break;
592 case 3:
593 HIDD_BM_CopyMemBox24(o,
594 data->buffer,
595 msg->x,
596 msg->y,
597 msg->pixels,
600 msg->width,
601 msg->height,
602 data->bytesperrow,
603 msg->modulo);
604 break;
606 case 4:
607 HIDD_BM_CopyMemBox32(o,
608 data->buffer,
609 msg->x,
610 msg->y,
611 msg->pixels,
614 msg->width,
615 msg->height,
616 data->bytesperrow,
617 msg->modulo);
618 break;
620 } /* switch(data->bytesperpix) */
621 break;
623 case vHidd_StdPixFmt_Native32:
624 switch(data->bytesperpixel)
626 case 1:
627 HIDD_BM_GetMem32Image8(o,
628 data->buffer,
629 msg->x,
630 msg->y,
631 msg->pixels,
632 msg->width,
633 msg->height,
634 data->bytesperrow,
635 msg->modulo);
636 break;
638 case 2:
639 HIDD_BM_GetMem32Image16(o,
640 data->buffer,
641 msg->x,
642 msg->y,
643 msg->pixels,
644 msg->width,
645 msg->height,
646 data->bytesperrow,
647 msg->modulo);
648 break;
650 case 3:
651 HIDD_BM_GetMem32Image24(o,
652 data->buffer,
653 msg->x,
654 msg->y,
655 msg->pixels,
656 msg->width,
657 msg->height,
658 data->bytesperrow,
659 msg->modulo);
660 break;
662 case 4:
663 HIDD_BM_CopyMemBox32(o,
664 data->buffer,
665 msg->x,
666 msg->y,
667 msg->pixels,
670 msg->width,
671 msg->height,
672 data->bytesperrow,
673 msg->modulo);
674 break;
676 } /* switch(data->bytesperpixel) */
677 break;
679 default:
680 src_pixels = data->buffer + msg->y * data->bytesperrow
681 + msg->x * data->bytesperpixel;
682 dst_pixels = msg->pixels;
683 dstpf = HIDD_Gfx_GetPixFmt(data->gfxhidd, msg->pixFmt);
685 HIDD_BM_ConvertPixels(o, &src_pixels, BM_PIXFMT(o),
686 data->bytesperrow, &dst_pixels, (HIDDT_PixelFormat *)dstpf,
687 msg->modulo, msg->width, msg->height, NULL);
689 } /* switch(msg->pixFmt) */
693 /****************************************************************************************/
695 VOID CBM__Hidd_BitMap__PutImageLUT(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImageLUT *msg)
697 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
699 switch(data->bytesperpixel)
701 case 2:
702 HIDD_BM_CopyLUTMemBox16(o,
703 msg->pixels,
706 data->buffer,
707 msg->x,
708 msg->y,
709 msg->width,
710 msg->height,
711 msg->modulo,
712 data->bytesperrow,
713 msg->pixlut);
714 break;
716 case 3:
717 HIDD_BM_CopyLUTMemBox24(o,
718 msg->pixels,
721 data->buffer,
722 msg->x,
723 msg->y,
724 msg->width,
725 msg->height,
726 msg->modulo,
727 data->bytesperrow,
728 msg->pixlut);
729 break;
731 case 4:
732 HIDD_BM_CopyLUTMemBox32(o,
733 msg->pixels,
736 data->buffer,
737 msg->x,
738 msg->y,
739 msg->width,
740 msg->height,
741 msg->modulo,
742 data->bytesperrow,
743 msg->pixlut);
744 break;
746 default:
747 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
749 } /* switch(data->bytesperpixel) */
753 /****************************************************************************************/
755 VOID CBM__Hidd_BitMap__PutTemplate(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutTemplate *msg)
757 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
759 switch(data->bytesperpixel)
761 case 1:
762 HIDD_BM_PutMemTemplate8(o,
763 msg->gc,
764 msg->masktemplate,
765 msg->modulo,
766 msg->srcx,
767 data->buffer,
768 data->bytesperrow,
769 msg->x,
770 msg->y,
771 msg->width,
772 msg->height,
773 msg->inverttemplate);
774 break;
776 case 2:
777 HIDD_BM_PutMemTemplate16(o,
778 msg->gc,
779 msg->masktemplate,
780 msg->modulo,
781 msg->srcx,
782 data->buffer,
783 data->bytesperrow,
784 msg->x,
785 msg->y,
786 msg->width,
787 msg->height,
788 msg->inverttemplate);
789 break;
791 case 3:
792 HIDD_BM_PutMemTemplate24(o,
793 msg->gc,
794 msg->masktemplate,
795 msg->modulo,
796 msg->srcx,
797 data->buffer,
798 data->bytesperrow,
799 msg->x,
800 msg->y,
801 msg->width,
802 msg->height,
803 msg->inverttemplate);
804 break;
806 case 4:
807 HIDD_BM_PutMemTemplate32(o,
808 msg->gc,
809 msg->masktemplate,
810 msg->modulo,
811 msg->srcx,
812 data->buffer,
813 data->bytesperrow,
814 msg->x,
815 msg->y,
816 msg->width,
817 msg->height,
818 msg->inverttemplate);
819 break;
821 default:
822 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
823 break;
825 } /* switch(data->bytesperpixel) */
829 /****************************************************************************************/
831 VOID CBM__Hidd_BitMap__PutPattern(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutPattern *msg)
833 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
835 switch(data->bytesperpixel)
837 case 1:
838 HIDD_BM_PutMemPattern8(o,
839 msg->gc,
840 msg->pattern,
841 msg->patternsrcx,
842 msg->patternsrcy,
843 msg->patternheight,
844 msg->patterndepth,
845 msg->patternlut,
846 msg->invertpattern,
847 msg->mask,
848 msg->maskmodulo,
849 msg->masksrcx,
850 data->buffer,
851 data->bytesperrow,
852 msg->x,
853 msg->y,
854 msg->width,
855 msg->height);
856 break;
858 case 2:
859 HIDD_BM_PutMemPattern16(o,
860 msg->gc,
861 msg->pattern,
862 msg->patternsrcx,
863 msg->patternsrcy,
864 msg->patternheight,
865 msg->patterndepth,
866 msg->patternlut,
867 msg->invertpattern,
868 msg->mask,
869 msg->maskmodulo,
870 msg->masksrcx,
871 data->buffer,
872 data->bytesperrow,
873 msg->x,
874 msg->y,
875 msg->width,
876 msg->height);
877 break;
879 case 3:
880 HIDD_BM_PutMemPattern24(o,
881 msg->gc,
882 msg->pattern,
883 msg->patternsrcx,
884 msg->patternsrcy,
885 msg->patternheight,
886 msg->patterndepth,
887 msg->patternlut,
888 msg->invertpattern,
889 msg->mask,
890 msg->maskmodulo,
891 msg->masksrcx,
892 data->buffer,
893 data->bytesperrow,
894 msg->x,
895 msg->y,
896 msg->width,
897 msg->height);
898 break;
900 case 4:
901 HIDD_BM_PutMemPattern32(o,
902 msg->gc,
903 msg->pattern,
904 msg->patternsrcx,
905 msg->patternsrcy,
906 msg->patternheight,
907 msg->patterndepth,
908 msg->patternlut,
909 msg->invertpattern,
910 msg->mask,
911 msg->maskmodulo,
912 msg->masksrcx,
913 data->buffer,
914 data->bytesperrow,
915 msg->x,
916 msg->y,
917 msg->width,
918 msg->height);
919 break;
921 default:
922 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
923 break;
925 } /* switch(data->bytesperpixel) */
929 /****************************************************************************************/
931 BOOL CBM__Hidd_BitMap__ObtainDirectAccess(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_ObtainDirectAccess *msg)
933 struct Library *OOPBase = CSD(cl)->cs_OOPBase;
934 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
936 IPTR width, height;
938 OOP_GetAttr(o, aHidd_BitMap_Width, &width);
939 OOP_GetAttr(o, aHidd_BitMap_Height, &height);
941 *msg->addressReturn = data->buffer;
942 *msg->widthReturn = width;
943 *msg->heightReturn = height;
944 *msg->bankSizeReturn = *msg->memSizeReturn = data->bytesperrow * height;
946 return TRUE;
949 /****************************************************************************************/
951 VOID CBM__Hidd_BitMap__ReleaseDirectAccess(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_ReleaseDirectAccess *msg)
955 /****************************************************************************************/
957 VOID CBM__Root__Get(OOP_Class *cl, OOP_Object *o, struct pRoot_Get *msg)
959 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
960 ULONG idx;
962 EnterFunc(bug("BitMap::Get() attrID: %i storage: %p\n", msg->attrID, msg->storage));
964 if (IS_CHUNKYBM_ATTR(msg->attrID, idx))
966 switch (idx)
968 case aoHidd_ChunkyBM_Buffer:
969 *msg->storage = (IPTR)data->buffer;
970 return;
974 OOP_DoSuperMethod(cl, o, &msg->mID);
977 /****************************************************************************************/
979 VOID CBM__Root__Set(OOP_Class *cl, OOP_Object *o, struct pRoot_Set *msg)
981 struct Library *UtilityBase = CSD(cl)->cs_UtilityBase;
982 struct chunkybm_data *data = OOP_INST_DATA(cl, o);
983 struct TagItem *tag, *tstate;
984 ULONG idx;
986 tstate = msg->attrList;
987 while((tag = NextTagItem(&tstate)))
989 if(IS_CHUNKYBM_ATTR(tag->ti_Tag, idx))
991 switch(idx)
993 case aoHidd_ChunkyBM_Buffer:
994 if (data->own_buffer)
996 FreeVec(data->buffer);
997 data->own_buffer = FALSE;
999 data->buffer = (UBYTE *)tag->ti_Data;
1000 D(bug("[CBM] New buffer now 0x%p\n", data->buffer));
1001 break;
1006 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);