src/video/directfb/SDL_DirectFB_render.c
changeset 2241 4932f192c565
parent 2226 0e70b4b8cf84
child 2244 5234868559fa
equal deleted inserted replaced
2240:eebaa05f8bd9 2241:4932f192c565
   503                        const SDL_Rect * rect, const void *pixels, int pitch)
   503                        const SDL_Rect * rect, const void *pixels, int pitch)
   504 {
   504 {
   505     DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
   505     DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
   506     DirectFB_RenderData *renderdata =
   506     DirectFB_RenderData *renderdata =
   507         (DirectFB_RenderData *) renderer->driverdata;
   507         (DirectFB_RenderData *) renderer->driverdata;
   508 
   508     DFBResult ret;
   509     if (data->pixels) {
   509     Uint8 *dpixels;
   510         Uint8 *src, *dst;
   510     int   dpitch;
   511         int row;
   511     Uint8 *src, *dst;
   512         size_t length;
   512     int row;
   513 
   513     size_t length;
   514         src = (Uint8 *) pixels;
   514 
   515         dst =
   515     SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
   516             (Uint8 *) data->pixels + rect->y * data->pitch +
   516                                          DSLF_WRITE | DSLF_READ, &dpixels,
   517             rect->x * SDL_BYTESPERPIXEL(texture->format);
   517                                          &dpitch));
   518         length = rect->w * SDL_BYTESPERPIXEL(texture->format);
   518     src = (Uint8 *) pixels;
   519         for (row = 0; row < rect->h; ++row) {
   519     dst =
   520             SDL_memcpy(dst, src, length);
   520         (Uint8 *) dpixels + rect->y * dpitch +
   521             src += pitch;
   521         rect->x * SDL_BYTESPERPIXEL(texture->format);
   522             dst += data->pitch;
   522     length = rect->w * SDL_BYTESPERPIXEL(texture->format);
   523         }
   523     for (row = 0; row < rect->h; ++row) {
   524     } else {
   524         SDL_memcpy(dst, src, length);
   525         SDL_SetError("FIXME: Update without lock!\n");
   525         src += pitch;
   526         return -1;
   526         dst += dpitch;
   527     }
   527     }
   528     return 0;
   528     SDL_DFB_CHECKERR(data->surface->Unlock(data->surface) );
       
   529     return 0;
       
   530 error:
       
   531 	return 1;
       
   532 
   529 }
   533 }
   530 
   534 
   531 static int
   535 static int
   532 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   536 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   533                      const SDL_Rect * rect, int markDirty, void **pixels,
   537                      const SDL_Rect * rect, int markDirty, void **pixels,