comparison window/picture.cc @ 43:01aa5ddf7dc8

A lot of very minor improvements (deleted some unused variables, and other things like that...)
author thib
date Tue, 24 Mar 2009 19:45:48 +0000
parents 97b752b43502
children ed6c21dde840
comparison
equal deleted inserted replaced
42:039d813d4cef 43:01aa5ddf7dc8
40 #include"picture.h" 40 #include"picture.h"
41 41
42 using namespace std; 42 using namespace std;
43 43
44 int print_blit=0; 44 int print_blit=0;
45 inline void dprintf(const char* fmt, ...) {}
46 /* render.cc */ 45 /* render.cc */
47 void DSurfaceBlitAlpha(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, const unsigned char* alpha, const Rect& alpharect); 46 void DSurfaceBlitAlpha(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, const unsigned char* alpha, const Rect& alpharect);
48 void DSurfaceBlitSaturate(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect, unsigned char alpha); 47 void DSurfaceBlitSaturate(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect, unsigned char alpha);
49 void DSurfaceBlitMultiply(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect); 48 void DSurfaceBlitMultiply(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect);
50 void DSurfaceFill(Surface* src, const Rect& rect, int r, int g, int b, int a=0xff); // クリア 49 void DSurfaceFill(Surface* src, const Rect& rect, int r, int g, int b, int a=0xff); // クリア
956 #define ALPHA_MAX 255 955 #define ALPHA_MAX 255
957 #endif 956 #endif
958 void PicRoot::BlitSurface(Surface* src, const Rect& src_r, const unsigned char* alpha, const Rect& alpha_r, Surface* dest, const Rect& dest_r, int attribute) const { 957 void PicRoot::BlitSurface(Surface* src, const Rect& src_r, const unsigned char* alpha, const Rect& alpha_r, Surface* dest, const Rect& dest_r, int attribute) const {
959 if (print_blit) fprintf(stderr," s %08x %d:%d:%d:%d;",src, dest_r.lx, dest_r.ty, dest_r.rx, dest_r.by); 958 if (print_blit) fprintf(stderr," s %08x %d:%d:%d:%d;",src, dest_r.lx, dest_r.ty, dest_r.rx, dest_r.by);
960 SDL_Rect sr = SDLed(src_r); SDL_Rect dr = SDLed(dest_r); 959 SDL_Rect sr = SDLed(src_r); SDL_Rect dr = SDLed(dest_r);
961 special_blit: 960
962 if (attribute & PicBase::BLIT_MULTIPLY) { 961 if (attribute & PicBase::BLIT_MULTIPLY) {
963 if (print_blit) fprintf(stderr,"M"); 962 if (print_blit) fprintf(stderr,"M");
964 DSurfaceBlitMultiply(src, src_r, dest, dest_r); 963 DSurfaceBlitMultiply(src, src_r, dest, dest_r);
965 return; 964 return;
966 } else if (attribute & PicBase::BLIT_SATURATE) { 965 } else if (attribute & PicBase::BLIT_SATURATE && src->format->Amask == 0) {
967 if (src->format->Amask != 0) goto normal_blit;
968 if (print_blit) fprintf(stderr,"S"); 966 if (print_blit) fprintf(stderr,"S");
969 unsigned char a = 255; 967 unsigned char a = 255;
970 if (alpha && alpha_r.width() >= 1 && alpha_r.height() >= 1) a = *alpha; 968 if (alpha && alpha_r.width() >= 1 && alpha_r.height() >= 1) a = *alpha;
971 DSurfaceBlitSaturate(src, src_r, dest, dest_r, a); 969 DSurfaceBlitSaturate(src, src_r, dest, dest_r, a);
972 return; 970 return;
973 } 971 }
974 normal_blit: 972
975 if (print_blit) fprintf(stderr,"N"); 973 if (print_blit) fprintf(stderr,"N");
976 if (alpha == 0 || alpha_r.width() == 0) { // simple blit 974 if (alpha == 0 || alpha_r.width() == 0) { // simple blit
977 if (print_blit) fprintf(stderr,"X"); 975 if (print_blit) fprintf(stderr,"X");
978 SDL_BlitSurface(src, &sr, dest, &dr); 976 SDL_BlitSurface(src, &sr, dest, &dr);
979 return; 977 return;