コード例 #1
0
IPTR MenuDecorClass__MDM_GETDEFSIZE_SYSIMAGE(Class *cl, Object *obj, struct mdpGetDefSizeSysImage *msg)
{

    switch(msg->mdp_Which)
    {
    	case SUBMENUIMAGE:
    	    *msg->mdp_Width = 0;
    	    *msg->mdp_Height = 0;
            struct  RastPort *rp = CreateRastPort();
            if (rp)
            {
                struct  TextExtent TextExt;
                SetFont(rp, msg->mdp_ReferenceFont);
                TextExtent(rp, ">>", 2, &TextExt);
                *msg->mdp_Width = TextExt.te_Width;
                *msg->mdp_Height = TextExt.te_Height;
                FreeRastPort(rp);
            }
	       break;

        case MENUCHECK:
            *msg->mdp_Width = REFWIDTH / 2 + 4; // reffont->tf_XSize * 3 / 2;
            *msg->mdp_Height= REFHEIGHT;
            break;

    	default:
	       *msg->mdp_Width = DEFSIZE_WIDTH;
	       *msg->mdp_Height = DEFSIZE_HEIGHT;
	       break;
    }

    return TRUE;
}
コード例 #2
0
ファイル: mesa3dgl_glasetrast.c プロジェクト: Kalamatee/mesa
      void glASetRast(

/*  SYNOPSIS */
      GLAContext ctx,
      struct TagItem * tagList)

