PageRenderTime 47ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/xbmc/visualizations/Goom/goom2k4-0/sdl-goom/pixeldoubler.c

https://bitbucket.org/bgiorgini/xbmc
C | 44 lines | 26 code | 8 blank | 10 comment | 2 complexity | 8cda0d44c14e50bbfadc9c78fba7e6cb MD5 | raw file
Possible License(s): GPL-3.0, CC-BY-SA-3.0, BSD-3-Clause, GPL-2.0, LGPL-3.0, 0BSD, LGPL-2.0, AGPL-1.0, LGPL-2.1
  1. #include "pixeldoubler.h"
  2. #include <stdlib.h>
  3. #include <string.h>
  4. void pixel_doubler (Surface *src, Surface *dest) {
  5. register int *d; // pointeur sur le pixel courant a marquer
  6. register int *s; // pointeur sur le pixel coutant en cours de lecture
  7. int sw; // nombre d'octet de largeur de ligne de la surface source
  8. int sw2;
  9. int fd; // adresse de la fin du buffer destination
  10. int fin; // adresse de fin d'une ligne du buffer source
  11. d = dest->buf;
  12. s = src->buf;
  13. sw = src->width << 2;
  14. sw2 = sw << 1;
  15. fin = (int)s;
  16. fd = (int)d + (dest->size<<2);
  17. // tant que tout le buffer source n'est pas remplit
  18. while ((int)d < fd) {
  19. // passer a la ligne suivante du buffer source
  20. fin += sw;
  21. // l'afficher sur une ligne du buffer destination
  22. while ((int)s < fin) {
  23. register int col = *(s++);
  24. // 2 affichage par point du buffer source (doubling horizontal)
  25. *(d++) = col; *(d++) = col;
  26. }
  27. // puis l'afficher sur une autre ligne (doubling vertical)
  28. memcpy (d, ((char*)d) - sw2, sw2);
  29. /* s = (int*)((int)s - sw); // retour au debut de la ligne src
  30. while ((int)s < fin) {
  31. register int col = *(s++);
  32. *(d++) = col; *(d++) = col; // idem (cf plus haut)
  33. } */
  34. d = (int*)((char*)d + sw2);
  35. }
  36. }