static struct RectNode *allocrectnode(TAPTR exec, TINT x0, TINT y0, TINT x1, TINT y1) { struct RectNode *rn = TExecAlloc(exec, TNULL, sizeof(struct RectNode)); if (rn) { TDBPRINTF(TDB_TRACE,("allocrect: %08x\n", rn)); rn->rn_Rect[0] = x0; rn->rn_Rect[1] = y0; rn->rn_Rect[2] = x1; rn->rn_Rect[3] = y1; rn->rn_Flags = 0; } return rn; }
LOCAL void dfb_allocpen(DFBDISPLAY *mod, struct TVRequest *req) { DFBWINDOW *v = req->tvr_Op.AllocPen.Window; TUINT rgb = req->tvr_Op.AllocPen.RGB; struct DFBPen *pen = TExecAlloc(mod->dfb_ExecBase, mod->dfb_MemMgr, sizeof(struct DFBPen)); if (pen) { pen->a = rgb >> 24; pen->r = ((rgb >> 16) & 0xff); pen->g = ((rgb >> 8) & 0xff); pen->b = rgb & 0xff; TAddTail(&v->penlist, &pen->node); req->tvr_Op.AllocPen.Pen = (TVPEN) pen; return; } req->tvr_Op.AllocPen.Pen = TVPEN_UNDEFINED; }
TLIBAPI TAPTR TNewInstance(TAPTR mod, TUINT possize, TUINT negsize) { TAPTR exec = TGetExecBase(mod); TAPTR inst = TExecAlloc(exec, TNULL, possize + negsize); if (inst) { TUINT size = TMIN(((struct TModule *) mod)->tmd_NegSize, negsize); inst = (TINT8 *) inst + negsize; if (size > 0) TExecCopyMem(exec, (TINT8 *) mod - size, (TINT8 *) inst - size, size); size = TMIN(((struct TModule *) mod)->tmd_PosSize, possize); TExecCopyMem(exec, mod, inst, size); ((struct TModule *) inst)->tmd_PosSize = possize; ((struct TModule *) inst)->tmd_NegSize = negsize; ((struct TModule *) inst)->tmd_InitTask = TExecFindTask(exec, TNULL); } return inst; }
static struct RectNode *region_allocrectnode(struct RectPool *pool, TINT x0, TINT y0, TINT x1, TINT y1) { struct TNode *temp; struct RectNode *rn = (struct RectNode *) TREMHEAD(&pool->p_Rects.rl_List, temp); if (rn) { pool->p_Rects.rl_NumNodes--; assert(pool->p_Rects.rl_NumNodes >= 0); } else rn = TExecAlloc(pool->p_ExecBase, TNULL, sizeof(struct RectNode)); if (rn) { rn->rn_Rect[0] = x0; rn->rn_Rect[1] = y0; rn->rn_Rect[2] = x1; rn->rn_Rect[3] = y1; } return rn; }