!!! FIXME: move this to a public API if we want to do float versions of all of these later */
| 2879 | |
| 2880 | /* !!! FIXME: move this to a public API if we want to do float versions of all of these later */ |
| 2881 | static SDL_bool |
| 2882 | SDL_HasIntersectionF(const SDL_FRect * A, const SDL_FRect * B) |
| 2883 | { |
| 2884 | float Amin, Amax, Bmin, Bmax; |
| 2885 | |
| 2886 | if (!A) { |
| 2887 | SDL_InvalidParamError("A"); |
| 2888 | return SDL_FALSE; |
| 2889 | } |
| 2890 | |
| 2891 | if (!B) { |
| 2892 | SDL_InvalidParamError("B"); |
| 2893 | return SDL_FALSE; |
| 2894 | } |
| 2895 | |
| 2896 | /* Special cases for empty rects */ |
| 2897 | if (SDL_FRectEmpty(A) || SDL_FRectEmpty(B)) { |
| 2898 | return SDL_FALSE; |
| 2899 | } |
| 2900 | |
| 2901 | /* Horizontal intersection */ |
| 2902 | Amin = A->x; |
| 2903 | Amax = Amin + A->w; |
| 2904 | Bmin = B->x; |
| 2905 | Bmax = Bmin + B->w; |
| 2906 | if (Bmin > Amin) |
| 2907 | Amin = Bmin; |
| 2908 | if (Bmax < Amax) |
| 2909 | Amax = Bmax; |
| 2910 | if (Amax <= Amin) |
| 2911 | return SDL_FALSE; |
| 2912 | |
| 2913 | /* Vertical intersection */ |
| 2914 | Amin = A->y; |
| 2915 | Amax = Amin + A->h; |
| 2916 | Bmin = B->y; |
| 2917 | Bmax = Bmin + B->h; |
| 2918 | if (Bmin > Amin) |
| 2919 | Amin = Bmin; |
| 2920 | if (Bmax < Amax) |
| 2921 | Amax = Bmax; |
| 2922 | if (Amax <= Amin) |
| 2923 | return SDL_FALSE; |
| 2924 | |
| 2925 | return SDL_TRUE; |
| 2926 | } |
| 2927 | |
| 2928 | int |
| 2929 | SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
no test coverage detected