src/video/SDL_surface.c
changeset 5140 e743b9c3f6d6
parent 5138 da10636e5eca
child 5184 d976b67150c5
equal deleted inserted replaced
5139:57851a238c8f 5140:e743b9c3f6d6
   446         return -1;
   446         return -1;
   447     }
   447     }
   448 
   448 
   449     status = 0;
   449     status = 0;
   450     flags = surface->map->info.flags;
   450     flags = surface->map->info.flags;
   451     surface->map->info.flags &=
   451     surface->map->info.flags &= ~(SDL_COPY_BLEND | SDL_COPY_ADD);
   452         ~(SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD);
       
   453     switch (blendMode) {
   452     switch (blendMode) {
   454     case SDL_BLENDMODE_NONE:
   453     case SDL_BLENDMODE_NONE:
   455         break;
       
   456     case SDL_BLENDMODE_MASK:
       
   457         surface->map->info.flags |= SDL_COPY_MASK;
       
   458         break;
   454         break;
   459     case SDL_BLENDMODE_BLEND:
   455     case SDL_BLENDMODE_BLEND:
   460         surface->map->info.flags |= SDL_COPY_BLEND;
   456         surface->map->info.flags |= SDL_COPY_BLEND;
   461         break;
   457         break;
   462     case SDL_BLENDMODE_ADD:
   458     case SDL_BLENDMODE_ADD:
   463         surface->map->info.flags |= SDL_COPY_ADD;
   459         surface->map->info.flags |= SDL_COPY_ADD;
   464         break;
   460         break;
   465     case SDL_BLENDMODE_MOD:
       
   466         surface->map->info.flags |= SDL_COPY_MOD;
       
   467         break;
       
   468     default:
   461     default:
   469         SDL_Unsupported();
   462         SDL_Unsupported();
   470         status = -1;
   463         status = -1;
   471         break;
   464         break;
   472     }
   465     }
   494 
   487 
   495     if (!blendMode) {
   488     if (!blendMode) {
   496         return 0;
   489         return 0;
   497     }
   490     }
   498 
   491 
   499     switch (surface->map->
   492     switch (surface->map->info.flags & (SDL_COPY_BLEND | SDL_COPY_ADD)) {
   500             info.flags & (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD |
       
   501                           SDL_COPY_MOD)) {
       
   502     case SDL_COPY_MASK:
       
   503         *blendMode = SDL_BLENDMODE_MASK;
       
   504         break;
       
   505     case SDL_COPY_BLEND:
   493     case SDL_COPY_BLEND:
   506         *blendMode = SDL_BLENDMODE_BLEND;
   494         *blendMode = SDL_BLENDMODE_BLEND;
   507         break;
   495         break;
   508     case SDL_COPY_ADD:
   496     case SDL_COPY_ADD:
   509         *blendMode = SDL_BLENDMODE_ADD;
   497         *blendMode = SDL_BLENDMODE_ADD;
   510         break;
       
   511     case SDL_COPY_MOD:
       
   512         *blendMode = SDL_BLENDMODE_MOD;
       
   513         break;
   498         break;
   514     default:
   499     default:
   515         *blendMode = SDL_BLENDMODE_NONE;
   500         *blendMode = SDL_BLENDMODE_NONE;
   516         break;
   501         break;
   517     }
   502     }