Implement clipping so that result text in Calculator doesn't draw over brdr

This commit is contained in:
deadwood 2024-03-26 16:03:14 +01:00
parent f28275f6cd
commit cf5fc9dbaa
5 changed files with 112 additions and 21 deletions

View File

@ -55,6 +55,24 @@ struct LibraryV0 *abiv0_Layers_OpenLib(ULONG version, struct LibraryV0 *LayersBa
}
MAKE_PROXY_ARG_2(Layers_OpenLib)
#include <proto/layers.h>
#include "abiv0/include/graphics/structures.h"
#include "abiv0/include/graphics/proxy_structures.h"
struct RegionV0 *abiv0_InstallClipRegion(struct LayerV0 *l, struct RegionV0 *region, struct LibraryV0 *LayersBaseV0)
{
struct LayerProxy *lproxy = (struct LayerProxy *)l;
struct RegionProxy *regionproxy = (struct RegionProxy *)region;
if (regionproxy)
InstallClipRegion(lproxy->native, regionproxy->native);
else
InstallClipRegion(lproxy->native, NULL);
return NULL; /* FIXME */
}
MAKE_PROXY_ARG_3(InstallClipRegion)
void abiv0_GetSysTime(struct timeval *dest, struct LibraryV0 *TimerBaseV0)
{
return GetSysTime(dest);
@ -62,7 +80,6 @@ void abiv0_GetSysTime(struct timeval *dest, struct LibraryV0 *TimerBaseV0)
MAKE_PROXY_ARG_2(GetSysTime)
#include <proto/cybergraphics.h>
#include "abiv0/include/graphics/structures.h"
ULONG abiv0_FillPixelArray(struct RastPortV0 *rp, UWORD destx, UWORD desty, UWORD width, UWORD height, ULONG pixel)
{
@ -100,6 +117,7 @@ LONG_FUNC run_emulation()
/* Remove all vectors for now */
for (int i = 1; i <= 45; i++) __AROS_SETVECADDRV0(abiv0LayersBase, i, 0);
__AROS_SETVECADDRV0(abiv0LayersBase, 1, (APTR32)(IPTR)proxy_Layers_OpenLib);
__AROS_SETVECADDRV0(abiv0LayersBase, 29, (APTR32)(IPTR)proxy_InstallClipRegion);
BPTR cgfxseg = LoadSeg32("SYS:Libs32/partial/cybergraphics.library", DOSBase);
struct ResidentV0 *cgfxres = findResident(cgfxseg, NULL);

View File

@ -14,12 +14,6 @@
struct ExecBaseV0 *Gfx_SysBaseV0;
struct RegionProxy
{
struct RegionV0 base;
struct Region *native;
};
struct LibraryV0 *abiv0_Gfx_OpenLib(ULONG version, struct LibraryV0 *GfxBaseV0)
{
return GfxBaseV0;

View File

@ -6,4 +6,16 @@ struct ColorMapProxy
struct ColorMap *native;
};
struct LayerProxy
{
struct LayerV0 base;
struct Layer *native;
};
struct RegionProxy
{
struct RegionV0 base;
struct Region *native;
};
#endif

View File

@ -143,6 +143,56 @@ struct BitMapV0
APTR32 Planes[8];
};
struct LayerV0
{
APTR32 front;
APTR32 back;
APTR32 ClipRect;
APTR32 rp;
struct Rectangle bounds;
APTR32 parent; /* PRIVATE !!! */
UWORD priority;
UWORD Flags;
APTR32 SuperBitMap;
APTR32 SuperClipRect;
APTR32 Window;
WORD Scroll_X;
WORD Scroll_Y;
APTR32 cr;
APTR32 cr2;
APTR32 crnew;
APTR32 SuperSaveClipRects;
APTR32 _cliprects;
APTR32 LayerInfo;
struct SignalSemaphoreV0 Lock;
APTR32 BackFill;
APTR32 VisibleRegion; /* PRIVATE !!! */
APTR32 ClipRegion;
APTR32 saveClipRects;
WORD Width;
WORD Height;
APTR32 shape; /* PRIVATE !!! */
APTR32 shaperegion; /* PRIVATE !!! */
APTR32 visibleshape; /* PRIVATE !!! */
UWORD nesting; /* PRIVATE !!! */
UBYTE SuperSaveClipRectCounter; /* PRIVATE !!! */
UBYTE visible; /* PRIVATE !!! */
UBYTE reserved2[2];
APTR32 DamageList;
};
struct Layer_InfoV0
{
APTR32 top_layer;

View File

@ -174,23 +174,40 @@ struct WindowV0 *abiv0_OpenWindowTagList(APTR /*struct NewWindowV0 **/newWindow,
struct WindowProxy *proxy = abiv0_AllocMem(sizeof(struct WindowProxy), MEMF_CLEAR, Intuition_SysBaseV0);
struct RastPortV0 *rpv0 = abiv0_AllocMem(sizeof(struct RastPortV0), MEMF_CLEAR, Intuition_SysBaseV0);
*((IPTR *)&rpv0->longreserved) = (IPTR)wndnative->RPort;
proxy->native = wndnative;
*((IPTR *)&rpv0->longreserved) = (IPTR)proxy->native->RPort;
proxy->base.RPort = (APTR32)(IPTR)rpv0;
proxy->base.BorderLeft = wndnative->BorderLeft;
proxy->base.BorderTop = wndnative->BorderTop;
proxy->base.BorderRight = wndnative->BorderRight;
proxy->base.BorderBottom = wndnative->BorderBottom;
proxy->base.Width = wndnative->Width;
proxy->base.Height = wndnative->Height;
proxy->base.MaxHeight = wndnative->MaxHeight;
proxy->base.MinHeight = wndnative->MinHeight;
proxy->base.MaxWidth = wndnative->MaxWidth;
proxy->base.MinWidth = wndnative->MinWidth;
proxy->base.GZZHeight = wndnative->GZZHeight;
proxy->base.GZZWidth = wndnative->GZZWidth;
proxy->base.BorderLeft = proxy->native->BorderLeft;
proxy->base.BorderTop = proxy->native->BorderTop;
proxy->base.BorderRight = proxy->native->BorderRight;
proxy->base.BorderBottom = proxy->native->BorderBottom;
proxy->base.Width = proxy->native->Width;
proxy->base.Height = proxy->native->Height;
proxy->base.MaxHeight = proxy->native->MaxHeight;
proxy->base.MinHeight = proxy->native->MinHeight;
proxy->base.MaxWidth = proxy->native->MaxWidth;
proxy->base.MinWidth = proxy->native->MinWidth;
proxy->base.GZZHeight = proxy->native->GZZHeight;
proxy->base.GZZWidth = proxy->native->GZZWidth;
proxy->base.Flags = proxy->native->Flags;
proxy->native = wndnative;
struct LayerProxy *lproxy = abiv0_AllocMem(sizeof(struct LayerProxy), MEMF_CLEAR, Intuition_SysBaseV0);
lproxy->native = proxy->native->WLayer;
proxy->base.WLayer = (APTR32)(IPTR)lproxy;
if (proxy->native->WLayer == proxy->native->RPort->Layer)
{
((struct RastPortV0 *)(IPTR)proxy->base.RPort)->Layer = (APTR32)(IPTR)lproxy;
}
else
{
asm("int3");
}
g_v0window = &proxy->base;
g_nativewindow = wndnative;