예제 #1
0
void
dfb_gfx_clear( CoreSurface *surface, CoreSurfaceBufferRole role )
{
     DFBRectangle rect = { 0, 0, surface->config.size.w, surface->config.size.h };

     StateClient *client = state_client_tls.Get();

     D_FLAGS_SET( client->state.modified, SMF_CLIP | SMF_COLOR | SMF_DESTINATION | SMF_TO );

     client->state.clip.x2     = surface->config.size.w - 1;
     client->state.clip.y2     = surface->config.size.h - 1;
     client->state.destination = surface;
     client->state.to          = role;
     client->state.to_eye      = DSSE_LEFT;
     client->state.color.a     = 0;
     client->state.color.r     = 0;
     client->state.color.g     = 0;
     client->state.color.b     = 0;
     client->state.color_index = 0;

     CoreGraphicsStateClient_FillRectangles( &client->client, &rect, 1 );

     CoreGraphicsStateClient_Flush( &client->client, 0, CGSCFF_NONE );

     /* Signal end of sequence. */
     dfb_state_stop_drawing( &client->state );

     client->state.destination = NULL;
}
예제 #2
0
const char *
String::CopyTLS()
{
    StringTLS *tls = string_tls.Get( NULL );
    D_ASSERT( tls != NULL );

    return tls->Copy( *this );
}
예제 #3
0
void
dfb_gfx_copy_regions_stereo( CoreSurface           *source,
                             CoreSurfaceBufferRole  from,
                             DFBSurfaceStereoEye    source_eye,
                             CoreSurface           *destination,
                             CoreSurfaceBufferRole  to,
                             DFBSurfaceStereoEye    destination_eye,
                             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];

     D_ASSERT( !dfb_config->task_manager );

     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) {
          StateClient *client = state_client_tls.Get();

          D_FLAGS_SET( client->state.modified, SMF_CLIP | SMF_SOURCE | SMF_DESTINATION | SMF_FROM | SMF_TO );

          client->state.clip.x2     = destination->config.size.w - 1;
          client->state.clip.y2     = destination->config.size.h - 1;
          client->state.source      = source;
          client->state.destination = destination;
          client->state.from        = from;
          client->state.from_eye    = source_eye;
          client->state.to          = to;
          client->state.to_eye      = destination_eye;

          CoreGraphicsStateClient_Blit( &client->client, rects, points, n );

          CoreGraphicsStateClient_Flush( &client->client, 0, CGSCFF_NONE );

          /* Signal end of sequence. */
          dfb_state_stop_drawing( &client->state );

          client->state.destination = NULL;
          client->state.source      = NULL;
     }
}
예제 #4
0
namespace Direct {

class StringTLS
{
    friend class Direct::TLSObject2<StringTLS>;

    static StringTLS *create( void *ctx, void *params )
    {
        return new StringTLS();
    }

    static void destroy( void *ctx, StringTLS *tls )
    {
        delete tls;
    }

    StringTLS()
        :
        strings_index( 0 )
    {

    }

public:
    String       strings[0x20];
    unsigned int strings_index;

