comparison src/video/SDL_video.c @ 2909:3da0bb421d83

Added line clipping
author Sam Lantinga <slouken@libsdl.org>
date Tue, 23 Dec 2008 02:23:18 +0000
parents aa6ba38c1714
children 27d8b12e0e8e
comparison
equal deleted inserted replaced
2908:aa6ba38c1714 2909:3da0bb421d83
2117 } 2117 }
2118 if (!renderer->RenderLine) { 2118 if (!renderer->RenderLine) {
2119 SDL_Unsupported(); 2119 SDL_Unsupported();
2120 return -1; 2120 return -1;
2121 } 2121 }
2122 #if 0
2123 //FIXME: Need line intersect routine
2124 window = SDL_GetWindowFromID(renderer->window); 2122 window = SDL_GetWindowFromID(renderer->window);
2123
2125 real_rect.x = 0; 2124 real_rect.x = 0;
2126 real_rect.y = 0; 2125 real_rect.y = 0;
2127 real_rect.w = window->w; 2126 real_rect.w = window->w;
2128 real_rect.h = window->h; 2127 real_rect.h = window->h;
2129 if (rect) { 2128 if (!SDL_IntersectRectAndLine(&real_rect, &x1, &x2, &y1, &y2)) {
2130 if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) { 2129 return (0);
2131 return 0; 2130 }
2132 }
2133 }
2134 #endif
2135 return renderer->RenderLine(renderer, x1, y1, x2, y2); 2131 return renderer->RenderLine(renderer, x1, y1, x2, y2);
2136 } 2132 }
2137 2133
2138 int 2134 int
2139 SDL_RenderFill(const SDL_Rect * rect) 2135 SDL_RenderFill(const SDL_Rect * rect)