/*  FUNCTION

        Sets a new rendering target for an existing context

    INPUTS

        ctx - 
        tagList - a pointer to tags to be used during creation.

    TAGS

        GLA_Window - pointer to Window onto which scene is to be rendered. Must
                     be provided.

    RESULT

        None

    BUGS

    INTERNALS

    HISTORY

*****************************************************************************/
{
    struct mesa3dgl_context * _ctx = (struct mesa3dgl_context *)ctx;

    D(bug("[MESA3DGL] %s()\n", __PRETTY_FUNCTION__));

    if (_ctx)
    {
        /* Check if at least one of window, rastport or screen have been passed */
        if ((GetTagData(GLA_Screen, 0, tagList) != 0) ||
            (GetTagData(GLA_Window, 0, tagList) != 0) ||
            (GetTagData(GLA_RastPort, 0, tagList) != 0))
        {
            /* If there already is visible_rp, free it */
            if (_ctx->visible_rp)
                FreeRastPort(_ctx->visible_rp);
            /* Do standard rast port selection */
            MESA3DGLSelectRastPort(_ctx, tagList);

            /* Do standard initialization */
            MESA3DGLStandardInit(_ctx, tagList); 

            /* TODO: what to do with visual and framebuffer, if BPP changes, we are in trouble */

            /* After the new render target has been attached, invoke framebuffer recalculation */
            MESA3DGLCheckAndUpdateBufferSize(_ctx);
        }
    }
}
コード例 #3
0
///ImageBackFill_CloseSourceBuffer()
static void ImageBackFill_CloseSourceBuffer(struct BackFillSourceImageRecord *this_Record, struct BackFillSourceImageBuffer *this_Buffer)
{
  D(bug("[IconWindow.ImageBackFill] ImageBackFill_CloseSourceBuffer()\n"));
  if (this_Buffer->bfsib_OpenerCount >= 2)
  {
    this_Buffer->bfsib_OpenerCount -= 1;
    D(bug("[IconWindow.ImageBackFill] ImageBackFill_CloseSourceBuffer: %d Openers Remaining\n", this_Buffer->bfsib_OpenerCount));
    return;
  }
  else
  {
    Remove((struct Node *)this_Buffer);
    this_Buffer->bfsib_OpenerCount = 0;
    D(bug("[IconWindow.ImageBackFill] ImageBackFill_CloseSourceBuffer: Closing Buffer [%d x %d] of '%s'\n", this_Buffer->bfsib_BitMapWidth, this_Buffer->bfsib_BitMapHeight, this_Record->bfsir_SourceImage));

    this_Buffer->bfsib_BitMapRastPort->BitMap = NULL;
    FreeRastPort(this_Buffer->bfsib_BitMapRastPort);
    FreeBitMap(this_Buffer->bfsib_BitMap);
    FreeMem(this_Buffer, sizeof(struct BackFillSourceImageBuffer));
  }
}
コード例 #4
0
ファイル: vc4galliumclass.c プロジェクト: Kalamatee/mesa
VOID METHOD(VC4Gallium, Hidd_Gallium, DisplayResource)
{
    struct RastPort * rp;

#if (0)
    OOP_GetAttr(o, aHidd_Gallium_WinSys, &vc4_ws);

    if (vc4_ws)
    {
        if ((data == NULL) && (spr->dt != NULL))
            data = vc4_ws->displaytarget_map(vc4_ws, spr->dt, 0);

        if (data)
        {
            rp = CreateRastPort();

            rp->BitMap = msg->bitmap;

            WritePixelArray(
                data, 
                msg->srcx,
                msg->srcy,
                spr->stride[0],
                rp, 
                msg->dstx, 
                msg->dsty, 
                msg->width, 
                msg->height, 
                AROS_PIXFMT);

            FreeRastPort(rp);
        }

        if ((spr->data == NULL) && (data != NULL))
            vc4_ws->displaytarget_unmap(vc4_ws, spr->dt);
    }
#endif
}
コード例 #5
0
IPTR Prop__OM_DISPOSE(struct IClass *cl, Object *obj, Msg msg)
{
    struct Prop_DATA *data = INST_DATA(cl, obj);

    if (data->prop_object && !data->usewinborder) {
        RemoveGadget(_window(obj), (struct Gadget *) data->prop_object);
        DisposeObject(data->prop_object);
    }

    DisposeImageContainer(data->buffer);
    DisposeImageContainer(data->temp);
    if (data->mapbuffer != NULL) FreeBitMap(data->mapbuffer);
    if (data->maptemp != NULL) FreeBitMap(data->maptemp);
    if (data->tmprp != NULL) FreeRastPort(data->tmprp);

    data->buffer = NULL;
    data->temp = NULL;
    data->mapbuffer = NULL;
    data->maptemp = NULL;
    data->tmprp = NULL;

    return DoSuperMethodA(cl, obj, msg);
}
コード例 #6
0
///ImageBackFill_CloseSourceRecord()
static void ImageBackFill_CloseSourceRecord(struct BackFillSourceImageRecord *this_Record)
{
  D(bug("[IconWindow.ImageBackFill] ImageBackFill_CloseSourceRecord()\n"));
  if (this_Record->bfsir_OpenerCount >= 2)
  {
    this_Record->bfsir_OpenerCount -= 1;
    D(bug("[IconWindow.ImageBackFill] ImageBackFill_CloseSourceRecord: %d Openers Remaining for '%s'\n", this_Record->bfsir_OpenerCount, this_Record->bfsir_SourceImage));
    return;
  }
  else
  {
    Remove((struct Node *)this_Record);
    this_Record->bfsir_OpenerCount = 0;

    D(bug("[IconWindow.ImageBackFill] ImageBackFill_CloseSourceRecord: Closing Record for '%s'\n", this_Record->bfsir_SourceImage));

    this_Record->bfsir_DTRastPort->BitMap = NULL;
    FreeRastPort(this_Record->bfsir_DTRastPort);
    DisposeDTObject(this_Record->bfsir_DTPictureObject);
    FreeVec(this_Record->bfsir_SourceImage);
    FreeMem(this_Record, sizeof(struct BackFillSourceImageRecord));
  }
}
コード例 #7
0
ファイル: showvisregion.c プロジェクト: michalsc/AROS
static void Action(void)
{
    struct RastPort *rp;
    struct Region *reg;
    struct RegionRectangle *rr;
    WORD x, y, i, count = 0;
    
    puts("Activate the window whose visible region you want to see.\n");
    puts("You have 3 seconds of time!\n\n");
    
    Delay(3*50);

    win = IntuitionBase->ActiveWindow;
    scr = win->WScreen;
    
    if (!win) Cleanup("No active window!");
    
    if (!(rp = CloneRastPort(&win->WScreen->RastPort)))
    {
    	Cleanup("Can´t clone screen rastport!");
    }
    SetDrMd(rp,JAM1);
    
    lay = win->WLayer;
    
    reg = lay->VisibleRegion;
    rr = reg->RegionRectangle;
    while(rr)
    {
        WORD x1 = reg->bounds.MinX + rr->bounds.MinX;
        WORD y1 = reg->bounds.MinY + rr->bounds.MinY;
        WORD x2 = reg->bounds.MinX + rr->bounds.MaxX;
        WORD y2 = reg->bounds.MinY + rr->bounds.MaxY;
	
    	printf("#%04d (%4d,%4d) - (%4d, %4d)  Size: %4d x %4d\n",
		++count,
		x1,
		y1,
		x2,
		y2,
		x2 - x1 + 1,
		y2 - y1 + 1);
		
	for(i = 0; i < (Args[ARG_FAST] ? 1 : 8);i++)
	{
	    SetAPen(rp,1 + (i & 1));
	    RectFill(rp,x1,y1,x2,y1);
	    RectFill(rp,x2,y1,x2,y2);
	    RectFill(rp,x1,y2,x2,y2);
	    RectFill(rp,x1,y1,x1,y2);
	    
	    if (!Args[ARG_FAST]) Delay(10);
	}
	
	if (Args[ARG_NUMBERS])
	{
	    sprintf(s,"%d",count);
	    i = TextLength(rp,s,strlen(s));
	    
	    x = (x1 + x2 - i) / 2;
	    y = (y1 + y2 - rp->TxHeight) / 2;
	    
	    if (x < 0)
	    {
	    	x = 0;
	    } else if (x >= scr->Width - i)
	    {
	    	x = scr->Width - i - 1;
	    }
	  
	    if (y < 0)
	    {
	    	y = 0;
	    } else if (y >= scr->Height - rp->TxHeight)
	    {
	    	y = scr->Height - rp->TxHeight - 1;
	    }
	    
	    i = strlen(s);
	    
	    SetAPen(rp,1);
	    Move(rp,x + 1, y + 1 + rp->TxBaseline);
	    Text(rp,s,i);
	    
	    SetAPen(rp,2);
	    Move(rp,x, y + rp->TxBaseline);
	    Text(rp,s,i);
	}
    	rr = rr->Next;
    }
    
    FreeRastPort(rp);
}
コード例 #8
0
ファイル: DamageList.c プロジェクト: michalsc/AROS
static void Action(void)
{
    struct RastPort *rp;
    struct Region *dr;
    struct RegionRectangle *rr;
    WORD x, y, x1, y1, x2, y2, i, count = 0;
    
    PutStr("Activate the window whose damagelist you want to see.\n");
    PutStr("You have 3 seconds of time!\n\n");
    
    Delay(3*50);

    win = IntuitionBase->ActiveWindow;
    if (!win) Cleanup("No active window!");

    scr = win->WScreen;

    lay = win->WLayer;

    dr = lay->DamageList;
    if (!dr) Cleanup("Layer does not have a damagelist!");
    rr = dr->RegionRectangle;
    if (!rr) Cleanup("Damagelist is empty!");
    
    if (!(rp = CloneRastPort(&win->WScreen->RastPort)))
    {
    	Cleanup("Can´t clone screen rastport!");
    }
    SetDrMd(rp,JAM1);
    
    while(rr)
    {
    	x1 = lay->bounds.MinX + dr->bounds.MinX + rr->bounds.MinX;
	y1 = lay->bounds.MinY + dr->bounds.MinY + rr->bounds.MinY;
	x2 = lay->bounds.MinX + dr->bounds.MinX + rr->bounds.MaxX;
	y2 = lay->bounds.MinY + dr->bounds.MinY + rr->bounds.MaxY;

    	Printf("#%04d (%4d,%4d) - (%4d, %4d)  Size: %4d x %4d\n",
		++count,
		x1,
		y1,
		x2,
		y2,
		x2 - x1 + 1,
		y2 - y1 + 1);

	
	for(i = 0; i < (Args[ARG_FAST] ? 1 : 8);i++)
	{
	    SetAPen(rp,1 + (i & 1));
	    
	    if (Args[ARG_RECTFILL])
	    {
	    	RectFill(rp,x1,y1,x2,y2);
	    } else {
		RectFill(rp,x1,y1,x2,y1);
		RectFill(rp,x2,y1,x2,y2);
		RectFill(rp,x1,y2,x2,y2);
		RectFill(rp,x1,y1,x1,y2);
	    }
	    
	    if (!Args[ARG_FAST]) Delay(10);
	}
	
	if (Args[ARG_NUMBERS])
	{
	    __sprintf(s,"%d",count);
	    i = TextLength(rp,s,strlen(s));
	    
	    x = (x1 + x2 - i) / 2;
	    y = (y1 + y2 - rp->TxHeight) / 2;
	    
	    if (x < 0)
	    {
	    	x = 0;
	    } else if (x >= scr->Width - i)
	    {
	    	x = scr->Width - i - 1;
	    }
	  
	    if (y < 0)
	    {
	    	y = 0;
	    } else if (y >= scr->Height - rp->TxHeight)
	    {
	    	y = scr->Height - rp->TxHeight - 1;
	    }
	    
	    i = strlen(s);
	    
	    SetAPen(rp,1);
	    Move(rp,x + 1, y + 1 + rp->TxBaseline);
	    Text(rp,s,i);
	    
	    SetAPen(rp,2);
	    Move(rp,x, y + rp->TxBaseline);
	    Text(rp,s,i);
	}
    	rr = rr->Next;
    }
    
    FreeRastPort(rp);
}