comparison src/video/SDL_renderer_sw.c @ 2698:e1da92da346c gsoc2008_nds

Clean up.
author Darren Alton <dalton@stevens.edu>
date Wed, 27 Aug 2008 04:23:38 +0000
parents c785543d1843
children 5651642f4a78
comparison
equal deleted inserted replaced
2697:c9121b04cffa 2698:e1da92da346c
386 static int 386 static int
387 SW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, 387 SW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
388 void **pixels, int *pitch) 388 void **pixels, int *pitch)
389 { 389 {
390 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { 390 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
391 return SDL_SW_QueryYUVTexturePixels((SDL_SW_YUVTexture *) texture-> 391 return SDL_SW_QueryYUVTexturePixels((SDL_SW_YUVTexture *)
392 driverdata, pixels, pitch); 392 texture->driverdata, pixels,
393 pitch);
393 } else { 394 } else {
394 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; 395 SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
395 396
396 *pixels = surface->pixels; 397 *pixels = surface->pixels;
397 *pitch = surface->pitch; 398 *pitch = surface->pitch;
462 static int 463 static int
463 SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 464 SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
464 const SDL_Rect * rect, const void *pixels, int pitch) 465 const SDL_Rect * rect, const void *pixels, int pitch)
465 { 466 {
466 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { 467 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
467 return SDL_SW_UpdateYUVTexture((SDL_SW_YUVTexture *) texture-> 468 return SDL_SW_UpdateYUVTexture((SDL_SW_YUVTexture *)
468 driverdata, rect, pixels, pitch); 469 texture->driverdata, rect, pixels,
470 pitch);
469 } else { 471 } else {
470 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; 472 SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
471 Uint8 *src, *dst; 473 Uint8 *src, *dst;
472 int row; 474 int row;
473 size_t length; 475 size_t length;
490 SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 492 SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
491 const SDL_Rect * rect, int markDirty, void **pixels, 493 const SDL_Rect * rect, int markDirty, void **pixels,
492 int *pitch) 494 int *pitch)
493 { 495 {
494 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { 496 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
495 return SDL_SW_LockYUVTexture((SDL_SW_YUVTexture *) texture-> 497 return SDL_SW_LockYUVTexture((SDL_SW_YUVTexture *)
496 driverdata, rect, markDirty, pixels, 498 texture->driverdata, rect, markDirty,
497 pitch); 499 pixels, pitch);
498 } else { 500 } else {
499 SDL_Surface *surface = (SDL_Surface *) texture->driverdata; 501 SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
500 502
501 *pixels = 503 *pixels =
502 (void *) ((Uint8 *) surface->pixels + rect->y * surface->pitch + 504 (void *) ((Uint8 *) surface->pixels + rect->y * surface->pitch +
533 SDL_AddDirtyRect(&data->dirty, rect); 535 SDL_AddDirtyRect(&data->dirty, rect);
534 } 536 }
535 537
536 color = SDL_MapRGBA(data->surface.format, r, g, b, a); 538 color = SDL_MapRGBA(data->surface.format, r, g, b, a);
537 539
538 if (data->renderer-> 540 if (data->renderer->LockTexture(data->renderer,
539 LockTexture(data->renderer, data->texture[data->current_texture], 541 data->texture[data->current_texture],
540 rect, 1, &data->surface.pixels, 542 rect, 1, &data->surface.pixels,
541 &data->surface.pitch) < 0) { 543 &data->surface.pitch) < 0) {
542 return -1; 544 return -1;
543 } 545 }
544 data->surface.w = rect->w; 546 data->surface.w = rect->w;
545 data->surface.h = rect->h; 547 data->surface.h = rect->h;
546 data->surface.clip_rect.w = rect->w; 548 data->surface.clip_rect.w = rect->w;
564 566
565 if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) { 567 if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
566 SDL_AddDirtyRect(&data->dirty, dstrect); 568 SDL_AddDirtyRect(&data->dirty, dstrect);
567 } 569 }
568 570
569 if (data->renderer-> 571 if (data->renderer->LockTexture(data->renderer,
570 LockTexture(data->renderer, data->texture[data->current_texture], 572 data->texture[data->current_texture],
571 dstrect, 1, &data->surface.pixels, 573 dstrect, 1, &data->surface.pixels,
572 &data->surface.pitch) < 0) { 574 &data->surface.pitch) < 0) {
573 return -1; 575 return -1;
574 } 576 }
575 577
576 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { 578 if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
577 status = 579 status =