Changeset 60:e16e13d8cd68 for window/picture.cc
- Timestamp:
- 12/18/09 20:41:38 (2 years ago)
- Branch:
- default
- Files:
-
- 1 modified
-
window/picture.cc (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
window/picture.cc
r53 r60 42 42 using namespace std; 43 43 44 int print_blit = 0;45 44 /* render.cc */ 46 45 void DSurfaceBlitAlpha(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, const unsigned char* alpha, const Rect& alpharect); 47 void DSurfaceBlit Saturate(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect, unsigned char alpha);46 void DSurfaceBlitAdd(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect, unsigned char alpha); 48 47 void DSurfaceBlitMultiply(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect); 49 48 void DSurfaceFill(Surface* src, const Rect& rect, int r, int g, int b, int a=0xff); // ¥¯¥ê¥¢ … … 181 180 Rect abs_r = QueryAbsPos(rpos); 182 181 Rect ppos = parent_pos(rpos); 183 if(print_blit) fprintf(stderr,"back.");184 182 if (parent) parent->BlitBack(z_pos, ppos); 185 if(print_blit) fprintf(stderr,"self.");186 183 if (!is_hidden_now) Blit(rpos); 187 if(print_blit) fprintf(stderr,"front.");188 184 if (parent) parent->BlitFront(z_pos, ppos); 189 if(print_blit) fprintf(stderr,"end.");190 185 } 191 186 … … 325 320 surface_alpha = 0; 326 321 surface_alpha_rect = Rect(0,0); 327 attribute &= ~(BLIT_ SATURATE| BLIT_MULTIPLY);322 attribute &= ~(BLIT_ADD | BLIT_MULTIPLY); 328 323 if (surface_own) { 329 324 int key = SDL_MapRGB( ((SDL_Surface*)surface_own)->format, r, g, b); … … 403 398 root->DeleteSurface(surface_own); 404 399 } 405 attribute &= ~(SURFACE_FREE | BLIT_ SATURATE| BLIT_MULTIPLY | NO_PICTURE | SOLID);400 attribute &= ~(SURFACE_FREE | BLIT_ADD | BLIT_MULTIPLY | NO_PICTURE | SOLID); 406 401 attribute |= new_attr; 407 402 surface_own = new_surface; … … 470 465 471 466 void PicBase::SetSurfaceAttribute(int new_attribute) { 472 attribute &= ~(BLIT_ SATURATE| BLIT_MULTIPLY);473 attribute |= new_attribute & (BLIT_ SATURATE| BLIT_MULTIPLY);474 if (new_attribute & (BLIT_ SATURATE| BLIT_MULTIPLY)) {467 attribute &= ~(BLIT_ADD | BLIT_MULTIPLY); 468 attribute |= new_attribute & (BLIT_ADD | BLIT_MULTIPLY); 469 if (new_attribute & (BLIT_ADD | BLIT_MULTIPLY)) { 475 470 rel_solid_area = Rect(0,0); 476 471 } … … 540 535 Rect apos = (*z)->QueryAbsPos(cpos); 541 536 Rect draw_rpos = (*z)->parent_pos(cpos); 542 if(print_blit) fprintf(stderr,"cahce.");543 537 root->BlitSurface(surface_back, draw_rpos, root->surface, apos); 544 538 goto self_redraw; … … 547 541 if (parent) { 548 542 Rect ppos = parent_pos(rpos); 549 if(print_blit) fprintf(stderr,"parent-back.");550 543 parent->BlitBack(z_pos, ppos); 551 544 } 552 545 if (is_hidden_now) return; 553 546 self_redraw: 554 if(print_blit) fprintf(stderr,"back-self.");555 547 BlitSelf(rpos); // »Ò€ÏÉÁ²è€»€º¡¢Œ«Ê¬€À€±ÉÁ²è 556 548 children_redraw: … … 565 557 566 558 void PicContainer::BlitChildren(Rect rpos) { 567 if (print_blit) fprintf(stderr,"bc.");568 559 iterator end = children.end(); 569 560 for (iterator it = children.begin(); it != end; it++) { 570 if ( (*it)->is_hidden_now) if(print_blit) fprintf(stderr,"bch %p;",*it);571 561 if ( (*it)->is_hidden_now) continue; 572 562 if ( (*it)->rel_pos.is_crossed(rpos)) { … … 602 592 Rect apos = QueryAbsPos(rpos); 603 593 // ɬÍ׀˱þ€ž€ÆÊÝž¡¢ÉÁ²è 604 if(print_blit) fprintf(stderr,"self-back.");605 594 if (attribute & CACHE_BACK) root->BlitSurface(root->surface, apos, surface_back, rpos); 606 595 if (! (attribute & NO_PICTURE)) { … … 611 600 rpos.intersect(clip); 612 601 } 613 if(print_blit) fprintf(stderr,"self-blit.");614 602 root->BlitSurface(surface_own, rpos, surface_alpha, surface_alpha_rect, root->surface, apos, attribute); 615 603 } else if (parent == NULL) { // ¿Æ€¬€€€Ê€€€Ê€éÇØ·ÊŸÃµî€ÎÀÕÇ€€ò€â€Ä … … 895 883 vector<UpdateItem>::iterator end = update_rects.end(); 896 884 897 if(print_blit){898 fprintf(stderr,"ExecUpdate Start: \n\t");899 for (it=update_rects.begin(); it != end; it++) {900 fprintf(stderr,"(%d,%d,%d,%d), ",it->apos.lx,it->apos.ty,it->apos.rx,it->apos.by);901 }902 fprintf(stderr,"\n");903 }904 905 885 for (it=update_rects.begin(); it != end; it++) { 906 886 if (it->rpos.width() == 0) continue; … … 926 906 } 927 907 928 if(print_blit){929 fprintf(stderr,"->\t");930 for (it=update_rects.begin(); it != end; it++) {931 fprintf(stderr,"(%d,%d,%d,%d), ",it->apos.lx,it->apos.ty,it->apos.rx,it->apos.by);932 }933 fprintf(stderr,"\n");934 }935 936 908 int num = update_rects.size(); 937 909 SDL_Rect* r = new SDL_Rect[num]; … … 943 915 Rect& ur = item.apos; 944 916 if (ur.width() == 0) continue; 945 if(print_blit)fprintf(stderr,"%p: %d,%d,%d,%d",item.pic, item.apos.lx, item.apos.ty, item.apos.rx, item.apos.by);946 917 947 918 item.pic->ExecReBlit(item.rpos); 948 if(print_blit)fprintf(stderr,"\n"); 919 949 920 ur.intersect(confine); 950 921 r[n].x = ur.lx; … … 955 926 n++; 956 927 } 957 if(print_blit)fprintf(stderr,"\n"); 928 958 929 SDL_UpdateRects(hw_surface, n, r); 959 930 delete[] r; … … 1017 988 #define ALPHA_MAX 255 1018 989 #endif 1019 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 { 1020 if (print_blit) fprintf(stderr," s %p %d:%d:%d:%d;",src, dest_r.lx, dest_r.ty, dest_r.rx, dest_r.by); 990 void PicRoot::BlitSurface(Surface* src, const Rect& src_r, const unsigned char* alpha, const Rect& alpha_r, 991 Surface* dest, const Rect& dest_r, int attribute) const 992 { 1021 993 SDL_Rect sr = SDLed(src_r); SDL_Rect dr = SDLed(dest_r); 1022 994 1023 if (attribute & PicBase::BLIT_MULTIPLY) {1024 if (print_blit) fprintf(stderr,"M"); 995 if (attribute & PicBase::BLIT_MULTIPLY) 996 { 1025 997 DSurfaceBlitMultiply(src, src_r, dest, dest_r); 1026 998 return; 1027 } else if (attribute & PicBase::BLIT_SATURATE && src->format->Amask == 0) { 1028 if (print_blit) fprintf(stderr,"S"); 999 } 1000 else if (attribute & PicBase::BLIT_ADD) 1001 { 1029 1002 unsigned char a = 255; 1030 if (alpha && alpha_r.width() >= 1 && alpha_r.height() >= 1) a = *alpha; 1031 DSurfaceBlitSaturate(src, src_r, dest, dest_r, a); 1003 if (alpha != NULL && alpha_r.width() >= 1 && alpha_r.height() >= 1) 1004 a = *alpha; 1005 DSurfaceBlitAdd(src, src_r, dest, dest_r, a); 1032 1006 return; 1033 1007 } 1034 1008 1035 if (print_blit) fprintf(stderr,"N"); 1036 if (alpha == NULL || alpha_r.width() == 0) { // simple blit 1037 if (print_blit) fprintf(stderr,"X"); 1009 if (alpha == NULL || alpha_r.width() == 0) // simple blit 1010 { 1038 1011 SDL_BlitSurface(src, &sr, dest, &dr); 1039 1012 return; … … 1041 1014 if (alpha_r.width() == 1 && alpha_r.height() == 1) { 1042 1015 if (*alpha == 255) { 1043 if (print_blit) fprintf(stderr,"Y");1044 1016 SDL_BlitSurface(src, &sr, dest, &dr); 1045 1017 return; 1046 1018 } 1047 1019 if (src->format->Amask == 0) { // use per-surface alpha 1048 if (print_blit) fprintf(stderr,"Z");1049 1020 SDL_SetAlpha(src, SDL_SRCALPHA, *alpha); 1050 1021 SDL_BlitSurface(src, &sr, dest, &dr); … … 1054 1025 } 1055 1026 // generic alpha blit 1056 if (print_blit) fprintf(stderr,"W");1057 1027 DSurfaceBlitAlpha(src, src_r, dest, dest_r, alpha, alpha_r); 1058 return;1059 1028 } 1060 1029
![(please configure the [header_logo] section in trac.ini)](/otakunoraifu/chrome/site/your_project_logo.png)