6 #include <exec/types.h>
7 #include <exec/memory.h>
8 #include <exec/semaphores.h>
9 #include <exec/libraries.h>
10 #include <exec/execbase.h>
11 #include <exec/lists.h>
12 #include <exec/resident.h>
14 #include <dos/dostags.h>
15 #include <graphics/gfxbase.h>
16 #include <scalos/scalos.h>
17 #include <scalos/scalosgfx.h>
19 #include <clib/alib_protos.h>
21 #include <proto/dos.h>
22 #include <proto/exec.h>
23 #include <proto/intuition.h>
24 #include <proto/utility.h>
25 #include <proto/scalosgfx.h>
29 #include "scalosgfx_base.h"
30 #include "scalosgfx.h"
34 //----------------------------------------------------------------------------
36 #define IS_NOT_EVEN(len) ((len) & 1)
37 #define EVEN(len) (((len) + 1) & ~1)
38 #define MAGIC_PREFS_LIST_ENTRY_LIST ((UWORD) -1)
40 #define min(a,b) ((a) < (b) ? (a) : (b))
43 #define ExtLib(base) ((struct ExtendedLibrary *)((ULONG)base + ((struct Library *)base)->lib_PosSize))
44 #define IScalosGfx ((struct ScaosGfxIFace *)ExtLib(ScalosGfxBase)->MainIFace)
47 //----------------------------------------------------------------------------
50 //----------------------------------------------------------------------------
52 // Standard library functions
54 //----------------------------------------------------------------------------
56 #if !defined(__AROS__)
57 struct ExecBase
*SysBase
;
59 struct IntuitionBase
*IntuitionBase
;
60 T_UTILITYBASE UtilityBase
;
61 struct DosLibrary
* DOSBase
;
62 struct Library
*CyberGfxBase
;
63 struct GfxBase
*GfxBase
;
64 struct Library
*LayersBase
;
66 struct Library
*NewlibBase
;
67 struct Interface
*INewlib
;
68 struct GraphicsIFace
*IGraphics
;
69 struct ExecIFace
*IExec
;
70 struct IntuitionIFace
*IIntuition
;
71 struct UtilityIFace
*IUtility
;
72 struct DOSIFace
*IDOS
;
73 struct CyberGfxIFace
*ICyberGfx
;
74 struct LayersIFace
*ILayers
;
77 //----------------------------------------------------------------------------
79 char ALIGNED libName
[] = "scalosgfx.library";
80 char ALIGNED libIdString
[] = "$VER: scalosgfx.library "
81 STR(LIB_VERSION
) "." STR(LIB_REVISION
)
82 " (29 Jul 2008 19:29:17) "
84 " ©2006" CURRENTYEAR
" The Scalos Team";
86 //----------------------------------------------------------------------------
89 BOOL
ScalosGfxInit(struct ScalosGfxBase
*ScalosGfxBase
)
91 d1(kprintf("%s/%ld: START ScalosGfxBase=%08lx procName=<%s>\n", __FUNC__
, __LINE__
, \
92 ScalosGfxBase
, FindTask(NULL
)->tc_Node
.ln_Name
));
94 NewList(&ScalosGfxBase
->sgb_PrefsList
);
96 InitSemaphore(&ScalosGfxBase
->sgb_MemPoolSemaphore
);
97 InitSemaphore(&ScalosGfxBase
->sgb_PrefsListSem
);
99 d1(kprintf("%s/%ld: END Success\n", __FUNC__
, __LINE__
));
101 return TRUE
; // Success
104 //-----------------------------------------------------------------------------
106 BOOL
ScalosGfxOpen(struct ScalosGfxBase
*ScalosGfxBase
)
108 BOOL Success
= FALSE
;
110 d1(kprintf("%s/%ld: START ScalosGfxBase=%08lx procName=<%s>\n", __FUNC__
, __LINE__
, \
111 ScalosGfxBase
, FindTask(NULL
)->tc_Node
.ln_Name
));
114 IntuitionBase
= (APTR
) OpenLibrary( "intuition.library", 39 );
118 IIntuition
= (APTR
) GetInterface((struct Library
*)IntuitionBase
, "main", 1, NULL
);
121 CloseLibrary((struct Library
*)IntuitionBase
);
122 IntuitionBase
= NULL
;
126 if (NULL
== IntuitionBase
)
129 UtilityBase
= (APTR
) OpenLibrary( "utility.library", 39 );
133 IUtility
= (APTR
) GetInterface((struct Library
*)UtilityBase
, "main", 1, NULL
);
136 CloseLibrary((struct Library
*)UtilityBase
);
141 if (NULL
== UtilityBase
)
144 GfxBase
= (struct GfxBase
*) OpenLibrary(GRAPHICSNAME
, 39);
148 IGraphics
= (struct GraphicsIFace
*)GetInterface((struct Library
*)GfxBase
, "main", 1, NULL
);
149 if (IGraphics
== NULL
)
151 CloseLibrary((struct Library
*)GfxBase
);
156 d1(kprintf("%s/%ld: GfxBase=%08lx\n", __FUNC__
, __LINE__
, GfxBase
));
160 CyberGfxBase
= (APTR
) OpenLibrary( "cybergraphics.library", 40);
164 ICyberGfx
= (APTR
) GetInterface((struct Library
*)CyberGfxBase
, "main", 1, NULL
);
167 CloseLibrary(CyberGfxBase
);
172 // CyberGfxBase may be NULL
174 DOSBase
= (APTR
) OpenLibrary( "dos.library", 39 );
178 IDOS
= (APTR
) GetInterface((struct Library
*)DOSBase
, "main", 1, NULL
);
181 CloseLibrary((struct Library
*)DOSBase
);
189 LayersBase
= OpenLibrary( "layers.library", 39 );
193 ILayers
= (APTR
) GetInterface(LayersBase
, "main", 1, NULL
);
196 CloseLibrary(LayersBase
);
201 if (NULL
== LayersBase
)
205 NewlibBase
= OpenLibrary("newlib.library", 0);
206 if (NULL
== NewlibBase
)
208 INewlib
= GetInterface(NewlibBase
, "main", 1, NULL
);
213 ScalosGfxBase
->sgb_MemPool
= CreatePool(MEMF_PUBLIC
| MEMF_CLEAR
, 8192, 256);
214 if (NULL
== ScalosGfxBase
->sgb_MemPool
)
220 d1(kprintf("%s/%ld: END Success=%ld\n", __FUNC__
, __LINE__
, Success
));
225 //-----------------------------------------------------------------------------
227 void ScalosGfxCleanup(struct ScalosGfxBase
*ScalosGfxBase
)
229 d1(kprintf("%s/%ld:\n", __FUNC__
, __LINE__
));
234 DropInterface((struct Interface
*)ICyberGfx
);
236 CloseLibrary(CyberGfxBase
);
242 DropInterface((struct Interface
*)IGraphics
);
244 CloseLibrary((struct Library
*) GfxBase
);
250 DropInterface((struct Interface
*)IUtility
);
252 CloseLibrary((struct Library
*) UtilityBase
);
258 DropInterface((struct Interface
*)IIntuition
);
260 CloseLibrary((struct Library
*) IntuitionBase
);
261 IntuitionBase
= NULL
;
266 DropInterface((struct Interface
*)IDOS
);
268 CloseLibrary((struct Library
*) DOSBase
);
274 DropInterface((struct Interface
*)ILayers
);
276 CloseLibrary(LayersBase
);
282 DropInterface(INewlib
);
287 CloseLibrary(NewlibBase
);
291 if (ScalosGfxBase
->sgb_MemPool
)
293 DeletePool(ScalosGfxBase
->sgb_MemPool
);
294 ScalosGfxBase
->sgb_MemPool
= NULL
;
296 d1(kprintf("%s/%ld:\n", __FUNC__
, __LINE__
));
299 //-----------------------------------------------------------------------------
301 LIBFUNC_P1(struct ScalosBitMapAndColor
*, LIBScalosGfxCreateEmptySAC
,
302 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
304 return AllocEmptySAC(ScalosGfxBase
);
308 //-----------------------------------------------------------------------------
310 LIBFUNC_P6(struct ScalosBitMapAndColor
*, LIBScalosGfxCreateSAC
,
314 A0
, struct BitMap
*, friendBM
,
315 A1
, struct TagItem
*, tagList
,
316 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
320 return AllocSAC(width
, height
, depth
, friendBM
, tagList
, ScalosGfxBase
);
324 //-----------------------------------------------------------------------------
326 LIBFUNC_P2(VOID
, LIBScalosGfxFreeSAC
,
327 A0
, struct ScalosBitMapAndColor
*, sac
,
328 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
330 FreeSAC(sac
, ScalosGfxBase
);
334 //-----------------------------------------------------------------------------
336 LIBFUNC_P4(struct gfxARGB
*, LIBScalosGfxCreateARGB
,
339 A0
, struct TagItem
*, tagList
,
340 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
344 return AllocARGB(width
, height
, ScalosGfxBase
);
348 //-----------------------------------------------------------------------------
350 LIBFUNC_P2(VOID
, LIBScalosGfxFreeARGB
,
351 A0
, struct gfxARGB
**, argb
,
352 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
354 FreeARGB(argb
, ScalosGfxBase
);
358 //-----------------------------------------------------------------------------
360 LIBFUNC_P3(VOID
, LIBScalosGfxARGBSetAlpha
,
361 A0
, struct ARGBHeader
*, argbh
,
363 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
365 (void) ScalosGfxBase
;
367 ARGBSetAlpha(argbh
->argb_ImageData
,
368 argbh
->argb_Width
, argbh
->argb_Height
, alpha
);
372 //-----------------------------------------------------------------------------
374 LIBFUNC_P3(VOID
, LIBScalosGfxARGBSetAlphaMask
,
375 A0
, struct ARGBHeader
*, argbh
,
376 A1
, PLANEPTR
, maskPlane
,
377 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
379 (void) ScalosGfxBase
;
381 ARGBSetAlphaFromMask(argbh
, maskPlane
);
385 //-----------------------------------------------------------------------------
387 LIBFUNC_P7(struct gfxARGB
*, LIBScalosGfxCreateARGBFromBitMap
,
388 A0
, struct BitMap
*,bm
,
391 D2
, ULONG
, numberOfColors
,
392 A1
, const ULONG
*, colorTable
,
393 A2
, PLANEPTR
, maskPlane
,
394 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
396 return CreateARGBFromBitMap(bm
, width
, height
,
397 numberOfColors
, colorTable
, maskPlane
, ScalosGfxBase
);
401 //-----------------------------------------------------------------------------
403 LIBFUNC_P4(VOID
, LIBScalosGfxFillARGBFromBitMap
,
404 A0
, struct ARGBHeader
*, argbh
,
405 A1
, struct BitMap
*, srcBM
,
406 A2
, PLANEPTR
, maskPlane
,
407 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
409 (void) ScalosGfxBase
;
411 FillARGBFromBitMap(argbh
, srcBM
, maskPlane
);
415 //-----------------------------------------------------------------------------
417 LIBFUNC_P5(VOID
, LIBScalosGfxWriteARGBToBitMap
,
418 A0
, struct ARGBHeader
*, argbh
,
419 A1
, struct BitMap
*, bm
,
420 D0
, ULONG
, numberOfColors
,
421 A2
, const ULONG
*, colorTable
,
422 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
424 (void) ScalosGfxBase
;
426 WriteARGBToBitMap(argbh
->argb_ImageData
, bm
,
427 argbh
->argb_Width
, argbh
->argb_Height
,
428 numberOfColors
, colorTable
, ScalosGfxBase
);
432 //-----------------------------------------------------------------------------
434 LIBFUNC_P4(struct ScalosBitMapAndColor
*, LIBScalosGfxMedianCut
,
435 A0
, struct ARGBHeader
*, argbh
,
437 A1
, struct TagItem
*, tagList
,
438 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
442 struct BitMap
*friendBM
;
443 ULONG ReservedColors
;
445 struct ScalosBitMapAndColor
*sac
= NULL
;
447 d1(KPrintF(__FILE__
"/%s/%ld: START tagList=%08lx\n", __FUNC__
, __LINE__
, tagList
));
449 flags
= GetTagData(SCALOSGFX_MedianCutFlags
, 0, tagList
);
450 floyd
= flags
& SCALOSGFXFLAGF_MedianCut_FloydSteinberg
;
451 ReservedColors
= GetTagData(SCALOSGFX_MedianCutReservedColors
, 0, tagList
);
452 friendBM
= (struct BitMap
*) GetTagData(SCALOSGFX_MedianCutFriendBitMap
, (ULONG
)NULL
, tagList
);
454 d1(KPrintF(__FILE__
"/%s/%ld: flags=%08lx ReservedColors=%lu\n", __FUNC__
, __LINE__
, flags
, ReservedColors
));
456 NewColors
= 1 << depth
;
459 NewColors
+= ReservedColors
;
463 // adjst depth for reserved colors
464 while (NewColors
> (1 << depth
))
467 d1(KPrintF("%s/%ld: NewColors=%lu depth=%lu ReservedColors=%lu\n", \
468 __FUNC__
, __LINE__
, NewColors
, depth
, ReservedColors
));
470 sac
= MedianCut(argbh
, depth
, NewColors
, floyd
, friendBM
, ScalosGfxBase
);
477 //-----------------------------------------------------------------------------
479 LIBFUNC_P5(struct gfxARGB
*, LIBScalosGfxScaleARGBArray
,
480 A0
, const struct ARGBHeader
*, src
,
481 A1
, ULONG
*, destWidth
,
482 A2
, ULONG
*, destHeight
,
483 A3
, struct TagItem
*, tagList
,
484 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
488 flags
= GetTagData(SCALOSGFX_ScaleARGBArrayFlags
, 0, tagList
);
490 return ScaleARGBArray(src
, destWidth
, destHeight
, flags
, ScalosGfxBase
);
494 //-----------------------------------------------------------------------------
496 LIBFUNC_P3(struct BitMap
*, LIBScalosGfxScaleBitMap
,
497 A0
, struct ScaleBitMapArg
*, sbma
,
498 A1
, struct TagItem
*, tagList
,
499 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
503 return ScaleBitMap(sbma
->sbma_SourceBM
,
504 sbma
->sbma_SourceWidth
,
505 sbma
->sbma_SourceHeight
,
506 sbma
->sbma_DestWidth
,
507 sbma
->sbma_DestHeight
,
508 sbma
->sbma_NumberOfColors
,
509 sbma
->sbma_ColorTable
,
516 //-----------------------------------------------------------------------------
518 LIBFUNC_P5(VOID
, LIBScalosGfxCalculateScaleAspect
,
519 D0
, ULONG
, sourceWidth
,
520 D1
, ULONG
, sourceHeight
,
521 A0
, ULONG
*, destWidth
,
522 A1
, ULONG
*, destHeight
,
523 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
525 (void) ScalosGfxBase
;
527 CalculateScaleAspect(sourceWidth
, sourceHeight
, destWidth
, destHeight
);
531 //-----------------------------------------------------------------------------
533 LIBFUNC_P9(VOID
, LIBScalosGfxBlitARGB
,
534 A0
, struct ARGBHeader
*, DestARGB
,
535 A1
, const struct ARGBHeader
*, SrcARGB
,
542 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
544 (void) ScalosGfxBase
;
546 BlitARGB(DestARGB
, SrcARGB
, DestLeft
, DestTop
,
547 SrcLeft
, SrcTop
, Width
, Height
);
551 //-----------------------------------------------------------------------------
553 // Fill a rectangle with a given ARGB color.
555 LIBFUNC_P7(VOID
, LIBScalosGfxFillRectARGB
,
556 A0
, struct ARGBHeader
*, DestARGB
,
557 A1
, const struct gfxARGB
*, fillARGB
,
562 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
564 (void) ScalosGfxBase
;
566 FillARGB(DestARGB
, fillARGB
, left
, top
, width
, height
);
570 //-----------------------------------------------------------------------------
572 // Fill entire ARGB with given ARGB color
574 LIBFUNC_P3(VOID
, LIBScalosGfxSetARGB
,
575 A0
, struct ARGBHeader
*, DestARGB
,
576 A1
, const struct gfxARGB
*, fillARGB
,
577 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
579 (void) ScalosGfxBase
;
581 SetARGB(DestARGB
, fillARGB
);
585 //-----------------------------------------------------------------------------
587 // replace ColorMap in sac by given new one
589 LIBFUNC_P4(BOOL
, LIBScalosGfxNewColorMap
,
590 A0
, struct ScalosBitMapAndColor
*, sac
,
591 A1
, const ULONG
*, colorMap
,
592 D0
, ULONG
, colorEntries
,
593 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
595 (void) ScalosGfxBase
;
597 return SetNewSacColorMap(sac
, colorMap
, colorEntries
, ScalosGfxBase
);
601 //-----------------------------------------------------------------------------
603 LIBFUNC_P8(VOID
, LIBScalosGfxARGBRectMult
,
604 A0
, struct RastPort
*, rp
,
605 A1
, const struct ARGB
*, numerator
,
606 A2
, const struct ARGB
*, denominator
,
611 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
613 ARGBRectMult(rp
, *numerator
, *denominator
,
620 //-----------------------------------------------------------------------------
622 LIBFUNC_P9(VOID
, LIBScalosGfxBlitARGBAlpha
,
623 A0
, struct RastPort
*, rp
,
624 A1
, const struct ARGBHeader
*, srcH
,
631 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
633 BlitARGBAlpha(rp
, srcH
,
641 //-----------------------------------------------------------------------------
643 LIBFUNC_P7(VOID
, LIBScalosGfxBlitARGBAlphaTagList
,
644 A0
, struct RastPort
*, rp
,
645 A1
, const struct ARGBHeader
*, srcH
,
648 A3
, const struct IBox
*, srcSize
,
649 A2
, struct TagItem
*, tagList
,
650 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
652 const struct ARGB KDefault
= { 255, 0, 0, 0 };
653 const struct ARGB
*K
;
657 K
= (const struct ARGB
*) GetTagData(SCALOSGFX_BlitARGBHilight
, (ULONG
) NULL
, tagList
);
658 Trans
= GetTagData(SCALOSGFX_BlitARGBTransparency
, 255, tagList
);
659 NoAlpha
= GetTagData(SCALOSGFX_BlitARGBNoAlpha
, FALSE
, tagList
);
666 d1(KPrintF("%s/%ld: Red=%ld Green=%ld Blue=%ld Trans=%lu\n", __FUNC__
, __LINE__
, K
->Red
, K
->Green
, K
->Blue
, Trans
));
670 srcSize
->Left
, srcSize
->Top
,
671 srcSize
->Width
, srcSize
->Height
,
675 else if (K
|| 255 != Trans
)
677 d1(KPrintF("%s/%ld: Red=%ld Green=%ld Blue=%ld Trans=%lu\n", __FUNC__
, __LINE__
, K
->Red
, K
->Green
, K
->Blue
, Trans
));
678 BlitARGBAlphaKT(rp
, srcH
,
680 srcSize
->Left
, srcSize
->Top
,
681 srcSize
->Width
, srcSize
->Height
,
687 BlitARGBAlpha(rp
, srcH
,
689 srcSize
->Left
, srcSize
->Top
,
690 srcSize
->Width
, srcSize
->Height
,
696 //-----------------------------------------------------------------------------
698 LIBFUNC_P8(VOID
, LIBScalosGfxBlitIcon
,
699 A0
, struct RastPort
*, rpBackground
,
700 A1
, struct RastPort
*, rpIcon
,
705 A2
, struct TagItem
*, tagList
,
706 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
708 const struct ARGB
*K
;
712 K
= (const struct ARGB
*) GetTagData(SCALOSGFX_BlitIconHilight
, (ULONG
) NULL
, tagList
);
713 Alpha
= (const UBYTE
*) GetTagData(SCALOSGFX_BlitIconAlpha
, (ULONG
) NULL
, tagList
);
714 Trans
= GetTagData(SCALOSGFX_BlitIconTransparency
, 255, tagList
);
720 BlitTransparentAlphaK(rpBackground
, rpIcon
,
721 left
, top
, width
, height
,
722 K
, Alpha
, ScalosGfxBase
);
726 BlitTransparentAlpha(rpBackground
, rpIcon
,
727 left
, top
, width
, height
,
728 Trans
, Alpha
, ScalosGfxBase
);
735 BlitTransparentK(rpBackground
, rpIcon
,
736 left
, top
, width
, height
,
741 BlitTransparent(rpBackground
, rpIcon
,
742 left
, top
, width
, height
,
743 Trans
, ScalosGfxBase
);
749 //-----------------------------------------------------------------------------
751 LIBFUNC_P9(BOOL
, LIBScalosGfxDrawGradient
,
752 A0
, struct ARGBHeader
*, dest
,
757 A1
, struct gfxARGB
*, start
,
758 A2
, struct gfxARGB
*, stop
,
760 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
762 return ScaDrawGradient(dest
, left
, top
, width
, height
, start
, stop
, gradType
, ScalosGfxBase
);
766 //-----------------------------------------------------------------------------
768 LIBFUNC_P9(BOOL
, LIBScalosGfxDrawGradientRastPort
,
769 A0
, struct RastPort
*, rp
,
774 A1
, struct gfxARGB
*, start
,
775 A2
, struct gfxARGB
*, stop
,
777 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
779 return DrawGradientRastPort(rp
, left
, top
, width
, height
, start
, stop
, gradType
, ScalosGfxBase
);
783 //-----------------------------------------------------------------------------
785 LIBFUNC_P7(VOID
, LIBScalosGfxDrawLine
,
786 A0
, struct ARGBHeader
*, dest
,
791 A1
, const struct gfxARGB
*, lineColor
,
792 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
794 (void) ScalosGfxBase
;
796 DrawLine(dest
, fromX
, fromY
, toX
, toY
, *lineColor
);
800 //-----------------------------------------------------------------------------
802 LIBFUNC_P7(VOID
, LIBScalosGfxDrawLineRastPort
,
803 A0
, struct RastPort
*, rp
,
808 A1
, const struct gfxARGB
*, lineColor
,
809 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
811 (void) ScalosGfxBase
;
813 DrawLineRastPort(rp
, fromX
, fromY
, toX
, toY
, *lineColor
);
817 //-----------------------------------------------------------------------------
819 LIBFUNC_P9(VOID
, LIBScalosGfxDrawEllipse
,
820 A0
, struct ARGBHeader
*, dest
,
826 A1
, const struct gfxARGB
*, color1
,
827 A2
, const struct gfxARGB
*, color2
,
828 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
830 (void) ScalosGfxBase
;
832 DrawARGBEllipse(dest
, xCenter
, yCenter
, radiusX
, radiusY
,
833 segment
, *color1
, *color2
);
837 //-----------------------------------------------------------------------------
839 LIBFUNC_P9(VOID
, LIBScalosGfxDrawEllipseRastPort
,
840 A0
, struct RastPort
*, rp
,
846 A1
, const struct gfxARGB
*, color1
,
847 A2
, const struct gfxARGB
*, color2
,
848 A6
, struct ScalosGfxBase
*, ScalosGfxBase
)
850 (void) ScalosGfxBase
;
852 DrawARGBEllipseRastPort(rp
, xCenter
, yCenter
, radiusX
, radiusY
,
853 segment
, *color1
, *color2
);
857 //-----------------------------------------------------------------------------
859 APTR
ScalosGfxAllocVecPooled(struct ScalosGfxBase
*ScalosGfxBase
, ULONG Size
)
863 if (ScalosGfxBase
->sgb_MemPool
)
865 ObtainSemaphore(&ScalosGfxBase
->sgb_MemPoolSemaphore
);
866 ptr
= AllocPooled(ScalosGfxBase
->sgb_MemPool
, Size
+ sizeof(size_t));
867 ReleaseSemaphore(&ScalosGfxBase
->sgb_MemPoolSemaphore
);
870 size_t *sptr
= (size_t *) ptr
;
874 d1(kprintf("%s/%ld: MemPool=%08lx Size=%lu mem=%08lx\n", __FUNC__
, __LINE__
, ScalosGfxBase
->sgb_MemPool
, Size
, &sptr
[1]));
875 return (APTR
)(&sptr
[1]);
879 d1(kprintf("%s/%ld: MemPool=%08lx Size=%lu\n", __FUNC__
, __LINE__
, ScalosGfxBase
->sgb_MemPool
, Size
));
884 //-----------------------------------------------------------------------------
886 void ScalosGfxFreeVecPooled(struct ScalosGfxBase
*ScalosGfxBase
, APTR mem
)
888 d1(kprintf("%s/%ld: MemPool=%08lx mem=%08lx\n", __FUNC__
, __LINE__
, ScalosGfxBase
->sgb_MemPool
, mem
));
889 if (ScalosGfxBase
->sgb_MemPool
&& mem
)
892 size_t *sptr
= (size_t *) mem
;
897 ObtainSemaphore(&ScalosGfxBase
->sgb_MemPoolSemaphore
);
898 FreePooled(ScalosGfxBase
->sgb_MemPool
, mem
, size
+ sizeof(size_t));
899 ReleaseSemaphore(&ScalosGfxBase
->sgb_MemPoolSemaphore
);
903 //-----------------------------------------------------------------------------
905 #if !defined(__SASC) && !defined(__amigaos4__)
913 #endif /* !defined(__SASC) */
915 //-----------------------------------------------------------------------------
921 #endif /* defined(__SASC) */
923 //-----------------------------------------------------------------------------
925 #if defined(__AROS__)
927 #include "aros/symbolsets.h"
929 ADD2INITLIB(ScalosGfxInit
, 0);
930 ADD2EXPUNGELIB(ScalosGfxCleanup
, 0);
931 ADD2OPENLIB(ScalosGfxOpen
, 0);
935 //-----------------------------------------------------------------------------