Exemplo n.º 1
0
// this function blits the given buffer using our blit type method
inline void BlitBuffer(PtWidget_t *win,CoolImage *i)
{
	// For blit type 0, we use PgDrawImagemx(). We have to make sure 
	// to set the region to the windows region first.  Don't forget
	// to flush! :)
	if (blittype==0 || blittype==1)
	{
		PhPoint_t pos={0,0};
		PhDim_t size;
		
		//size.w = 768;
		size.w = m_W;
		size.h = m_H;
		//size.h = 576;

		PgSetRegion(PtWidgetRid(win)); 
		//PgDrawImagemx(i->buffer,Pg_IMAGE_DIRECT_565,&pos,&size,i->pitch,0);
		PgDrawImagemx(i->buffer,Pg_IMAGE_DIRECT_888,&pos,&size,i->pitch,0);

		PgFlush();
	}else
    if (blittype == 2)
	{
		PhRect_t r={{0,0},{i->width,i->height}};
		PgSetRegion(PtWidgetRid(win));
		PgContextBlit(i->ctx,&r,NULL,&r);
		PgFlush();
	}

}
Exemplo n.º 2
0
void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects)
{
    int i;

    PhPoint_t zero = {0};
    PhArea_t src_rect;
    PhArea_t dest_rect;

    PgSetRegion(PtWidgetRid(window));
    PgSetClipping(0, NULL);
    PgWaitHWIdle();

    for (i=0; i<numrects; ++i)
    {
        if (rects[i].w == 0)  /* Clipped? */
        {
            continue;
        }

        if (rects[i].h == 0)  /* Clipped? */
        {
            continue;
        }

        src_rect.pos.x=rects[i].x;
        src_rect.pos.y=rects[i].y;
        dest_rect.pos.x=rects[i].x;
        dest_rect.pos.y=rects[i].y;

        src_rect.size.w=rects[i].w;
        src_rect.size.h=rects[i].h;
        dest_rect.size.w=rects[i].w;
        dest_rect.size.h=rects[i].h;

        zero.x = 0;
        zero.y = 0;
        PgSetTranslation(&zero, 0);
        PgSetRegion(PtWidgetRid(window));
        PgSetClipping(0, NULL);
        PgContextBlitArea(OCImage.offscreen_context, &src_rect, NULL, &dest_rect);
    }

    if (PgFlush() < 0)
    {
        SDL_SetError("ph_OCUpdate(): PgFlush failed.\n");
    }
}
Exemplo n.º 3
0
static int ph_GL_MakeCurrent(_THIS)
{
    PgSetRegion(PtWidgetRid(window));

    if (oglctx!=NULL)
    {
        PhDCSetCurrent(oglctx);
    }

    return 0;
}
Exemplo n.º 4
0
int ph_GL_MakeCurrent(_THIS)
{
    PgSetRegion(PtWidgetRid(window));

    if (oglctx!=NULL)
    {
        if (qnxgl_set_current(oglctx) == -1)
        {
           return -1;
        }
    }

    return 0;
}
Exemplo n.º 5
0
void ph_window_refresh_screen (void)
{
	PhArea_t sarea, darea;
	
//	fprintf(stderr,"refresh screen\n");
	switch (ph_window_update_method)
	{
		case PH_NORMAL:
			sarea.pos.x=sarea.pos.y=darea.pos.x=darea.pos.y=0;
			sarea.size.w=darea.size.w=image->dim.w;
			sarea.size.h=darea.size.h=image->dim.h;
			
			PgSetRegion(PtWidgetRid(P_mainWindow));
			PgSetClipping (0,NULL);
			PgContextBlitArea (image,&sarea,NULL,&darea);
		break;
	}
}
Exemplo n.º 6
0
INLINE void ph_window_put_image (int x, int y, int width, int height)
{
	PhArea_t sarea, darea;


	switch (ph_window_update_method)
	{
		case PH_NORMAL:
			sarea.pos.x=x; sarea.pos.y=y;
			sarea.size.w=darea.size.w=width;
			sarea.size.h=darea.size.h=height;
			darea.pos.x=x+startx; darea.pos.y=y+starty;

			PgSetRegion(PtWidgetRid(P_mainWindow));
			PgSetClipping (0,NULL);
			PgContextBlitArea (image,&sarea,NULL,&darea);
		break;
	}
}
Exemplo n.º 7
0
/*****************************************************************************
 * QNXDisplay: displays previously rendered output
 *****************************************************************************
 * This function send the currently rendered image to QNX server, wait until
 * it is displayed and switch the two rendering buffer, preparing next frame.
 *****************************************************************************/
static void QNXDisplay( vout_thread_t *p_vout, picture_t *p_pic )
{
    if( p_vout->p_sys->i_mode == MODE_NORMAL_MEM ||
        p_vout->p_sys->i_mode == MODE_SHARED_MEM )
    {
        PhPoint_t pos = { 0, 0 };

        PgSetRegion( PtWidgetRid( p_vout->p_sys->p_window ) );
        if (p_vout->p_sys->i_screen_depth == 8)
        {
            PgSetPalette( p_vout->p_sys->p_colors, 0, 0, 255, Pg_PALSET_SOFT, 0);
        }
        PgDrawPhImagemx( &pos, p_pic->p_sys->p_image, 0 );
        PgFlush();
    }
    else if( p_vout->p_sys->i_mode == MODE_VIDEO_MEM )
    {
        PhRect_t rc = { { 0, 0 }, { p_vout->output.i_width, p_vout->output.i_height } };

//        PgSetRegion( PtWidgetRid ( p_vout->p_sys->p_window ) );
        PgContextBlit( p_pic->p_sys->p_ctx[0], &rc, NULL, &rc );
        PgFlush();
    }
}
Exemplo n.º 8
0
static void ph_GL_SwapBuffers(_THIS)
{
    PgSetRegion(PtWidgetRid(window));
    PdOpenGLContextSwapBuffers(oglctx);
}