| 3028 | } |
| 3029 | |
| 3030 | int |
| 3031 | SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, |
| 3032 | const SDL_Rect * srcrect, const SDL_FRect * dstrect, |
| 3033 | const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) |
| 3034 | { |
| 3035 | SDL_Rect real_srcrect; |
| 3036 | SDL_FRect real_dstrect; |
| 3037 | SDL_FPoint real_center; |
| 3038 | int retval; |
| 3039 | |
| 3040 | if (flip == SDL_FLIP_NONE && (int)(angle/360) == angle/360) { /* fast path when we don't need rotation or flipping */ |
| 3041 | return SDL_RenderCopyF(renderer, texture, srcrect, dstrect); |
| 3042 | } |
| 3043 | |
| 3044 | CHECK_RENDERER_MAGIC(renderer, -1); |
| 3045 | CHECK_TEXTURE_MAGIC(texture, -1); |
| 3046 | |
| 3047 | if (renderer != texture->renderer) { |
| 3048 | return SDL_SetError("Texture was not created with this renderer"); |
| 3049 | } |
| 3050 | if (!renderer->QueueCopyEx) { |
| 3051 | return SDL_SetError("Renderer does not support RenderCopyEx"); |
| 3052 | } |
| 3053 | |
| 3054 | /* Don't draw while we're hidden */ |
| 3055 | if (renderer->hidden) { |
| 3056 | return 0; |
| 3057 | } |
| 3058 | |
| 3059 | real_srcrect.x = 0; |
| 3060 | real_srcrect.y = 0; |
| 3061 | real_srcrect.w = texture->w; |
| 3062 | real_srcrect.h = texture->h; |
| 3063 | if (srcrect) { |
| 3064 | if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) { |
| 3065 | return 0; |
| 3066 | } |
| 3067 | } |
| 3068 | |
| 3069 | /* We don't intersect the dstrect with the viewport as RenderCopy does because of potential rotation clipping issues... TODO: should we? */ |
| 3070 | if (dstrect) { |
| 3071 | real_dstrect = *dstrect; |
| 3072 | } else { |
| 3073 | SDL_Rect r; |
| 3074 | SDL_zero(r); |
| 3075 | SDL_RenderGetViewport(renderer, &r); |
| 3076 | real_dstrect.x = 0.0f; |
| 3077 | real_dstrect.y = 0.0f; |
| 3078 | real_dstrect.w = (float) r.w; |
| 3079 | real_dstrect.h = (float) r.h; |
| 3080 | } |
| 3081 | |
| 3082 | if (texture->native) { |
| 3083 | texture = texture->native; |
| 3084 | } |
| 3085 | |
| 3086 | if (center) { |
| 3087 | real_center = *center; |
no test coverage detected