2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Driver for using gfxhidd for gfx output
11 #include <proto/exec.h>
12 #include <proto/graphics.h>
13 #include <proto/layers.h>
14 #include <proto/arossupport.h>
15 #include <proto/utility.h>
16 #include <proto/oop.h>
18 #include <exec/memory.h>
19 #include <exec/semaphores.h>
20 #include <clib/macros.h>
22 #include <graphics/rastport.h>
23 #include <graphics/gfxbase.h>
24 #include <graphics/text.h>
25 #include <graphics/view.h>
26 #include <graphics/layers.h>
27 #include <graphics/clip.h>
28 #include <graphics/gfxmacros.h>
29 #include <graphics/regions.h>
30 #include <graphics/scale.h>
33 #include <utility/tagitem.h>
34 #include <aros/asmcall.h>
36 #include <intuition/intuition.h>
38 #include <hidd/graphics.h>
40 #include <cybergraphx/cybergraphics.h>
45 #include "graphics_intern.h"
46 #include "graphics_internal.h"
47 #include "intregions.h"
49 #include "gfxfuncsupport.h"
50 #include "fontsupport.h"
54 #include <aros/debug.h>
57 static BOOL
init_cursor(struct GfxBase
*GfxBase
);
58 static VOID
cleanup_cursor(struct GfxBase
*GfxBase
);
60 struct rgbpix_render_data
66 static LONG
rgbpix_write(APTR pr_data
, OOP_Object
*bm
, OOP_Object
*gc
,
67 LONG x
, LONG y
, struct GfxBase
*GfxBase
)
69 struct rgbpix_render_data
*prd
;
71 prd
= (struct rgbpix_render_data
*)pr_data
;
73 HIDD_BM_PutPixel(bm
, x
, y
, prd
->pixel
);
78 OOP_AttrBase HiddBitMapAttrBase
= 0;
79 OOP_AttrBase HiddGCAttrBase
= 0;
80 OOP_AttrBase HiddSyncAttrBase
= 0;
81 OOP_AttrBase HiddPixFmtAttrBase
= 0;
82 OOP_AttrBase HiddPlanarBMAttrBase
= 0;
83 OOP_AttrBase HiddGfxAttrBase
= 0;
84 OOP_AttrBase HiddFakeGfxHiddAttrBase
= 0;
86 static struct OOP_ABDescr attrbases
[] = {
87 { IID_Hidd_BitMap
, &HiddBitMapAttrBase
},
88 { IID_Hidd_GC
, &HiddGCAttrBase
},
89 { IID_Hidd_Sync
, &HiddSyncAttrBase
},
90 { IID_Hidd_PixFmt
, &HiddPixFmtAttrBase
},
91 { IID_Hidd_PlanarBM
, &HiddPlanarBMAttrBase
},
92 { IID_Hidd_Gfx
, &HiddGfxAttrBase
},
93 { IID_Hidd_FakeGfxHidd
, &HiddFakeGfxHiddAttrBase
},
102 struct TextFont etf_Font
;
106 /* InitDriverData() just allocates memory for the struct. To use e.g. */
107 /* AreaPtrns, UpdateAreaPtrn() has to allocate the memory for the */
108 /* Pattern itself (and free previously used memory!) */
110 #if NEW_DRIVERDATA_CODE
112 static inline LONG
CalcDriverDataHash(APTR resource
)
114 LONG l1
, l2
, l3
, l4
, hash
;
116 /* FIXME: Probably sucks. I have no clue about this hash stuff */
118 l1
= ((LONG
)resource
) & 0xFF;
119 l2
= (((LONG
)resource
) >> 8) & 0xFF;
120 l3
= (((LONG
)resource
) >> 16) & 0xFF;
121 l4
= (((LONG
)resource
) >> 24) & 0xFF;
123 hash
= (l1
+ l2
+ l3
+ l4
) % DRIVERDATALIST_HASHSIZE
;
128 static inline void AddDriverDataToList(struct gfx_driverdata
*dd
, struct GfxBase
* GfxBase
)
132 hash
= CalcDriverDataHash(dd
);
134 // ObtainSemaphore(&PrivGBase(GfxBase)->driverdatasem);
135 AddTail((struct List
*)&PrivGBase(GfxBase
)->driverdatalist
[hash
], (struct Node
*)&dd
->dd_Node
);
136 // ReleaseSemaphore(&PrivGBase(GfxBase)->driverdatasem);
140 static inline void RemoveDriverDataFromList(struct gfx_driverdata
*dd
, struct GfxBase
*GfxBase
)
142 // ObtainSemaphore(&PrivGBase(GfxBase)->driverdatasem);
143 Remove((struct Node
*)&dd
->dd_Node
);
144 // ReleaseSemaphore(&PrivGBase(GfxBase)->driverdatasem);
147 static inline BOOL
FindDriverData(struct gfx_driverdata
*dd
, struct RastPort
*rp
, struct GfxBase
*GfxBase
)
149 struct gfx_driverdata
*hn
= NULL
;
153 hash
= CalcDriverDataHash(dd
);
155 // ObtainSemaphore(&PrivGBase(GfxBase)->driverdatasem);
156 ForeachNode((struct List
*)&PrivGBase(GfxBase
)->driverdatalist
[hash
], hn
)
158 if ((hn
== dd
) && (hn
->dd_RastPort
== rp
))
164 // ReleaseSemaphore(&PrivGBase(GfxBase)->driverdatasem);
169 BOOL
ObtainDriverData(struct RastPort
*rp
, struct GfxBase
*GfxBase
)
171 struct gfx_driverdata
*dd
;
173 if (RP_BACKPOINTER(rp
) == rp
)
175 if (rp
->Flags
& RPF_SELF_CLEANUP
)
177 if (RP_DRIVERDATA(rp
)) return TRUE
;
182 /* We have detected a manually cloned rastport. Mark it as 'valid'
183 (backpointer to itself) but with NULL driverdata and non-self
185 RP_DRIVERDATA(rp
) = NULL
;
186 rp
->Flags
&= ~RPF_SELF_CLEANUP
;
187 RP_BACKPOINTER(rp
) = rp
;
190 ObtainSemaphore(&PrivGBase(GfxBase
)->driverdatasem
);
191 dd
= RP_DRIVERDATA(rp
);
194 if (!(rp
->Flags
& RPF_SELF_CLEANUP
) && FindDriverData(dd
, rp
, GfxBase
))
200 RP_DRIVERDATA(rp
) = NULL
;
207 dd
= AllocPooled(PrivGBase(GfxBase
)->driverdatapool
, sizeof(*dd
));
210 struct shared_driverdata
*sdd
;
211 struct TagItem gc_tags
[] = {{ TAG_DONE
}};
215 dd
->dd_GC
= HIDD_Gfx_NewGC(sdd
->gfxhidd
, gc_tags
);
218 dd
->dd_RastPort
= rp
;
219 dd
->dd_LockCount
= 1;
221 RP_DRIVERDATA(rp
) = dd
;
222 rp
->Flags
|= RPF_DRIVER_INITED
;
224 if (!(rp
->Flags
& RPF_SELF_CLEANUP
)) AddDriverDataToList(dd
, GfxBase
);
226 if (rp
->BitMap
) SetABPenDrMd(rp
, (UBYTE
)rp
->FgPen
, (UBYTE
)rp
->BgPen
, rp
->DrawMode
);
230 FreePooled(PrivGBase(GfxBase
)->driverdatapool
, dd
, sizeof(*dd
));
238 ReleaseSemaphore(&PrivGBase(GfxBase
)->driverdatasem
);
240 return dd
? TRUE
: FALSE
;
243 void ReleaseDriverData(struct RastPort
*rp
, struct GfxBase
*GfxBase
)
245 struct gfx_driverdata
*dd
= GetDriverData(rp
);
247 if (!(rp
->Flags
& RPF_SELF_CLEANUP
))
249 /* FIXME: stegerg 23 jan 2004: needs semprotection, too! */
250 /* CHECKME: stegerg 23 feb 2005: really?? */
256 // if (!dd->dd_LockCount) KillDriverData(rp, GfxBase);
258 // some garbage collection should later hunt for dd's with
259 // 0 lockcount and possibly non-usage for a certain amount
260 // of time and get rid of them.
264 void KillDriverData(struct RastPort
*rp
, struct GfxBase
*GfxBase
)
266 if (RP_BACKPOINTER(rp
) == rp
)
268 struct gfx_driverdata
*dd
= NULL
;
270 if (rp
->Flags
& RPF_SELF_CLEANUP
)
272 dd
= RP_DRIVERDATA(rp
);
276 ObtainSemaphore(&PrivGBase(GfxBase
)->driverdatasem
);
277 if (FindDriverData(RP_DRIVERDATA(rp
), rp
, GfxBase
))
279 dd
= RP_DRIVERDATA(rp
);
280 RemoveDriverDataFromList(dd
, GfxBase
);
282 ReleaseSemaphore(&PrivGBase(GfxBase
)->driverdatasem
);
287 struct shared_driverdata
*sdd
;
291 HIDD_Gfx_DisposeGC(sdd
->gfxhidd
, dd
->dd_GC
);
292 FreePooled(PrivGBase(GfxBase
)->driverdatapool
, dd
, sizeof(*dd
));
293 RP_DRIVERDATA(rp
) = NULL
;
302 struct gfx_driverdata
* obsolete_InitDriverData (struct RastPort
* rp
, struct GfxBase
* GfxBase
)
304 struct gfx_driverdata
* dd
;
305 EnterFunc(bug("InitDriverData(rp=%p)\n", rp
));
307 /* Does this rastport have a bitmap ? */
310 D(bug("Got bitmap\n"));
311 /* Displayable ? (== rastport of a screen) */
312 //if (IS_HIDD_BM(rp->BitMap))
314 D(bug("Has HIDD bitmap (displayable)\n"));
316 /* We can use this rastport. Allocate driverdata */
317 dd
= AllocMem (sizeof(struct gfx_driverdata
), MEMF_CLEAR
);
320 struct shared_driverdata
*sdd
;
321 struct TagItem gc_tags
[] = {
326 D(bug("Got driverdata\n"));
329 dd
->dd_GC
= HIDD_Gfx_NewGC(sdd
->gfxhidd
, gc_tags
);
333 D(bug("Got GC HIDD object\n"));
334 dd
->dd_RastPort
= rp
;
335 SetDriverData(rp
, dd
);
336 rp
->Flags
|= RPF_DRIVER_INITED
;
338 ReturnPtr("InitDriverData", struct gfx_driverdata
*, dd
);
341 FreeMem(dd
, sizeof (struct gfx_driverdata
));
347 ReturnPtr("InitDriverData", struct gfx_driverdata
*, NULL
);
350 void obsolete_DeinitDriverData (struct RastPort
* rp
, struct GfxBase
* GfxBase
)
352 struct gfx_driverdata
* dd
;
353 struct shared_driverdata
*sdd
;
355 EnterFunc(bug("DeInitDriverData(rp=%p)\n", rp
));
359 dd
= RP_DRIVERDATA(rp
);;
360 RP_DRIVERDATA(rp
) = 0;
362 HIDD_Gfx_DisposeGC(sdd
->gfxhidd
, dd
->dd_GC
);
364 FreeMem (dd
, sizeof(struct gfx_driverdata
));
365 rp
->Flags
&= ~RPF_DRIVER_INITED
;
367 ReturnVoid("DeinitDriverData");
370 BOOL
obsolete_CorrectDriverData (struct RastPort
* rp
, struct GfxBase
* GfxBase
)
373 struct gfx_driverdata
* dd
, * old
;
381 old
= GetDriverData(rp
);
384 old
= obsolete_InitDriverData(rp
, GfxBase
);
386 /* stegerg: ???? would have returned TRUE even if old == NULL
390 if (!old
) retval
= FALSE
;
392 else if (rp
!= old
->dd_RastPort
)
394 /* stegerg: cloned rastport?
395 ** Make sure to clear driverdata pointer and flag
396 ** in case InitDriverData fail
398 RP_DRIVERDATA(rp
) = 0;
399 rp
->Flags
&= ~RPF_DRIVER_INITED
;
401 dd
= obsolete_InitDriverData(rp
, GfxBase
);
403 /* stegerg: ???? would have returned TRUE even if dd = NULL
408 if (!dd
) retval
= FALSE
;
418 int driver_init(struct GfxBase
* GfxBase
)
421 EnterFunc(bug("driver_init()\n"));
423 /* Initialize the semaphore used for the chunky buffer */
424 InitSemaphore(&(PrivGBase(GfxBase
)->pixbuf_sema
));
425 InitSemaphore(&(PrivGBase(GfxBase
)->blit_sema
));
427 /* Init the needed attrbases */
429 __IHidd_BitMap
= OOP_ObtainAttrBase(IID_Hidd_BitMap
);
430 __IHidd_GC
= OOP_ObtainAttrBase(IID_Hidd_GC
);
431 __IHidd_Sync
= OOP_ObtainAttrBase(IID_Hidd_Sync
);
432 __IHidd_PixFmt
= OOP_ObtainAttrBase(IID_Hidd_PixFmt
);
433 __IHidd_PlanarBM
= OOP_ObtainAttrBase(IID_Hidd_PlanarBM
);
434 __IHidd_Gfx
= OOP_ObtainAttrBase(IID_Hidd_Gfx
);
435 __IHidd_FakeGfxHidd
= OOP_ObtainAttrBase(IID_Hidd_FakeGfxHidd
);
438 if (__IHidd_BitMap
&&
446 PrivGBase(GfxBase
)->pixel_buf
=AllocMem(PIXELBUF_SIZE
,MEMF_ANY
);
447 if (PrivGBase(GfxBase
)->pixel_buf
) {
449 ReturnInt("driver_init", int, TRUE
);
451 FreeMem(PrivGBase(GfxBase
)->pixel_buf
, PIXELBUF_SIZE
);
456 ReturnInt("driver_init", int, FALSE
);
459 int driver_open (struct GfxBase
* GfxBase
)
464 void driver_close (struct GfxBase
* GfxBase
)
469 void driver_expunge (struct GfxBase
* GfxBase
)
472 /* Try to free some other stuff */
473 cleanup_cursor(GfxBase
);
475 if (SDD(GfxBase
)->framebuffer
)
476 OOP_DisposeObject(SDD(GfxBase
)->framebuffer
);
479 if (SDD(GfxBase
)->activescreen_inited
)
480 cleanup_activescreen_stuff(GfxBase
);
482 if (SDD(GfxBase
)->dispinfo_db
)
483 destroy_dispinfo_db(SDD(GfxBase
)->dispinfo_db
, GfxBase
);
485 if ( SDD(GfxBase
)->planarbm_cache
)
486 delete_object_cache( SDD(GfxBase
)->planarbm_cache
, GfxBase
);
488 if ( SDD(GfxBase
)->gc_cache
)
489 delete_object_cache( SDD(GfxBase
)->gc_cache
, GfxBase
);
491 if ( SDD(GfxBase
)->fakegfx_inited
)
492 cleanup_fakegfxhidd( &SDD(GfxBase
)->fakegfx_staticdata
, GfxBase
);
494 if ( SDD(GfxBase
)->gfxhidd_orig
)
495 OOP_DisposeObject( SDD(GfxBase
)->gfxhidd_orig
);
500 /* Called after DOS is up & running */
501 static OOP_Object
*create_framebuffer(struct GfxBase
*GfxBase
)
503 struct TagItem fbtags
[] = {
504 { aHidd_BitMap_FrameBuffer
, TRUE
},
505 { aHidd_BitMap_ModeID
, 0 },
509 HIDDT_ModeID hiddmode
;
510 OOP_Object
*fb
= NULL
;
512 /* Get the highest available resolution at the best possible depth */
513 hiddmode
= get_best_resolution_and_depth(GfxBase
);
514 if (vHidd_ModeID_Invalid
== hiddmode
) {
515 D(bug("!!! create_framebuffer(): COULD NOT GET HIDD MODEID !!!\n"));
517 /* Create the framebuffer object */
518 fbtags
[1].ti_Data
= hiddmode
;
519 fb
= HIDD_Gfx_NewBitMap(SDD(GfxBase
)->gfxhidd
, fbtags
);
524 const UBYTE def_pointer_shape
[] =
526 01,03,00,00,00,00,00,00,00,00,00,
527 02,01,03,03,00,00,00,00,00,00,00,
528 00,02,01,01,03,03,00,00,00,00,00,
529 00,02,01,01,01,01,03,03,00,00,00,
530 00,00,02,01,01,01,01,01,03,03,00,
531 00,00,02,01,01,01,01,01,01,01,00,
532 00,00,00,02,01,01,01,03,00,00,00,
533 00,00,00,02,01,01,03,01,03,00,00,
534 00,00,00,00,02,01,00,02,01,03,00,
535 00,00,00,00,02,01,00,00,02,01,03,
536 00,00,00,00,00,00,00,00,00,01,01
539 #define DEF_POINTER_WIDTH 11
540 #define DEF_POINTER_HEIGHT 11
541 #define DEF_POINTER_DEPTH 4
544 static BOOL
init_cursor(struct GfxBase
*GfxBase
)
546 /* Create the pointer bitmap */
547 struct TagItem pbmtags
[] = {
548 { aHidd_BitMap_Width
, DEF_POINTER_WIDTH
},
549 { aHidd_BitMap_Height
, DEF_POINTER_HEIGHT
},
550 { aHidd_BitMap_StdPixFmt
, vHidd_StdPixFmt_LUT8
},
553 SDD(GfxBase
)->pointerbm
= HIDD_Gfx_NewBitMap(SDD(GfxBase
)->gfxhidd
, pbmtags
);
554 if (NULL
!= SDD(GfxBase
)->pointerbm
) {
557 gc
= obtain_cache_object(SDD(GfxBase
)->gc_cache
, GfxBase
);
559 /* Copy the default pointer image into the created pointer bitmap */
561 struct TagItem gc_tags
[] = {
562 { aHidd_GC_DrawMode
, vHidd_GC_DrawMode_Copy
},
566 HIDDT_Color col
[DEF_POINTER_DEPTH
] = {0};
569 col
[0].green
= 0x0000;
570 col
[0].blue
= 0x0000;
571 col
[0].alpha
= 0x0000;
573 col
[1].green
= 0x4040;
574 col
[1].blue
= 0x4040;
575 col
[1].alpha
= 0x0000;
577 col
[2].green
= 0x0000;
578 col
[2].blue
= 0x0000;
579 col
[2].alpha
= 0x0000;
581 col
[3].green
= 0xE0E0;
582 col
[3].blue
= 0xC0C0;
583 col
[3].alpha
= 0x0000;
585 HIDD_BM_SetColors(SDD(GfxBase
)->pointerbm
, col
, 0, DEF_POINTER_DEPTH
);
587 OOP_SetAttrs(gc
, gc_tags
);
589 /* PutImageLUT not yet implemented in gfx baseclass */
590 HIDD_BM_PutImageLUT(SDD(GfxBase
)->pointerbm
, gc
591 , (UBYTE
*)def_pointer_shape
594 , DEF_POINTER_WIDTH
, DEF_POINTER_HEIGHT
598 HIDD_BM_PutImage(SDD(GfxBase
)->pointerbm
, gc
599 , (UBYTE
*)def_pointer_shape
602 , DEF_POINTER_WIDTH
, DEF_POINTER_HEIGHT
603 , vHidd_StdPixFmt_LUT8
607 release_cache_object(SDD(GfxBase
)->gc_cache
, gc
, GfxBase
);
609 if (HIDD_Gfx_SetCursorShape(SDD(GfxBase
)->gfxhidd
, SDD(GfxBase
)->pointerbm
)) {
610 D(bug("CURSOR SHAPE SET\n"));
611 /* Make it visible */
612 HIDD_Gfx_SetCursorVisible(SDD(GfxBase
)->gfxhidd
, TRUE
);
619 cleanup_cursor(GfxBase
);
624 static VOID
cleanup_cursor(struct GfxBase
*GfxBase
)
626 if (NULL
!= SDD(GfxBase
)->pointerbm
) {
627 OOP_DisposeObject(SDD(GfxBase
)->pointerbm
);
628 SDD(GfxBase
)->pointerbm
= NULL
;
632 BOOL
driver_LateGfxInit (APTR data
, struct GfxBase
*GfxBase
)
635 /* Supplied data is really the librarybase of a HIDD */
636 STRPTR gfxhiddname
= (STRPTR
)data
;
637 struct TagItem tags
[] = {
640 EnterFunc(bug("driver_LateGfxInit(gfxhiddname=%s)\n", gfxhiddname
));
642 /* Create a new GfxHidd object */
644 SDD(GfxBase
)->gfxhidd
= SDD(GfxBase
)->gfxhidd_orig
= OOP_NewObject(NULL
, gfxhiddname
, tags
);
645 D(bug("driver_LateGfxInit: gfxhidd=%p\n", SDD(GfxBase
)->gfxhidd
));
647 if (NULL
!= SDD(GfxBase
)->gfxhidd
) {
651 /* Get method id here, to avoid any possible semaphore involment when calling the method */
652 SDD(GfxBase
)->hiddGfxShowImminentReset_MethodID
= OOP_GetMethodID(IID_Hidd_Gfx
, moHidd_Gfx_ShowImminentReset
);
654 OOP_GetAttr(SDD(GfxBase
)->gfxhidd
, aHidd_Gfx_SupportsHWCursor
, &hwcursor
);
655 SDD(GfxBase
)->has_hw_cursor
= (BOOL
)hwcursor
;
658 D(bug("There's no hardware cursor\n"));
660 fgh
= init_fakegfxhidd(SDD(GfxBase
)->gfxhidd
661 , &SDD(GfxBase
)->fakegfx_staticdata
665 SDD(GfxBase
)->gfxhidd
= fgh
;
666 SDD(GfxBase
)->fakegfx_inited
= TRUE
;
673 struct TagItem gc_create_tags
[] = { { TAG_DONE
, 0UL } };
675 SDD(GfxBase
)->gc_cache
= create_object_cache(NULL
, IID_Hidd_GC
, gc_create_tags
, GfxBase
);
676 if (NULL
!= SDD(GfxBase
)->gc_cache
) {
678 struct TagItem bm_create_tags
[] = {
679 #warning Maybe make this class private and create the object through the graphicshidd
680 { aHidd_BitMap_GfxHidd
, (IPTR
)SDD(GfxBase
)->gfxhidd_orig
},
681 { aHidd_BitMap_Displayable
, FALSE
},
682 { aHidd_PlanarBM_AllocPlanes
, FALSE
},
686 D(bug("Cache created\n"));
687 SDD(GfxBase
)->planarbm_cache
= create_object_cache(NULL
, CLID_Hidd_PlanarBM
, bm_create_tags
, GfxBase
);
689 if (NULL
!= SDD(GfxBase
)->planarbm_cache
) {
691 /* Move the modes into the displayinfo DB */
692 SDD(GfxBase
)->dispinfo_db
= build_dispinfo_db(GfxBase
);
693 if (NULL
!= SDD(GfxBase
)->dispinfo_db
) {
695 SDD(GfxBase
)->framebuffer
= create_framebuffer(GfxBase
);
696 if (NULL
!= SDD(GfxBase
)->framebuffer
) {
697 D(bug("FRAMEBUFFER OK: %p\n", SDD(GfxBase
)->framebuffer
));
698 if (init_cursor(GfxBase
)) {
700 D(bug("MOUSE INITED\n"));
701 ReturnBool("driver_LateGfxInit", TRUE
);
703 OOP_DisposeObject(SDD(GfxBase
)->framebuffer
);
704 } /* if (framebuffer inited) */
705 destroy_dispinfo_db(SDD(GfxBase
)->dispinfo_db
, GfxBase
);
706 SDD(GfxBase
)->dispinfo_db
= NULL
;
707 } /* if (displayinfo db inited) */
708 delete_object_cache(SDD(GfxBase
)->planarbm_cache
, GfxBase
);
709 SDD(GfxBase
)->planarbm_cache
= NULL
;
710 } /* if (planarbm cache created) */
711 delete_object_cache(SDD(GfxBase
)->gc_cache
, GfxBase
);
712 SDD(GfxBase
)->gc_cache
= NULL
;
713 } /* if (gc object cache ok) */
715 } /* if (fake gfx stuff ok) */
717 if (SDD(GfxBase
)->fakegfx_inited
) {
718 cleanup_fakegfxhidd(&SDD(GfxBase
)->fakegfx_staticdata
, GfxBase
);
719 SDD(GfxBase
)->fakegfx_inited
= FALSE
;
721 OOP_DisposeObject(SDD(GfxBase
)->gfxhidd_orig
);
722 SDD(GfxBase
)->gfxhidd_orig
= NULL
;
726 ReturnBool("driver_LateGfxInit", FALSE
);
733 static ULONG
getbitmappixel(struct BitMap
*bm
745 idx
= COORD_TO_BYTEIDX(x
, y
, bm
->BytesPerRow
);
746 mask
= XCOORD_TO_MASK( x
);
748 for (i
= depth
- 1; depth
; i
-- , depth
-- )
750 pen
<<= 1; /* stegerg: moved to here, was inside if!? */
752 if ((1L << i
) & plane_mask
)
754 UBYTE
*plane
= bm
->Planes
[i
];
756 if (plane
== (PLANEPTR
)-1)
760 else if (plane
!= NULL
)
762 if ((plane
[idx
] & mask
) != 0)
774 #define dumprect(rect) \
775 kprintf(#rect " : (%d,%d) - (%d,%d)\n",(rect)->MinX,(rect)->MinY,(rect)->MaxX,(rect)->MaxY)
778 struct bgf_render_data
{
783 static ULONG
bgf_render(APTR bgfr_data
784 , LONG srcx
, LONG srcy
785 , OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
786 , LONG x1
, LONG y1
, LONG x2
, LONG y2
787 , struct GfxBase
*GfxBase
)
789 struct bgf_render_data
*bgfrd
;
793 height
= y2
- y1
+ 1;
795 ASSERT(width
> 0 && height
> 0);
797 bgfrd
= (struct bgf_render_data
*)bgfr_data
;
799 HIDD_BM_BlitColorExpansion( dstbm_obj
802 , srcx
+ bgfrd
->fbm_xsrc
, srcy
/* stegerg: instead of srcy there was a 0 */
807 return width
* height
;
811 void blit_glyph_fast(struct RastPort
*rp
, OOP_Object
*fontbm
, WORD xsrc
812 , WORD destx
, WORD desty
, UWORD width
, UWORD height
813 , struct GfxBase
* GfxBase
)
817 struct bgf_render_data bgfrd
;
819 EnterFunc(bug("blit_glyph_fast(%d, %d, %d, %d, %d)\n"
820 , xsrc
, destx
, desty
, width
, height
));
823 ASSERT(width
> 0 && height
> 0);
825 bgfrd
.fbm_xsrc
= xsrc
;
830 rr
.MaxX
= destx
+ width
- 1;
831 rr
.MaxY
= desty
+ height
- 1;
833 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
834 ReturnVoid("blit_glyph_fast");
836 do_render_func(rp
, NULL
, &rr
, bgf_render
, &bgfrd
, FALSE
, GfxBase
);
838 RELEASE_DRIVERDATA(rp
, GfxBase
);
840 ReturnVoid("blit_glyph_fast");
845 #define NUMCHARS(tf) ((tf->tf_HiChar - tf->tf_LoChar) + 2)
846 #define CTF(x) ((struct ColorTextFont *)x)
848 void driver_Text (struct RastPort
* rp
, CONST_STRPTR string
, LONG len
,
849 struct GfxBase
* GfxBase
)
852 #warning Does not handle color textfonts
856 OOP_Object
*fontbm
= NULL
;
858 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
861 if ((rp
->DrawMode
& ~INVERSVID
) == JAM2
)
863 struct TextExtent te
;
864 ULONG old_drmd
= GetDrMd(rp
);
866 /* This is actually needed, because below only the
867 part of the glyph which contains data is rendered:
874 '.' at left side can be there because of kerning.
875 '.' at the right side can be there because of
876 CharSpace being bigger than glyph bitmap data
880 TextExtent(rp
, string
, len
, &te
);
881 SetDrMd(rp
, old_drmd
^ INVERSVID
);
882 RectFill(rp
, rp
->cp_x
+ te
.te_Extent
.MinX
,
883 rp
->cp_y
+ te
.te_Extent
.MinY
,
884 rp
->cp_x
+ te
.te_Extent
.MaxX
,
885 rp
->cp_y
+ te
.te_Extent
.MaxY
);
886 SetDrMd(rp
, old_drmd
);
889 /* does this rastport have a layer. If yes, lock the layer it.*/
890 if (NULL
!= rp
->Layer
)
891 LockLayerRom(rp
->Layer
);
895 if (ExtendFont(tf
, NULL
))
897 fontbm
= TFE_INTERN(tf
->tf_Extension
)->hash
->font_bitmap
;
900 /* Check if font has character data as a HIDD bitmap */
904 D(bug("FONT HAS NO HIDD BITMAP ! Won't render text\n"));
905 RELEASE_DRIVERDATA(rp
, GfxBase
);
910 /* Render along font's baseline */
911 render_y
= rp
->cp_y
- tf
->tf_Baseline
;
912 current_x
= rp
->cp_x
;
919 if (*string
< tf
->tf_LoChar
|| *string
> tf
->tf_HiChar
)
921 /* A character which there is no glyph for. We just
922 draw the last glyph in the font
924 idx
= NUMCHARS(tf
) - 1;
928 idx
= *string
- tf
->tf_LoChar
;
931 charloc
= ((ULONG
*)tf
->tf_CharLoc
)[idx
];
935 current_x
+= ((WORD
*)tf
->tf_CharKern
)[idx
];
938 if ((tf
->tf_Style
& FSF_COLORFONT
) &&
939 !(CTF(tf
)->ctf_Flags
& CT_ANTIALIAS
))
941 #warning Handle color fonts
946 glyphXOffset
= charloc
>> 16,
947 glyphWidth
= charloc
& 0xFFFF;
949 ASSERT(tf
->tf_YSize
> 0);
951 /* blit the glypth if it has data in the bitmap */
954 blit_glyph_fast(rp
, fontbm
, glyphXOffset
, current_x
, render_y
,
955 glyphWidth
, tf
->tf_YSize
, GfxBase
);
959 if (tf
->tf_CharSpace
)
960 current_x
+= ((WORD
*)tf
->tf_CharSpace
)[idx
];
962 current_x
+= tf
->tf_XSize
; /* Add glyph width */
964 current_x
+= rp
->TxSpacing
;
967 } /* for (each character to render) */
969 Move(rp
, current_x
, rp
->cp_y
);
971 if (NULL
!= rp
->Layer
)
972 UnlockLayerRom(rp
->Layer
);
974 RELEASE_DRIVERDATA(rp
, GfxBase
);
980 /***********************************************/
981 /* CYBERGFX CALLS ***/
984 struct wpa_render_data
987 HIDDT_StdPixFmt pixfmt
;
992 static ULONG
wpa_render(APTR wpar_data
993 , LONG srcx
, LONG srcy
994 , OOP_Object
*dstbm_obj
996 , LONG x1
, LONG y1
, LONG x2
, LONG y2
997 , struct GfxBase
*GfxBase
)
999 struct wpa_render_data
*wpard
;
1000 ULONG width
, height
;
1003 width
= x2
- x1
+ 1;
1004 height
= y2
- y1
+ 1;
1006 wpard
= (struct wpa_render_data
*)wpar_data
;
1008 array
= wpard
->array
+ wpard
->modulo
* srcy
+ wpard
->bppix
* srcx
;
1010 HIDD_BM_PutImage(dstbm_obj
1018 return width
* height
;
1021 struct wpaa_render_data
1027 static ULONG
wpaa_render(APTR wpaar_data
1028 , LONG srcx
, LONG srcy
1029 , OOP_Object
*dstbm_obj
1030 , OOP_Object
*dst_gc
1031 , LONG x1
, LONG y1
, LONG x2
, LONG y2
1032 , struct GfxBase
*GfxBase
)
1034 struct wpaa_render_data
*wpaard
;
1035 ULONG width
, height
;
1038 width
= x2
- x1
+ 1;
1039 height
= y2
- y1
+ 1;
1041 wpaard
= (struct wpaa_render_data
*)wpaar_data
;
1043 array
= wpaard
->array
+ wpaard
->modulo
* srcy
+ 4 * srcx
;
1045 HIDD_BM_PutAlphaImage(dstbm_obj
1052 return width
* height
;
1055 struct bta_render_data
1062 static ULONG
bta_render(APTR bta_data
1063 , LONG srcx
, LONG srcy
1064 , OOP_Object
*dstbm_obj
1065 , OOP_Object
*dst_gc
1066 , LONG x1
, LONG y1
, LONG x2
, LONG y2
1067 , struct GfxBase
*GfxBase
)
1069 struct bta_render_data
*btard
;
1070 ULONG width
, height
;
1073 width
= x2
- x1
+ 1;
1074 height
= y2
- y1
+ 1;
1076 btard
= (struct bta_render_data
*)bta_data
;
1078 array
= btard
->array
+ btard
->modulo
* srcy
+ srcx
;
1080 HIDD_BM_PutAlphaTemplate(dstbm_obj
1085 , btard
->invertalpha
1088 return width
* height
;
1091 struct rpa_render_data
{
1093 HIDDT_StdPixFmt pixfmt
;
1098 static ULONG
rpa_render(APTR rpar_data
1099 , LONG srcx
, LONG srcy
1100 , OOP_Object
*dstbm_obj
1101 , OOP_Object
*dst_gc
1102 , LONG x1
, LONG y1
, LONG x2
, LONG y2
1103 , struct GfxBase
*GfxBase
)
1105 struct rpa_render_data
*rpard
;
1106 ULONG width
, height
;
1109 width
= x2
- x1
+ 1;
1110 height
= y2
- y1
+ 1;
1112 rpard
= (struct rpa_render_data
*)rpar_data
;
1114 array
= rpard
->array
+ rpard
->modulo
* srcy
+ rpard
->bppix
* srcx
;
1116 HIDD_BM_GetImage(dstbm_obj
1124 return width
* height
;
1127 static LONG
pix_read(APTR pr_data
1128 , OOP_Object
*bm
, OOP_Object
*gc
1130 , struct GfxBase
*GfxBase
)
1132 struct rgbpix_render_data
*prd
;
1134 prd
= (struct rgbpix_render_data
*)pr_data
;
1136 prd
->pixel
= HIDD_BM_GetPixel(bm
, x
, y
);
1143 struct extcol_render_data
{
1144 struct render_special_info rsi
;
1145 struct BitMap
*destbm
;
1150 static VOID
buf_to_extcol(struct extcol_render_data
*ecrd
1151 , LONG srcx
, LONG srcy
1152 , LONG dstx
, LONG dsty
1153 , ULONG width
, ULONG height
1154 , HIDDT_Pixel
*pixbuf
1155 , OOP_Object
*bm_obj
1156 , HIDDT_Pixel
*pixtab
)
1161 for (y
= 0; y
< height
; y
++) {
1164 for (x
= 0; x
< width
; x
++) {
1165 if (*pixbuf
++ == ecrd
->pixel
) {
1169 /* Set the according bit in the bitmap */
1170 for (i
= 0; i
< bm
->Depth
; i
++) {
1171 plane
= bm
->Planes
[i
];
1172 if (NULL
!= plane
) {
1175 plane
+= COORD_TO_BYTEIDX(x
+ dstx
, y
+ dsty
, bm
->BytesPerRow
);
1176 mask
= XCOORD_TO_MASK(x
+ dstx
);
1181 } /* if (plane allocated) */
1183 } /* if (color match) */
1192 static ULONG
extcol_render(APTR funcdata
1193 , LONG dstx
, LONG dsty
1194 , OOP_Object
*dstbm_obj
1195 , OOP_Object
*dst_gc
1196 , LONG x1
, LONG y1
, LONG x2
, LONG y2
1197 , struct GfxBase
*GfxBase
)
1199 /* Get the info from the hidd */
1200 struct extcol_render_data
*ecrd
;
1202 ecrd
= (struct extcol_render_data
*)funcdata
;
1204 hidd2buf_fast(ecrd
->rsi
.curbm
1214 return (x2
- x1
+ 1) * (y2
- y1
+ 1);
1230 struct dm_render_data
{
1231 struct dm_message msg
;
1234 struct RastPort
*rp
;
1240 static ULONG
dm_render(APTR dmr_data
1241 , LONG srcx
, LONG srcy
1242 , OOP_Object
*dstbm_obj
1243 , OOP_Object
*dst_gc
1244 , LONG x1
, LONG y1
, LONG x2
, LONG y2
1245 , struct GfxBase
*GfxBase
)
1247 struct dm_render_data
*dmrd
;
1249 struct dm_message
*msg
;
1251 ULONG width
, height
, fb_width
, fb_height
;
1252 ULONG banksize
, memsize
;
1254 dmrd
= (struct dm_render_data
*)dmr_data
;
1255 width
= x2
- x1
+ 1;
1256 height
= y2
- y1
+ 1;;
1262 #warning "Not sure about this one . Set it to 0 since we adjust msg->memptr to x1/y1 lower down"
1263 msg
->offsetx
= 0; // x1;
1264 msg
->offsety
= 0; // y1;
1267 msg
->ysize
= height
;
1269 /* Get the baseadress from where to render */
1270 if (HIDD_BM_ObtainDirectAccess(dstbm_obj
1272 , &fb_height
, &fb_width
1273 , &banksize
, &memsize
)) {
1275 OOP_GetAttr(dmrd
->pf
, aHidd_PixFmt_BytesPerPixel
, &bytesperpixel
);
1276 msg
->bytesperpix
= (UWORD
)bytesperpixel
;
1278 /* Colormodel allready set */
1280 /* Compute the adress for the start pixel */
1281 #warning "We should maybe use something else than the BytesPerLine method since we may have alignment"
1282 msg
->bytesperrow
= HIDD_BM_BytesPerLine(dstbm_obj
, dmrd
->stdpf
, width
);
1286 msg
->memptr
= addr
+ (msg
->bytesperrow
* y1
) + (bytesperpixel
* x1
);
1289 HIDD_BM_ReleaseDirectAccess(dstbm_obj
);
1291 CallHookPkt(dmrd
->hook
, dmrd
->rp
, msg
);
1294 /* We are unable to gain direct access to the framebuffer,
1295 so we have to emulate it
1298 ULONG tocopy_h
, max_tocopy_h
;
1301 lines_todo
= height
;
1303 /* The HIDD bm does not have a base adress so we have to render into
1304 it using a temporary buffer
1306 OOP_GetAttr(dmrd
->pf
, aHidd_PixFmt_BytesPerPixel
, &bytesperpixel
);
1307 //bytesperrow = HIDD_BM_BytesPerLine(dstbm_obj, dmrd->stdpf, width);
1308 bytesperrow
= width
* bytesperpixel
;
1311 kprintf("width %d bytesperrow %d bytesperpixel %d\n", width
, bytesperrow
, bytesperpixel
);
1312 kprintf(" colormodel %d\n", msg
->colormodel
);
1314 if (PIXELBUF_SIZE
< bytesperrow
) {
1315 D(bug("!!! NOT ENOUGH SPACE IN TEMP BUFFER FOR A SINGLE LINE IN DoCDrawMethodTagList() !!!\n"));
1319 /* Calculate number of lines we might copy */
1320 max_tocopy_h
= PIXELBUF_SIZE
/ bytesperrow
;
1326 /* Get the maximum number of lines */
1327 while (lines_todo
!= 0) {
1329 struct TagItem gc_tags
[] = {
1330 { aHidd_GC_DrawMode
, vHidd_GC_DrawMode_Copy
},
1336 tocopy_h
= MIN(lines_todo
, max_tocopy_h
);
1337 msg
->memptr
= PrivGBase(GfxBase
)->pixel_buf
;
1338 msg
->bytesperrow
= bytesperrow
;
1340 msg
->bytesperpix
= (UWORD
)bytesperpixel
;
1343 HIDD_BM_GetImage(dstbm_obj
1344 , (UBYTE
*)PrivGBase(GfxBase
)->pixel_buf
1346 , x1
, y1
+ height
- lines_todo
, width
, lines_todo
1350 /* Use the hook to set some pixels */
1351 CallHookPkt(dmrd
->hook
, dmrd
->rp
, msg
);
1353 OOP_GetAttr(dmrd
->gc
, aHidd_GC_DrawMode
, &old_drmd
);
1354 OOP_SetAttrs(dmrd
->gc
, gc_tags
);
1355 HIDD_BM_PutImage(dstbm_obj
, dmrd
->gc
1356 , (UBYTE
*)PrivGBase(GfxBase
)->pixel_buf
1358 , x1
, y1
+ height
- lines_todo
, width
, lines_todo
1361 gc_tags
[0].ti_Data
= (IPTR
)old_drmd
;
1362 OOP_SetAttrs(dmrd
->gc
, gc_tags
);
1366 lines_todo
-= tocopy_h
;
1371 return width
* height
;
1376 LONG
driver_WriteLUTPixelArray(APTR srcrect
,
1377 UWORD srcx
, UWORD srcy
,
1378 UWORD srcmod
, struct RastPort
*rp
, APTR ctable
,
1379 UWORD destx
, UWORD desty
,
1380 UWORD sizex
, UWORD sizey
,
1382 struct GfxBase
*GfxBase
)
1386 HIDDT_PixelLUT pixlut
;
1387 HIDDT_Pixel pixtab
[256];
1392 LONG pixwritten
= 0;
1395 /* This is cybergraphx. We only work wih HIDD bitmaps */
1396 if (!IS_HIDD_BM(rp
->BitMap
)) {
1397 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in WriteLUTPixelArray()!!!\n"));
1401 pixlut
.entries
= 256;
1402 pixlut
.pixels
= pixtab
;
1404 depth
= GetBitMapAttr(rp
->BitMap
, BMA_DEPTH
);
1406 /* This call does only support bitmaps with depth > 8. Use WritePixelArray8
1411 D(bug("!!! TRYING TO USE WriteLUTPixelArray() ON BITMAP WITH DEPTH < 8\n"));
1415 /* Curently only one format is supported */
1416 if (CTABFMT_XRGB8
!= ctabformat
) {
1417 D(bug("!!! WriteLUTPixelArray() CALLED WITH UNSUPPORTED CTAB FORMAT %d\n"
1423 /* Convert the coltab into native pixels */
1424 for (i
= 0; i
< 256; i
++) {
1425 register ULONG rgb
= ((ULONG
*)ctable
)[i
];
1426 col
.red
= (HIDDT_ColComp
)((rgb
& 0x00FF0000) >> 8);
1427 col
.green
= (HIDDT_ColComp
)(rgb
& 0x0000FF00);
1428 col
.blue
= (HIDDT_ColComp
)((rgb
& 0x000000FF) << 8);
1430 pixtab
[i
] = HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
1433 buf
= (UBYTE
*)srcrect
;
1435 buf
+= CHUNKY8_COORD_TO_BYTEIDX(srcx
, srcy
, srcmod
);
1437 pixwritten
= write_pixels_8(rp
1441 , destx
+ sizex
- 1, desty
+ sizey
- 1
1447 /* Now blit the colors onto the screen */
1453 LONG
driver_WritePixelArray(APTR src
, UWORD srcx
, UWORD srcy
1454 , UWORD srcmod
, struct RastPort
*rp
, UWORD destx
, UWORD desty
1455 , UWORD width
, UWORD height
, UBYTE srcformat
, struct GfxBase
*GfxBase
)
1459 HIDDT_StdPixFmt srcfmt_hidd
= 0, morphfmt_hidd
= 0;
1463 LONG pixwritten
= 0;
1465 struct wpa_render_data wpard
;
1466 struct Rectangle rr
;
1468 if (RECTFMT_GREY8
== srcformat
)
1470 static ULONG greytab
[256];
1472 /* Ignore possible race conditions during
1473 initialization. Have no bad effect. Just
1474 double initializations. */
1476 /* FIXME/KILLME: evil static array which goes into BSS section
1477 which x86 native AROS regards as evil! */
1479 if (greytab
[255] == 0)
1483 for(i
= 0; i
< 256; i
++)
1485 greytab
[i
] = i
* 0x010101;
1489 return driver_WriteLUTPixelArray(src
, srcx
, srcy
, srcmod
,
1490 rp
, greytab
, destx
, desty
,
1491 width
, height
, CTABFMT_XRGB8
,
1495 /* This is cybergraphx. We only work wih HIDD bitmaps */
1496 if (!IS_HIDD_BM(rp
->BitMap
))
1498 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in WritePixelArray() !!!\n"));
1502 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
1505 if (RECTFMT_LUT8
== srcformat
)
1508 HIDDT_PixelLUT pixlut
= { 256, HIDD_BM_PIXTAB(rp
->BitMap
) };
1509 UBYTE
* array
= (UBYTE
*)src
;
1511 if (rp
->BitMap
->Flags
& BMF_SPECIALFMT
)
1513 RELEASE_DRIVERDATA(rp
, GfxBase
);
1514 D(bug("!!! No CLUT in driver_WritePixelArray\n"));
1518 array
+= CHUNKY8_COORD_TO_BYTEIDX(srcx
, srcy
, srcmod
);
1520 pixwritten
= write_pixels_8(rp
1523 , destx
+ width
- 1, desty
+ height
- 1
1527 RELEASE_DRIVERDATA(rp
, GfxBase
);
1534 case RECTFMT_RGB15
: srcfmt_hidd
= vHidd_StdPixFmt_RGB15
; break;
1535 case RECTFMT_BGR15
: srcfmt_hidd
= vHidd_StdPixFmt_BGR15
; break;
1536 case RECTFMT_RGB15PC
: srcfmt_hidd
= vHidd_StdPixFmt_RGB15_LE
; break;
1537 case RECTFMT_BGR15PC
: srcfmt_hidd
= vHidd_StdPixFmt_BGR15_LE
; break;
1538 case RECTFMT_RGB16
: srcfmt_hidd
= vHidd_StdPixFmt_RGB16
; break;
1539 case RECTFMT_BGR16
: srcfmt_hidd
= vHidd_StdPixFmt_BGR16
; break;
1540 case RECTFMT_RGB16PC
: srcfmt_hidd
= vHidd_StdPixFmt_RGB16_LE
; break;
1541 case RECTFMT_BGR16PC
: srcfmt_hidd
= vHidd_StdPixFmt_BGR16_LE
; break;
1542 case RECTFMT_RGB24
: srcfmt_hidd
= vHidd_StdPixFmt_RGB24
; break;
1543 case RECTFMT_BGR24
: srcfmt_hidd
= vHidd_StdPixFmt_BGR24
; break;
1544 case RECTFMT_ARGB32
: srcfmt_hidd
= vHidd_StdPixFmt_ARGB32
; morphfmt_hidd
= vHidd_StdPixFmt_0RGB32
; break;
1545 case RECTFMT_BGRA32
: srcfmt_hidd
= vHidd_StdPixFmt_BGRA32
; morphfmt_hidd
= vHidd_StdPixFmt_BGR032
; break;
1546 case RECTFMT_RGBA32
: srcfmt_hidd
= vHidd_StdPixFmt_RGBA32
; morphfmt_hidd
= vHidd_StdPixFmt_RGB032
; break;
1547 case RECTFMT_ABGR32
: srcfmt_hidd
= vHidd_StdPixFmt_ABGR32
; morphfmt_hidd
= vHidd_StdPixFmt_0BGR32
; break;
1548 case RECTFMT_RAW
: srcfmt_hidd
= vHidd_StdPixFmt_Native
; break;
1551 /* Compute the start of the array */
1553 #warning Get rid of the below code ?
1554 /* This can be done by passing the srcx and srcy parameters on to
1555 the HIDD bitmap and let it take care of it itself.
1556 This means that HIDD_BM_PutImage() gets a lot of parameters,
1557 which may not be necessary in real life.
1559 Compromise: convert from *CyberGfx* pixfmt to bppix using a table lookup.
1562 if ((srcfmt_hidd
== vHidd_StdPixFmt_Native
) || (morphfmt_hidd
!= 0))
1564 OOP_GetAttr(HIDD_BM_OBJ(rp
->BitMap
), aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
1567 if (srcfmt_hidd
!= vHidd_StdPixFmt_Native
)
1569 /* RECTFMT_ARGB32 on vHidd_StdPixFmt_0RGB32 bitmap ==> use vHidd_StdPixFmt_0RGB32 */
1570 /* RECTFMT_BGRA32 on vHidd_StdPixFmt_BGR032 bitmap ==> use vHidd_StdPixFmt_BGR032 */
1571 /* RECTFMT_RGBA32 on vHidd_StdPixFmt_RGB032 bitmap ==> use vHidd_StdPixFmt_RGB032 */
1572 /* RECTFMT_ABGR32 on vHidd_StdPixFmt_0BGR32 bitmap ==> use vHidd_StdPixFmt_0BGR32 */
1574 if (morphfmt_hidd
!= 0)
1578 OOP_GetAttr(pf
, aHidd_PixFmt_StdPixFmt
, (IPTR
*)&stdpf
);
1579 if (stdpf
== morphfmt_hidd
) srcfmt_hidd
= morphfmt_hidd
;
1582 pf
= HIDD_Gfx_GetPixFmt(SDD(GfxBase
)->gfxhidd
, srcfmt_hidd
);
1585 OOP_GetAttr(pf
, aHidd_PixFmt_BytesPerPixel
, &bppix
);
1587 start_offset
= ((ULONG
)srcy
) * srcmod
+ srcx
* bppix
;
1589 wpard
.array
= ((UBYTE
*)src
) + start_offset
;
1590 wpard
.pixfmt
= srcfmt_hidd
;
1591 wpard
.modulo
= srcmod
;
1592 wpard
.bppix
= bppix
;
1596 rr
.MaxX
= destx
+ width
- 1;
1597 rr
.MaxY
= desty
+ height
- 1;
1599 pixwritten
= do_render_func(rp
, NULL
, &rr
, wpa_render
, &wpard
, FALSE
, GfxBase
);
1601 RELEASE_DRIVERDATA(rp
, GfxBase
);
1606 LONG
driver_WritePixelArrayAlpha(APTR src
, UWORD srcx
, UWORD srcy
1607 , UWORD srcmod
, struct RastPort
*rp
, UWORD destx
, UWORD desty
1608 , UWORD width
, UWORD height
, ULONG globalalpha
, struct GfxBase
*GfxBase
)
1611 LONG pixwritten
= 0;
1612 struct wpaa_render_data wpaard
;
1613 struct Rectangle rr
;
1615 /* This is cybergraphx. We only work wih HIDD bitmaps */
1616 if (!IS_HIDD_BM(rp
->BitMap
))
1618 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in WritePixelArrayAlpha() !!!\n"));
1622 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
1625 /* Compute the start of the array */
1627 start_offset
= ((ULONG
)srcy
) * srcmod
+ srcx
* 4;
1629 wpaard
.array
= ((UBYTE
*)src
) + start_offset
;
1630 wpaard
.modulo
= srcmod
;
1634 rr
.MaxX
= destx
+ width
- 1;
1635 rr
.MaxY
= desty
+ height
- 1;
1637 pixwritten
= do_render_func(rp
, NULL
, &rr
, wpaa_render
, &wpaard
, FALSE
, GfxBase
);
1639 RELEASE_DRIVERDATA(rp
, GfxBase
);
1644 LONG
driver_ReadPixelArray(APTR dst
, UWORD destx
, UWORD desty
1645 , UWORD dstmod
, struct RastPort
*rp
, UWORD srcx
, UWORD srcy
1646 , UWORD width
, UWORD height
, UBYTE dstformat
, struct GfxBase
*GfxBase
)
1650 HIDDT_StdPixFmt dstfmt_hidd
= 0, morphfmt_hidd
= 0;
1659 struct Rectangle rr
;
1660 struct rpa_render_data rpard
;
1662 struct TagItem gc_tags
[] =
1664 { aHidd_GC_DrawMode
, vHidd_GC_DrawMode_Copy
},
1668 /* This is cybergraphx. We only work wih HIDD bitmaps */
1669 if (!IS_HIDD_BM(rp
->BitMap
))
1671 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in ReadPixelArray() !!!\n"));
1675 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
1678 gc
= GetDriverData(rp
)->dd_GC
;
1680 /* Preserve old drawmode */
1681 OOP_GetAttr(gc
, aHidd_GC_DrawMode
, &old_drmd
);
1682 OOP_SetAttrs(gc
, gc_tags
);
1687 case RECTFMT_RGB15
: dstfmt_hidd
= vHidd_StdPixFmt_RGB15
; break;
1688 case RECTFMT_BGR15
: dstfmt_hidd
= vHidd_StdPixFmt_BGR15
; break;
1689 case RECTFMT_RGB15PC
: dstfmt_hidd
= vHidd_StdPixFmt_RGB15_LE
; break;
1690 case RECTFMT_BGR15PC
: dstfmt_hidd
= vHidd_StdPixFmt_BGR15_LE
; break;
1691 case RECTFMT_RGB16
: dstfmt_hidd
= vHidd_StdPixFmt_RGB16
; break;
1692 case RECTFMT_BGR16
: dstfmt_hidd
= vHidd_StdPixFmt_BGR16
; break;
1693 case RECTFMT_RGB16PC
: dstfmt_hidd
= vHidd_StdPixFmt_RGB16_LE
; break;
1694 case RECTFMT_BGR16PC
: dstfmt_hidd
= vHidd_StdPixFmt_BGR16_LE
; break;
1695 case RECTFMT_RGB24
: dstfmt_hidd
= vHidd_StdPixFmt_RGB24
; break;
1696 case RECTFMT_BGR24
: dstfmt_hidd
= vHidd_StdPixFmt_BGR24
; break;
1697 case RECTFMT_ARGB32
: dstfmt_hidd
= vHidd_StdPixFmt_ARGB32
; morphfmt_hidd
= vHidd_StdPixFmt_0RGB32
; break;
1698 case RECTFMT_BGRA32
: dstfmt_hidd
= vHidd_StdPixFmt_BGRA32
; morphfmt_hidd
= vHidd_StdPixFmt_BGR032
; break;
1699 case RECTFMT_RGBA32
: dstfmt_hidd
= vHidd_StdPixFmt_RGBA32
; morphfmt_hidd
= vHidd_StdPixFmt_RGB032
; break;
1700 case RECTFMT_ABGR32
: dstfmt_hidd
= vHidd_StdPixFmt_ABGR32
; morphfmt_hidd
= vHidd_StdPixFmt_0BGR32
; break;
1701 case RECTFMT_RAW
: dstfmt_hidd
= vHidd_StdPixFmt_Native
; break;
1704 #warning Get rid of the below code ?
1705 /* This can be done by passing the srcx and srcy parameters on to
1706 the HIDD bitmap and let it take care of it itself.
1707 This means that HIDD_BM_PutImage() gets a lot of parameters,
1708 which may not be necessary in real life.
1710 Compromise: convert from *CyberGfx* pixfmt to bppix using a table lookup.
1713 if ((dstfmt_hidd
== vHidd_StdPixFmt_Native
) || (morphfmt_hidd
!= 0))
1715 OOP_GetAttr(HIDD_BM_OBJ(rp
->BitMap
), aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
1718 if (dstfmt_hidd
!= vHidd_StdPixFmt_Native
)
1720 /* RECTFMT_ARGB32 on vHidd_StdPixFmt_0RGB32 bitmap ==> use vHidd_StdPixFmt_0RGB32 */
1721 /* RECTFMT_BGRA32 on vHidd_StdPixFmt_BGR032 bitmap ==> use vHidd_StdPixFmt_BGR032 */
1722 /* RECTFMT_RGBA32 on vHidd_StdPixFmt_RGB032 bitmap ==> use vHidd_StdPixFmt_RGB032 */
1723 /* RECTFMT_ABGR32 on vHidd_StdPixFmt_0BGR32 bitmap ==> use vHidd_StdPixFmt_0BGR32 */
1725 if (morphfmt_hidd
!= 0)
1729 OOP_GetAttr(pf
, aHidd_PixFmt_StdPixFmt
, (IPTR
*)&stdpf
);
1730 if (stdpf
== morphfmt_hidd
) dstfmt_hidd
= morphfmt_hidd
;
1733 pf
= HIDD_Gfx_GetPixFmt(SDD(GfxBase
)->gfxhidd
, dstfmt_hidd
);
1736 OOP_GetAttr(pf
, aHidd_PixFmt_BytesPerPixel
, &bppix
);
1738 start_offset
= ((ULONG
)desty
) * dstmod
+ destx
* bppix
;
1740 rpard
.array
= ((UBYTE
*)dst
) + start_offset
;
1741 rpard
.pixfmt
= dstfmt_hidd
;
1742 rpard
.modulo
= dstmod
;
1743 rpard
.bppix
= bppix
;
1747 rr
.MaxX
= srcx
+ width
- 1;
1748 rr
.MaxY
= srcy
+ height
- 1;
1750 pixread
= do_render_func(rp
, NULL
, &rr
, rpa_render
, &rpard
, FALSE
, GfxBase
);
1752 /* restore old gc values */
1753 gc_tags
[0].ti_Data
= (IPTR
)old_drmd
;
1754 OOP_SetAttrs(gc
, gc_tags
);
1756 RELEASE_DRIVERDATA(rp
, GfxBase
);
1761 LONG
driver_InvertPixelArray(struct RastPort
*rp
1762 , UWORD destx
, UWORD desty
, UWORD width
, UWORD height
1763 , struct GfxBase
*GfxBase
)
1766 /* This is cybergraphx. We only work wih HIDD bitmaps */
1767 if (!IS_HIDD_BM(rp
->BitMap
))
1769 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap InvertPixelArray() !!!\n"));
1773 return (LONG
)fillrect_pendrmd(rp
1776 , desty
+ height
- 1
1778 , vHidd_GC_DrawMode_Invert
1782 LONG
driver_FillPixelArray(struct RastPort
*rp
1783 , UWORD destx
, UWORD desty
, UWORD width
, UWORD height
1784 , ULONG pixel
, struct GfxBase
*GfxBase
)
1789 /* HIDDT_ColComp are 16 Bit */
1790 col
.alpha
= (HIDDT_ColComp
)((pixel
>> 16) & 0x0000FF00);
1791 col
.red
= (HIDDT_ColComp
)((pixel
>> 8) & 0x0000FF00);
1792 col
.green
= (HIDDT_ColComp
)(pixel
& 0x0000FF00);
1793 col
.blue
= (HIDDT_ColComp
)((pixel
<< 8) & 0x0000FF00);
1795 pix
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
1797 return (LONG
)fillrect_pendrmd(rp
1800 , desty
+ height
- 1
1802 , vHidd_GC_DrawMode_Copy
1807 ULONG
driver_MovePixelArray(UWORD srcx
, UWORD srcy
, struct RastPort
*rp
1808 , UWORD destx
, UWORD desty
, UWORD width
, UWORD height
1809 , struct GfxBase
*GfxBase
)
1818 return width
* height
;
1823 LONG
driver_WriteRGBPixel(struct RastPort
*rp
, UWORD x
, UWORD y
1824 , ULONG pixel
, struct GfxBase
*GfxBase
)
1827 struct rgbpix_render_data prd
;
1831 /* This is cybergraphx. We only work wih HIDD bitmaps */
1832 if (!IS_HIDD_BM(rp
->BitMap
))
1834 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in WriteRGBPixel() !!!\n"));
1838 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
)) return -1;
1840 /* HIDDT_ColComp are 16 Bit */
1842 col
.alpha
= (HIDDT_ColComp
)((pixel
>> 16) & 0x0000FF00);
1843 col
.red
= (HIDDT_ColComp
)((pixel
>> 8) & 0x0000FF00);
1844 col
.green
= (HIDDT_ColComp
)(pixel
& 0x0000FF00);
1845 col
.blue
= (HIDDT_ColComp
)((pixel
<< 8) & 0x0000FF00);
1847 prd
.pixel
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
1849 retval
= do_pixel_func(rp
, x
, y
, rgbpix_write
, &prd
, GfxBase
);
1851 RELEASE_DRIVERDATA(rp
, GfxBase
);
1858 ULONG
driver_ReadRGBPixel(struct RastPort
*rp
, UWORD x
, UWORD y
1859 , struct GfxBase
*GfxBase
)
1861 struct rgbpix_render_data prd
;
1863 /* Get the HIDD pixel val */
1868 /* This is cybergraphx. We only work wih HIDD bitmaps */
1869 if (!IS_HIDD_BM(rp
->BitMap
))
1871 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in ReadRGBPixel()!!!\n"));
1875 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
)) return (ULONG
)-1;
1877 ret
= do_pixel_func(rp
, x
, y
, pix_read
, &prd
, GfxBase
);
1879 RELEASE_DRIVERDATA(rp
, GfxBase
);
1884 HIDD_BM_UnmapPixel(HIDD_BM_OBJ(rp
->BitMap
), prd
.pixel
, &col
);
1886 /* HIDDT_ColComp are 16 Bit */
1888 pix
= ((col
.alpha
& 0xFF00) << 16)
1889 | ((col
.red
& 0xFF00) << 8)
1890 | (col
.green
& 0xFF00)
1891 | ((col
.blue
& 0xFF00) >> 8);
1898 ULONG
driver_GetCyberMapAttr(struct BitMap
*bitMap
, ULONG attribute
, struct GfxBase
*GfxBase
)
1905 /* This is cybergraphx. We only work wih HIDD bitmaps */
1906 if (!IS_HIDD_BM(bitMap
)) {
1907 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in GetCyberMapAttr() !!!\n"));
1911 bm_obj
= HIDD_BM_OBJ(bitMap
);
1913 OOP_GetAttr(bm_obj
, aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
1915 switch (attribute
) {
1916 case CYBRMATTR_XMOD
:
1917 OOP_GetAttr(bm_obj
, aHidd_BitMap_BytesPerRow
, &retval
);
1920 case CYBRMATTR_BPPIX
:
1921 OOP_GetAttr(pf
, aHidd_PixFmt_BytesPerPixel
, &retval
);
1924 case CYBRMATTR_PIXFMT
: {
1927 OOP_GetAttr(pf
, aHidd_PixFmt_StdPixFmt
, (IPTR
*)&stdpf
);
1929 /* Convert to cybergfx */
1930 cpf
= hidd2cyber_pixfmt(stdpf
, GfxBase
);
1932 if (cpf
== (UWORD
)-1) {
1933 D(bug("!!! UNKNOWN PIXEL FORMAT IN GetCyberMapAttr()\n"));
1941 case CYBRMATTR_WIDTH
:
1942 #if 0 /* stegerg: doesn't really work, because of framebuffer bitmap object stuff */
1943 OOP_GetAttr(bm_obj
, aHidd_BitMap_Width
, &retval
);
1945 retval
= GetBitMapAttr(bitMap
, BMA_WIDTH
);
1949 case CYBRMATTR_HEIGHT
:
1950 #if 0 /* stegerg: doesn't really work, because of framebuffer bitmap object stuff */
1951 OOP_GetAttr(bm_obj
, aHidd_BitMap_Height
, &retval
);
1953 retval
= GetBitMapAttr(bitMap
, BMA_HEIGHT
);
1957 case CYBRMATTR_DEPTH
:
1958 #if 0 /* stegerg: might not really work, because of framebuffer bitmap object stuff */
1959 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &retval
);
1961 retval
= GetBitMapAttr(bitMap
, BMA_DEPTH
);
1965 case CYBRMATTR_ISCYBERGFX
: {
1968 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
1973 /* We allways have a HIDD bitmap */
1974 retval
= 0xFFFFFFFF; /* Some apps seem to rely on this retval */
1978 case CYBRMATTR_ISLINEARMEM
:
1979 OOP_GetAttr(bm_obj
, aHidd_BitMap_IsLinearMem
, &retval
);
1983 D(bug("!!! UNKNOWN ATTRIBUTE PASSED TO GetCyberMapAttr()\n"));
1987 } /* switch (attribute) */
1993 VOID
driver_CVideoCtrlTagList(struct ViewPort
*vp
, struct TagItem
*tags
, struct GfxBase
*GfxBase
)
1995 struct TagItem
*tag
, *tstate
;
1996 ULONG dpmslevel
= 0;
1998 struct TagItem htags
[] =
2000 { aHidd_Gfx_DPMSLevel
, 0UL },
2004 BOOL dpms_found
= FALSE
;
2006 HIDDT_DPMSLevel hdpms
= 0;
2008 for (tstate
= tags
; (tag
= NextTagItem((const struct TagItem
**)&tstate
)); )
2010 switch (tag
->ti_Tag
)
2012 case SETVC_DPMSLevel
:
2013 dpmslevel
= tag
->ti_Data
;
2018 D(bug("!!! UNKNOWN TAG IN CVideoCtrlTagList(): %x !!!\n"
2024 } /* for (each tagitem) */
2030 /* Convert to hidd dpms level */
2034 hdpms
= vHidd_Gfx_DPMSLevel_On
;
2038 hdpms
= vHidd_Gfx_DPMSLevel_Standby
;
2042 hdpms
= vHidd_Gfx_DPMSLevel_Suspend
;
2046 hdpms
= vHidd_Gfx_DPMSLevel_Off
;
2050 D(bug("!!! UNKNOWN DPMS LEVEL IN CVideoCtrlTagList(): %x !!!\n"
2061 htags
[0].ti_Data
= hdpms
;
2065 htags
[0].ti_Tag
= TAG_IGNORE
;
2068 OOP_SetAttrs(SDD(GfxBase
)->gfxhidd
, htags
);
2074 ULONG
driver_ExtractColor(struct RastPort
*rp
, struct BitMap
*bm
2075 , ULONG color
, ULONG srcx
, ULONG srcy
, ULONG width
, ULONG height
2076 , struct GfxBase
*GfxBase
)
2078 struct Rectangle rr
;
2080 struct extcol_render_data ecrd
;
2084 if (!IS_HIDD_BM(rp
->BitMap
))
2086 D(bug("!!! CALLING ExtractColor() ON NO-HIDD BITMAP !!!\n"));
2090 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
2095 rr
.MaxX
= srcx
+ width
- 1;
2096 rr
.MaxY
= srcy
+ height
- 1;
2098 OOP_GetAttr(HIDD_BM_OBJ(rp
->BitMap
), aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
2100 OOP_GetAttr(pf
, aHidd_PixFmt_ColorModel
, (IPTR
*)&colmod
);
2102 if (vHidd_ColorModel_Palette
== colmod
)
2110 col
.alpha
= (color
>> 16) & 0x0000FF00;
2111 col
.red
= (color
>> 8 ) & 0x0000FF00;
2112 col
.green
= color
& 0x0000FF00;
2113 col
.blue
= (color
<< 8) & 0x0000FF00;
2115 ecrd
.pixel
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
2121 pixread
= do_render_func(rp
, NULL
, &rr
, extcol_render
, NULL
, TRUE
, GfxBase
);
2123 RELEASE_DRIVERDATA(rp
, GfxBase
);
2125 if (pixread
!= (width
* height
))
2132 VOID
driver_DoCDrawMethodTagList(struct Hook
*hook
, struct RastPort
*rp
, struct TagItem
*tags
, struct GfxBase
*GfxBase
)
2135 struct dm_render_data dmrd
;
2136 struct Rectangle rr
;
2139 if (!IS_HIDD_BM(rp
->BitMap
))
2141 D(bug("!!! NO HIDD BITMAP IN CALL TO DoCDrawMethodTagList() !!!\n"));
2145 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
2148 /* Get the bitmap std pixfmt */
2149 OOP_GetAttr(HIDD_BM_OBJ(rp
->BitMap
), aHidd_BitMap_PixFmt
, (IPTR
*)&dmrd
.pf
);
2150 OOP_GetAttr(dmrd
.pf
, aHidd_PixFmt_StdPixFmt
, &dmrd
.stdpf
);
2151 dmrd
.msg
.colormodel
= hidd2cyber_pixfmt(dmrd
.stdpf
, GfxBase
);
2155 if (((UWORD
)-1) == dmrd
.msg
.colormodel
)
2157 RELEASE_DRIVERDATA(rp
, GfxBase
);
2158 D(bug("!!! UNKNOWN HIDD PIXFMT IN DoCDrawMethodTagList() !!!\n"));
2170 rr
.MaxX
= GetBitMapAttr(rp
->BitMap
, BMA_WIDTH
) - 1;
2171 rr
.MaxY
= GetBitMapAttr(rp
->BitMap
, BMA_HEIGHT
) - 1;
2175 /* Lock the layer */
2178 rr
.MaxX
= rr
.MinX
+ (L
->bounds
.MaxX
- L
->bounds
.MinX
) - 1;
2179 rr
.MaxY
= rr
.MinY
+ (L
->bounds
.MaxY
- L
->bounds
.MinY
) - 1;
2182 dmrd
.gc
= GetDriverData(rp
)->dd_GC
;
2183 do_render_func(rp
, NULL
, &rr
, dm_render
, &dmrd
, FALSE
, GfxBase
);
2185 RELEASE_DRIVERDATA(rp
, GfxBase
);
2195 APTR
driver_LockBitMapTagList(struct BitMap
*bm
, struct TagItem
*tags
, struct GfxBase
*GfxBase
)
2197 struct TagItem
*tag
;
2199 ULONG width
, height
, banksize
, memsize
;
2204 if (!IS_HIDD_BM(bm
))
2206 D(bug("!!! TRYING TO CALL LockBitMapTagList() ON NON-HIDD BM !!!\n"));
2210 OOP_GetAttr(HIDD_BM_OBJ(bm
), aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
2212 OOP_GetAttr(pf
, aHidd_PixFmt_StdPixFmt
, &stdpf
);
2213 cpf
= hidd2cyber_pixfmt(stdpf
, GfxBase
);
2214 if (((UWORD
)-1) == cpf
)
2216 D(bug("!!! TRYING TO CALL LockBitMapTagList() ON NON-CYBER PIXFMT BITMAP !!!\n"));
2220 /* Get some info from the bitmap object */
2221 if (!HIDD_BM_ObtainDirectAccess(HIDD_BM_OBJ(bm
), &baseaddress
, &width
, &height
, &banksize
, &memsize
))
2225 while ((tag
= NextTagItem((const struct TagItem
**)&tags
)))
2227 switch (tag
->ti_Tag
)
2229 case LBMI_BASEADDRESS
:
2230 *((IPTR
**)tag
->ti_Data
) = (IPTR
*)baseaddress
;
2233 case LBMI_BYTESPERROW
:
2234 *((IPTR
*)tag
->ti_Data
) =
2235 (ULONG
)HIDD_BM_BytesPerLine(HIDD_BM_OBJ(bm
), stdpf
, width
);
2238 case LBMI_BYTESPERPIX
:
2239 OOP_GetAttr(pf
, aHidd_PixFmt_BytesPerPixel
, (IPTR
*)tag
->ti_Data
);
2243 *((IPTR
*)tag
->ti_Data
) = (IPTR
)cpf
;
2247 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, (IPTR
*)tag
->ti_Data
);
2251 OOP_GetAttr(HIDD_BM_OBJ(bm
), aHidd_BitMap_Width
, (IPTR
*)tag
->ti_Data
);
2255 OOP_GetAttr(HIDD_BM_OBJ(bm
), aHidd_BitMap_Height
, (IPTR
*)tag
->ti_Data
);
2259 D(bug("!!! UNKNOWN TAG PASSED TO LockBitMapTagList() !!!\n"));
2264 return HIDD_BM_OBJ(bm
);
2267 VOID
driver_UnLockBitMap(APTR handle
, struct GfxBase
*GfxBase
)
2269 if (handle
) HIDD_BM_ReleaseDirectAccess((OOP_Object
*)handle
);
2272 VOID
driver_UnLockBitMapTagList(APTR handle
, struct TagItem
*tags
, struct GfxBase
*GfxBase
)
2274 struct TagItem
*tag
;
2275 BOOL reallyunlock
= TRUE
;
2277 while ((tag
= NextTagItem((const struct TagItem
**)&tags
)))
2279 switch (tag
->ti_Tag
)
2281 case UBMI_REALLYUNLOCK
:
2282 reallyunlock
= (BOOL
)tag
->ti_Data
;
2285 case UBMI_UPDATERECTS
:
2287 struct RectList
*rl
;
2289 rl
= (struct RectList
*)tag
->ti_Data
;
2291 #warning Dunno what to do with this
2297 D(bug("!!! UNKNOWN TAG PASSED TO UnLockBitMapTagList() !!!\n"));
2304 HIDD_BM_ReleaseDirectAccess((OOP_Object
*)handle
);
2308 void driver_BltTemplateAlpha(UBYTE
*src
, LONG srcx
, LONG srcmod
2309 , struct RastPort
*rp
, LONG destx
, LONG desty
, LONG width
, LONG height
2310 , struct GfxBase
*GfxBase
)
2312 struct bta_render_data btard
;
2313 struct Rectangle rr
;
2315 /* This is cybergraphx. We only work wih HIDD bitmaps */
2316 if (!IS_HIDD_BM(rp
->BitMap
)) {
2317 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in BltTemplateAlpha() !!!\n"));
2321 if (!OBTAIN_DRIVERDATA(rp
, GfxBase
))
2324 /* Compute the start of the array */
2326 btard
.array
= src
+ srcx
;
2327 btard
.modulo
= srcmod
;
2328 btard
.invertalpha
= (rp
->DrawMode
& INVERSVID
) ? TRUE
: FALSE
;
2331 rr
.MaxX
= destx
+ width
- 1;
2332 rr
.MaxY
= desty
+ height
- 1;
2334 do_render_func(rp
, NULL
, &rr
, bta_render
, &btard
, FALSE
, GfxBase
);
2336 RELEASE_DRIVERDATA(rp
, GfxBase
);
2339 /******************************************/
2340 /* Support stuff for cybergfx */
2341 /******************************************/