comparison src/video/SDL_surface.c @ 2234:cf8c3b0117b3

Gained 5 FPS in testsprite because Mac OS X memset is highly optimized
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Aug 2007 18:27:44 +0000
parents 926294b2bb4e
children 55a8bebf9ba6
comparison
equal deleted inserted replaced
2233:fb01ee9716bc 2234:cf8c3b0117b3
566 } 566 }
567 row = (Uint8 *) dst->pixels + dstrect->y * dst->pitch + 567 row = (Uint8 *) dst->pixels + dstrect->y * dst->pitch +
568 dstrect->x * dst->format->BytesPerPixel; 568 dstrect->x * dst->format->BytesPerPixel;
569 if (dst->format->palette || (color == 0)) { 569 if (dst->format->palette || (color == 0)) {
570 x = dstrect->w * dst->format->BytesPerPixel; 570 x = dstrect->w * dst->format->BytesPerPixel;
571 #ifndef __MACOSX__ /* memset() is optimized on Mac OS X */
571 if (!color && !((uintptr_t) row & 3) && !(x & 3) 572 if (!color && !((uintptr_t) row & 3) && !(x & 3)
572 && !(dst->pitch & 3)) { 573 && !(dst->pitch & 3)) {
573 int n = x >> 2; 574 int n = x >> 2;
574 for (y = dstrect->h; y; --y) { 575 for (y = dstrect->h; y; --y) {
575 SDL_memset4(row, 0, n); 576 SDL_memset4(row, 0, n);
576 row += dst->pitch; 577 row += dst->pitch;
577 } 578 }
578 } else { 579 } else
580 #endif /* !__MACOSX__ */
581 {
579 for (y = dstrect->h; y; y--) { 582 for (y = dstrect->h; y; y--) {
580 SDL_memset(row, color, x); 583 SDL_memset(row, color, x);
581 row += dst->pitch; 584 row += dst->pitch;
582 } 585 }
583 } 586 }