    const char *
    Copy( const Direct::String &string )
    {
        strings[strings_index & 0x1f] = string;

        return strings[strings_index++ & 0x1f].buffer();
    }
};

static Direct::TLSObject2<StringTLS> string_tls;

template <>
const char *
String::CopyTLS()
{
    StringTLS *tls = string_tls.Get( NULL );
    D_ASSERT( tls != NULL );

    return tls->Copy( *this );
}

}
예제 #5
0
void
dfb_gfx_copy_stereo( CoreSurface         *source,
                     DFBSurfaceStereoEye  source_eye,
                     CoreSurface         *destination,
                     DFBSurfaceStereoEye  destination_eye,
                     const DFBRectangle  *rect,
                     int                  x,
                     int                  y,
                     bool                 from_back )
{
     DFBRectangle sourcerect = { 0, 0, source->config.size.w, source->config.size.h };

     StateClient *client = state_client_tls.Get();

     D_FLAGS_SET( client->state.modified, SMF_CLIP | SMF_SOURCE | SMF_DESTINATION | SMF_FROM | SMF_TO );

     client->state.clip.x2     = destination->config.size.w - 1;
     client->state.clip.y2     = destination->config.size.h - 1;
     client->state.source      = source;
     client->state.destination = destination;
     client->state.from        = from_back ? CSBR_BACK : CSBR_FRONT;
     client->state.from_eye    = source_eye;
     client->state.to          = CSBR_BACK;
     client->state.to_eye      = destination_eye;

     if (rect) {
          if (dfb_rectangle_intersect( &sourcerect, rect )) {
               DFBPoint point = { x + sourcerect.x - rect->x, y + sourcerect.y - rect->y };

               CoreGraphicsStateClient_Blit( &client->client, &sourcerect, &point, 1 );
          }
     }
     else {
          DFBPoint point = { x, y };

          CoreGraphicsStateClient_Blit( &client->client, &sourcerect, &point, 1 );
     }

     CoreGraphicsStateClient_Flush( &client->client, 0, CGSCFF_NONE );

     /* Signal end of sequence. */
     dfb_state_stop_drawing( &client->state );

     client->state.destination = NULL;
     client->state.source      = NULL;
}
예제 #6
0
void dfb_gfx_stretch_stereo( CoreSurface         *source,
                             DFBSurfaceStereoEye  source_eye,
                             CoreSurface         *destination,
                             DFBSurfaceStereoEye  destination_eye,
                             const DFBRectangle  *srect,
                             const DFBRectangle  *drect,
                             bool                 from_back )
{
     DFBRectangle sourcerect = { 0, 0, source->config.size.w, source->config.size.h };
     DFBRectangle destrect =   { 0, 0, destination->config.size.w, destination->config.size.h };

     D_ASSERT( !dfb_config->task_manager );

     if (srect) {
          if (!dfb_rectangle_intersect( &sourcerect, srect ))
               return;
     }

     if (drect) {
          if (!dfb_rectangle_intersect( &destrect, drect ))
               return;
     }

     StateClient *client = state_client_tls.Get();

     D_FLAGS_SET( client->state.modified, SMF_CLIP | SMF_SOURCE | SMF_DESTINATION | SMF_FROM | SMF_TO );

     client->state.clip.x2     = destination->config.size.w - 1;
     client->state.clip.y2     = destination->config.size.h - 1;
     client->state.source      = source;
     client->state.destination = destination;
     client->state.from        = from_back ? CSBR_BACK : CSBR_FRONT;
     client->state.from_eye    = source_eye;
     client->state.to          = CSBR_BACK;
     client->state.to_eye      = destination_eye;

     CoreGraphicsStateClient_StretchBlit( &client->client, &sourcerect, &destrect, 1 );

     CoreGraphicsStateClient_Flush( &client->client, 0, CGSCFF_NONE );

     /* Signal end of sequence. */
     dfb_state_stop_drawing( &client->state );

     client->state.destination = NULL;
     client->state.source      = NULL;
}
예제 #7
0
static void
back_to_front_copy( CoreSurface             *surface,
                    DFBSurfaceStereoEye      eye,
                    const DFBRegion         *region,
                    DFBSurfaceBlittingFlags  flags,
                    int                      rotation)
{
     DFBRectangle  rect;
     DFBPoint      point;
     StateClient  *client = state_client_tls.Get();


     if (region) {
          rect.x = region->x1;
          rect.y = region->y1;
          rect.w = region->x2 - region->x1 + 1;
          rect.h = region->y2 - region->y1 + 1;
     }
     else {
          rect.x = 0;
          rect.y = 0;
          rect.w = surface->config.size.w;
          rect.h = surface->config.size.h;
     }

     point.x = rect.x;
     point.y = rect.y;

     if (rotation == 90) {
          point.x = rect.y;
          point.y = surface->config.size.w - rect.w - rect.x;

          D_FLAGS_SET( flags, DSBLIT_ROTATE90 );
     }
     else if (rotation == 180) {
          point.x = surface->config.size.w - rect.w - rect.x;
          point.y = surface->config.size.h - rect.h - rect.y;

          D_FLAGS_SET( flags, DSBLIT_ROTATE180 );
     }
     else if (rotation == 270) {
          point.x = surface->config.size.h - rect.h - rect.y;
          point.y = rect.x;

          D_FLAGS_SET( flags, DSBLIT_ROTATE270 );
     }

     D_FLAGS_SET( client->state.modified, SMF_CLIP | SMF_SOURCE | SMF_DESTINATION | SMF_FROM | SMF_TO );

     client->state.clip.x2       = surface->config.size.w - 1;
     client->state.clip.y2       = surface->config.size.h - 1;
     client->state.source        = surface;
     client->state.destination   = surface;
     client->state.from          = CSBR_BACK;
     client->state.from_eye      = eye;
     client->state.to            = CSBR_FRONT;
     client->state.to_eye        = eye;
     client->state.blittingflags = flags;

     CoreGraphicsStateClient_Blit( &client->client, &rect, &point, 1 );

     CoreGraphicsStateClient_Flush( &client->client, 0, CGSCFF_FOLLOW_READER );

     /* Signal end of sequence. */
     dfb_state_stop_drawing( &client->state );

     client->state.destination = NULL;
     client->state.source      = NULL;
}
예제 #8
0
void
dfb_gfx_copy_regions_client( CoreSurface             *source,
                             CoreSurfaceBufferRole    from,
                             DFBSurfaceStereoEye      source_eye,
                             CoreSurface             *destination,
                             CoreSurfaceBufferRole    to,
                             DFBSurfaceStereoEye      destination_eye,
                             const DFBRegion         *regions,
                             unsigned int             num,
                             int                      x,
                             int                      y,
                             CoreGraphicsStateClient *_client )
{
     unsigned int             i, n = 0;
     DFBRectangle             rect = { 0, 0, source->config.size.w, source->config.size.h };
     DFBRectangle             rects[num];
     DFBPoint                 points[num];
     CoreGraphicsStateClient *client = _client ? _client : &state_client_tls.Get()->client;
     CardState               *state  = client->state;
     CardState                backup;

     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;
               points[n].y = y + rects[n].y;

               n++;
          }
     }

     if (n > 0) {
          backup.clip          = state->clip;
          backup.source        = state->source;
          backup.destination   = state->destination;
          backup.from          = state->from;
          backup.from_eye      = state->from_eye;
          backup.to            = state->to;
          backup.to_eye        = state->to_eye;
          backup.blittingflags = state->blittingflags;


          D_FLAGS_SET( state->modified, SMF_CLIP | SMF_SOURCE | SMF_DESTINATION | SMF_FROM | SMF_TO | SMF_BLITTING_FLAGS );

          state->clip.x1     = 0;
          state->clip.y1     = 0;
          state->clip.x2     = destination->config.size.w - 1;
          state->clip.y2     = destination->config.size.h - 1;
          state->source      = source;
          state->destination = destination;
          state->from        = from;
          state->from_eye    = source_eye;
          state->to          = to;
          state->to_eye      = destination_eye;
          state->blittingflags = DSBLIT_NOFX;

          CoreGraphicsStateClient_Blit( client, rects, points, n );

          if (!_client)
               CoreGraphicsStateClient_Flush( client, 0, CGSCFF_NONE );

          D_FLAGS_SET( state->modified, SMF_CLIP | SMF_SOURCE | SMF_DESTINATION | SMF_FROM | SMF_TO | SMF_BLITTING_FLAGS );

          state->clip          = backup.clip;
          state->source        = backup.source;
          state->destination   = backup.destination;
          state->from          = backup.from;
          state->from_eye      = backup.from_eye;
          state->to            = backup.to;
          state->to_eye        = backup.to_eye;
          state->blittingflags = backup.blittingflags;
     }
}
예제 #9
0
void
dfb_gfx_cleanup()
{
     state_client_tls.DeleteAll();
}
예제 #10
0
void
dfb_gfx_init_tls()
{
     state_client_tls.Get();
}