63 SetDefDrawEnv(&env, rect->x, rect->y, rect->w, rect->h);
93 if (from != -1 && to != -1) {
112 u_long mask = 0xFFFFFF;
114 u_long *p = ot + layer->
otLen - 1;
119 if ((*p & mask) == ((u_long)q & mask)) {
120 while ((*q & mask) == ((u_long)(q - 1) & mask)) {
123 *p = (u_long)q & mask;
131 DRAWENV env = layer->
env;
146 SetDrawEnv(dr, &env);
297 for (i = 0; i < cap; i++) {
351 }
while (cb !=
NULL);
393 ClearOTagR(layer->
ot[0], layer->
otLen);
394 ClearOTagR(layer->
ot[1], layer->
otLen);
423 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000,
GfxState GFX
GFX: the graphics state and its methods.
#define LAYER_COUNT
The drawing layers GFX holds at most.
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
#define MEM_MODE
the current mode's: freed by main whenever the mode task ends
u_long * layerGetOtEntryZ(Layer *layer, s32 z)
Layer method: the OT entry for a 16-bit Z, scaled to the OT's length.
void layerLoadLightMatrix(Layer *layer)
Layer method: restores the light matrix that setKeepLightMatrix kept.
void layerClearOt(Layer *layer)
Layer method: clears the OT of the buffer being drawn.
void layerFree(Layer *layer)
Layer method: frees its OTs and draw callbacks, once the GPU is done with them.
void layerSetClipPos(LayerView *layer, s16 x, s16 y)
Layer method: moves the clip rectangle.
void layerSetOffset(LayerView *layer, s16 x, s16 y)
Layer method: the drawing offset.
void layerRunCallbacks(Layer *layer)
Layer method: runs the draw callbacks in order, then empties the list.
s32 findLayerSlot(s32 id)
The slot of the layer with this id; id 0 finds a free slot.
void layerSkipEmptyOt(Layer *layer)
Links every run of empty OT entries past itself, so the GPU skips it.
void layerAddCallback(Layer *layer, void(*func)(s32, void *, s32), s32 arg)
Layer method: adds a draw callback at the end of the list.
void insertLayerSlot(s32 index, Layer *layer, s32 id)
Puts a layer at position index of the draw order, moving the later ones back.
u_long * layerGetOtEntry(Layer *layer, s32 depth)
Layer method: the OT entry at depth in the buffer being drawn.
void layerDraw(Layer *layer)
Layer method: sends the OT of the finished buffer, after its DRAWENV with the layer's offset.
void layerSetClipSize(LayerView *layer, s16 w, s16 h)
Layer method: resizes the clip rectangle.
void layerGetScroll(LayerView *layer, Vec2 *out)
Layer method: the scroll position, in pixels.
void layerAddSortedCallback(Layer *layer, void(*func)(s32, void *, s32), s32 arg, s32 priority, s32 param)
Layer method: adds a draw callback in order of priority, highest first.
Layer * getLayer(s32 id)
The layer with id id, or NULL.
void layerSetScroll(LayerView *layer, s32 x, s32 y)
Layer method: sets the scroll position (8.8 fixed point)
void layerSetBgColor(LayerView *layer, u8 r, u8 g, u8 b)
Layer method: the color the layer's area is cleared to (black: not cleared).
u_long * layerGetOt(Layer *layer)
Layer method: the OT of the buffer being drawn.
void layerGetViewRect(LayerView *layer, Rect16 *rect)
Layer method: the part of the scrolled world the clip rectangle shows.
s32 destroyLayer(s32 id)
Frees the layer with id id; 0 if there is none.
s32 layerGetOtShift(LayerView *layer)
Layer method: the OT size it was created with.
void layerAllocCallbacks(Layer *layer, s32 count)
Layer method: room for count draw callbacks.
Layer * newLayer(DRAWENV *env, s32 otShift)
Allocates a layer with its two OTs and methods.
void layerSetKeepLightMatrix(Layer *layer, s32 enable)
Layer method: keeps the current light matrix for this buffer's drawing.
void layerResetCallbacks(Layer *layer)
Layer method: empties the draw callbacks, but for the head entry, which sorts first.
s16 OT_LENGTHS[]
A layer's ordering table length, by its otShift - 1.
Layer * createLayer(RECT *rect, s32 otShift, s32 id)
A new layer drawing to rect, with an OT of OT_LENGTHS[otShift - 1] entries; NULL when all are in use.
void layerAddScroll(LayerView *layer, s32 dx, s32 dy)
Layer method: scrolls by (dx, dy) (8.8 fixed point)
void layerSetKeepView(Layer *layer, s32 enable, s32 projection)
Layer method: keeps the current world-screen matrix and projection for this buffer's drawing.
void moveLayer(s32 id, s32 targetId, s32 delta)
Moves a layer to the position of another one (plus delta) in the draw order.
void removeLayerSlot(s32 index)
Closes the gap of a removed layer in the draw order.
void layerLoadView(Layer *layer)
Layer method: restores the view that setKeepView kept.
A function that a layer calls when it is drawn (Layer.addDrawCallback)
void(* func)(s32 arg, void *layer, s32 param)
struct DrawCallback * next
void * prim
next free byte of the packet buffer
s32 buffer
the one being drawn
struct Layer * layers[30]
void *(* alloc)(s32 size, s32 tag)
void *(* allocZeroed)(s32 size, s32 tag)
Layer as its clip/scroll methods see it: the clip rect as unsigned.
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
void(* loadLightMatrix)(struct Layer *)
void(* runCallbacks)(struct Layer *)
u_long *(* getOtEntry)(struct Layer *, s32 depth)
void(* setBgColor)()
no prototype: callers would truncate u8 args
void(* setOffset)()
no prototype: callers would truncate s16 args
void(* draw)(struct Layer *)
void(* loadView)(struct Layer *)
void(* clearOt)(struct Layer *)
void(* setClipSize)()
no prototype: callers would truncate s16 args
u_long *(* getOtEntryZ)(struct Layer *layer, s32 z)
void(* setKeepLightMatrix)()
void(* free)(struct Layer *)
void(* setClipPos)()
no prototype: callers would truncate s16 args
void(* addSortedCallback)()
u_long *(* getOt)(struct Layer *)