src/render/software/SDL_render_sw.c
changeset 11958 d7582d7286aa
parent 11811 5d94cb6b24d3
child 12288 005e1d1bcf05
child 12372 bced4041fcc0
equal deleted inserted replaced
11957:eba3a7c4ba16 11958:d7582d7286aa
   586         return SDL_BlitScaled(src, srcrect, surface, &final_rect);
   586         return SDL_BlitScaled(src, srcrect, surface, &final_rect);
   587     }
   587     }
   588 }
   588 }
   589 
   589 
   590 static int
   590 static int
   591 GetScaleQuality(void)
       
   592 {
       
   593     const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
       
   594 
       
   595     if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
       
   596         return 0;
       
   597     } else {
       
   598         return 1;
       
   599     }
       
   600 }
       
   601 
       
   602 static int
       
   603 SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
   591 SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
   604                 const SDL_Rect * srcrect, const SDL_FRect * dstrect,
   592                 const SDL_Rect * srcrect, const SDL_FRect * dstrect,
   605                 const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
   593                 const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
   606 {
   594 {
   607     SDL_Surface *surface = SW_ActivateRenderer(renderer);
   595     SDL_Surface *surface = SW_ActivateRenderer(renderer);
   715     /* SDLgfx_rotateSurface is going to make decisions depending on the blend mode. */
   703     /* SDLgfx_rotateSurface is going to make decisions depending on the blend mode. */
   716     SDL_SetSurfaceBlendMode(src_clone, blendmode);
   704     SDL_SetSurfaceBlendMode(src_clone, blendmode);
   717 
   705 
   718     if (!retval) {
   706     if (!retval) {
   719         SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle);
   707         SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle);
   720         src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
   708         src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
   721         if (src_rotated == NULL) {
   709         if (src_rotated == NULL) {
   722             retval = -1;
   710             retval = -1;
   723         }
   711         }
   724         if (!retval && mask != NULL) {
   712         if (!retval && mask != NULL) {
   725             /* The mask needed for the NONE blend mode gets rotated with the same parameters. */
   713             /* The mask needed for the NONE blend mode gets rotated with the same parameters. */