Mercurial > sdl-ios-xcode
comparison src/video/SDL_video.c @ 2927:2133d2d300fd
SetDrawColor() and SetDrawBlendMode() are optional
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 30 Dec 2008 07:14:11 +0000 |
parents | bd518fc76f28 |
children | e171ce9bdbad |
comparison
equal
deleted
inserted
replaced
2926:27f2b5e7e899 | 2927:2133d2d300fd |
---|---|
1985 } | 1985 } |
1986 renderer = SDL_CurrentDisplay.current_renderer; | 1986 renderer = SDL_CurrentDisplay.current_renderer; |
1987 if (!renderer) { | 1987 if (!renderer) { |
1988 return -1; | 1988 return -1; |
1989 } | 1989 } |
1990 if (!renderer->SetDrawColor) { | |
1991 SDL_Unsupported(); | |
1992 return -1; | |
1993 } | |
1994 renderer->r = r; | 1990 renderer->r = r; |
1995 renderer->g = g; | 1991 renderer->g = g; |
1996 renderer->b = b; | 1992 renderer->b = b; |
1997 renderer->a = a; | 1993 renderer->a = a; |
1998 renderer->SetDrawColor(renderer); | 1994 if (renderer->SetDrawColor) { |
1999 return 0; | 1995 return renderer->SetDrawColor(renderer); |
1996 } else { | |
1997 return 0; | |
1998 } | |
2000 } | 1999 } |
2001 | 2000 |
2002 int | 2001 int |
2003 SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a) | 2002 SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a) |
2004 { | 2003 { |
2010 } | 2009 } |
2011 renderer = SDL_CurrentDisplay.current_renderer; | 2010 renderer = SDL_CurrentDisplay.current_renderer; |
2012 if (!renderer) { | 2011 if (!renderer) { |
2013 return -1; | 2012 return -1; |
2014 } | 2013 } |
2015 if (!renderer->SetDrawColor) { | |
2016 SDL_Unsupported(); | |
2017 return -1; | |
2018 } | |
2019 if (r) { | 2014 if (r) { |
2020 *r = renderer->r; | 2015 *r = renderer->r; |
2021 } | 2016 } |
2022 if (g) { | 2017 if (g) { |
2023 *g = renderer->g; | 2018 *g = renderer->g; |
2026 *b = renderer->b; | 2021 *b = renderer->b; |
2027 } | 2022 } |
2028 if (a) { | 2023 if (a) { |
2029 *a = renderer->a; | 2024 *a = renderer->a; |
2030 } | 2025 } |
2031 return 0; | |
2032 } | 2026 } |
2033 | 2027 |
2034 int | 2028 int |
2035 SDL_SetRenderDrawBlendMode(int blendMode) | 2029 SDL_SetRenderDrawBlendMode(int blendMode) |
2036 { | 2030 { |
2042 } | 2036 } |
2043 renderer = SDL_CurrentDisplay.current_renderer; | 2037 renderer = SDL_CurrentDisplay.current_renderer; |
2044 if (!renderer) { | 2038 if (!renderer) { |
2045 return -1; | 2039 return -1; |
2046 } | 2040 } |
2047 if (!renderer->SetDrawBlendMode) { | |
2048 SDL_Unsupported(); | |
2049 return -1; | |
2050 } | |
2051 renderer->blendMode = blendMode; | 2041 renderer->blendMode = blendMode; |
2052 renderer->SetDrawBlendMode(renderer); | 2042 if (renderer->SetDrawBlendMode) { |
2053 return 0; | 2043 return renderer->SetDrawBlendMode(renderer); |
2044 } else { | |
2045 return 0; | |
2046 } | |
2054 } | 2047 } |
2055 | 2048 |
2056 int | 2049 int |
2057 SDL_GetRenderDrawBlendMode(int *blendMode) | 2050 SDL_GetRenderDrawBlendMode(int *blendMode) |
2058 { | 2051 { |