コード例 #1
0
DFBResult
IGraphicsState_Real__Blit(
    CoreGraphicsState                         *obj,
    const DFBRectangle                        *rects,
    const DFBPoint                            *points,
    u32                                        num
)
{
    D_DEBUG_AT( DirectFB_CoreGraphicsState, "%s()\n", __FUNCTION__ );

    D_ASSERT( rects != NULL );
    D_ASSERT( points != NULL );

    if (!obj->state.destination || !obj->state.source)
        return DFB_NOCONTEXT;

    if ((obj->state.blittingflags & (DSBLIT_SRC_MASK_ALPHA | DSBLIT_SRC_MASK_COLOR)) && !obj->state.source_mask)
        return DFB_NOCONTEXT;

    // FIXME: remove casts
    if (num > 1)
        dfb_gfxcard_batchblit( (DFBRectangle*) rects, (DFBPoint*) points, num, &obj->state );
    else
        dfb_gfxcard_blit( (DFBRectangle*) rects, ((DFBPoint*)points)->x, ((DFBPoint*)points)->y, &obj->state );

    return DFB_OK;
}
コード例 #2
0
DFBResult
CoreGraphicsStateClient_Blit( CoreGraphicsStateClient *client,
                              const DFBRectangle      *rects,
                              const DFBPoint          *points,
                              unsigned int             num )
{
     D_DEBUG_AT( Core_GraphicsStateClient, "%s( client %p )\n", __FUNCTION__, client );

     D_MAGIC_ASSERT( client, CoreGraphicsStateClient );
     D_ASSERT( rects != NULL );
     D_ASSERT( points != NULL );

     if (dfb_core_is_master( client->core ) || !fusion_config->secure_fusion) {
          // FIXME: will overwrite rects, points
          if (num > 1)
               dfb_gfxcard_batchblit( (DFBRectangle*) rects, (DFBPoint*) points, num, client->state );
          else
               dfb_gfxcard_blit( (DFBRectangle*) rects, ((DFBPoint*)points)->x, ((DFBPoint*)points)->y, client->state );
     }
     else {
          DFBResult ret;

          CoreGraphicsStateClient_Update( client, DFXL_BLIT, client->state );

          ret = CoreGraphicsState_Blit( client->gfx_state, rects, points, num );
          if (ret)
               return ret;
     }

     return DFB_OK;
}
コード例 #3
0
DFBResult
CoreGraphicsStateClient_Blit( CoreGraphicsStateClient *client,
                              const DFBRectangle      *rects,
                              const DFBPoint          *points,
                              unsigned int             num )
{
     D_DEBUG_AT( Core_GraphicsStateClient, "%s( client %p )\n", __FUNCTION__, client );

     D_MAGIC_ASSERT( client, CoreGraphicsStateClient );
     D_ASSERT( rects != NULL );
     D_ASSERT( points != NULL );

     if (!dfb_config->call_nodirect && (dfb_core_is_master( client->core ) || !fusion_config->secure_fusion)) {
          // FIXME: will overwrite rects, points
          dfb_gfxcard_batchblit( (DFBRectangle*) rects, (DFBPoint*) points, num, client->state );
     }
     else {
          DFBResult    ret;
          unsigned int i;

          CoreGraphicsStateClient_Update( client, DFXL_BLIT, client->state );

          for (i=0; i<num; i+=200) {
               ret = CoreGraphicsState_Blit( client->gfx_state, &rects[i], &points[i], MIN(200, num-i) );
               if (ret)
                    return ret;
          }
     }

     return DFB_OK;
}
コード例 #4
0
ファイル: util.c プロジェクト: ecbtnrt/my-dfb
void
dfb_gfx_copy_regions( CoreSurface           *source,
                      CoreSurfaceBufferRole  from,
                      CoreSurface           *destination,
                      CoreSurfaceBufferRole  to,
                      const DFBRegion       *regions,
                      unsigned int           num,
                      int                    x,
                      int                    y )
{
     unsigned int i, n = 0;
     DFBRectangle rect = { 0, 0, source->config.size.w, source->config.size.h };
     DFBRectangle rects[num];
     DFBPoint     points[num];

     for (i=0; i<num; i++) {
          DFB_REGION_ASSERT( &regions[i] );

          rects[n] = DFB_RECTANGLE_INIT_FROM_REGION( &regions[i] );

          if (dfb_rectangle_intersect( &rects[n], &rect )) {
               points[n].x = x + rects[n].x - rect.x;
               points[n].y = y + rects[n].y - rect.y;

               n++;
          }
     }

     if (n > 0) {
          pthread_mutex_lock( &copy_lock );

          if (!copy_state_inited) {
               dfb_state_init( &copy_state, NULL );
               copy_state_inited = true;
          }

          copy_state.modified   |= SMF_CLIP | SMF_SOURCE | SMF_DESTINATION;

          copy_state.clip.x2     = destination->config.size.w - 1;
          copy_state.clip.y2     = destination->config.size.h - 1;
          copy_state.source      = source;
          copy_state.destination = destination;
          copy_state.from        = from;
          copy_state.to          = to;

          dfb_gfxcard_batchblit( rects, points, n, &copy_state );
     
          /* Signal end of sequence. */
          dfb_state_stop_drawing( &copy_state );

          pthread_mutex_unlock( &copy_lock );
     }
}
コード例 #5
0
DFBResult
CoreGraphicsStateClient_StretchBlit( CoreGraphicsStateClient *client,
                                     const DFBRectangle      *srects,
                                     const DFBRectangle      *drects,
                                     unsigned int             num )
{
     D_DEBUG_AT( Core_GraphicsStateClient, "%s( client %p )\n", __FUNCTION__, client );

     D_MAGIC_ASSERT( client, CoreGraphicsStateClient );
     D_ASSERT( srects != NULL );
     D_ASSERT( drects != NULL );

     if (num == 0)
          return DFB_OK;

     if (!dfb_config->call_nodirect && (dfb_core_is_master( client->core ) || !fusion_config->secure_fusion)) {
          if (num == 1 && srects[0].w == drects[0].w && srects[0].h == drects[0].h) {
               DFBPoint point = { drects[0].x, drects[0].y };

               // FIXME: will overwrite rects, points
               dfb_gfxcard_batchblit( (DFBRectangle*) srects, &point, 1, client->state );
          }
          else {
               // FIXME: will overwrite rects
               dfb_gfxcard_batchstretchblit( (DFBRectangle*) srects, (DFBRectangle*) drects, num, client->state );
          }
     }
     else {
          DFBResult ret;

          if (num == 1 && srects[0].w == drects[0].w && srects[0].h == drects[0].h) {
               CoreGraphicsStateClient_Update( client, DFXL_BLIT, client->state );

               DFBPoint point = { drects[0].x, drects[0].y };
               ret = CoreGraphicsState_Blit( client->gfx_state, srects, &point, 1 );
               if (ret)
                    return ret;
          }
          else {
               CoreGraphicsStateClient_Update( client, DFXL_STRETCHBLIT, client->state );
     
               ret = CoreGraphicsState_StretchBlit( client->gfx_state, srects, drects, num );
               if (ret)
                    return ret;
          }
     }

     return DFB_OK;
}