Mercurial > sdl-ios-xcode
comparison src/video/SDL_yuv.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
28 #include "SDL_yuvfuncs.h" | 28 #include "SDL_yuvfuncs.h" |
29 #include "SDL_yuv_sw_c.h" | 29 #include "SDL_yuv_sw_c.h" |
30 | 30 |
31 | 31 |
32 SDL_Overlay * | 32 SDL_Overlay * |
33 SDL_CreateYUVOverlay (int w, int h, Uint32 format, SDL_Surface * display) | 33 SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display) |
34 { | 34 { |
35 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 35 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
36 SDL_Window *window; | 36 SDL_Window *window; |
37 const char *yuv_hwaccel; | 37 const char *yuv_hwaccel; |
38 SDL_Overlay *overlay; | 38 SDL_Overlay *overlay; |
39 | 39 |
40 window = SDL_GetWindowFromSurface (display); | 40 window = SDL_GetWindowFromSurface(display); |
41 if (window && (window->flags & SDL_WINDOW_OPENGL)) { | 41 if (window && (window->flags & SDL_WINDOW_OPENGL)) { |
42 SDL_SetError ("YUV overlays are not supported in OpenGL mode"); | 42 SDL_SetError("YUV overlays are not supported in OpenGL mode"); |
43 return NULL; | 43 return NULL; |
44 } | 44 } |
45 | 45 |
46 /* Display directly on video surface, if possible */ | 46 /* Display directly on video surface, if possible */ |
47 if (SDL_getenv ("SDL_VIDEO_YUV_DIRECT")) { | 47 if (SDL_getenv("SDL_VIDEO_YUV_DIRECT")) { |
48 if (window && | 48 if (window && |
49 ((window->surface->format->BytesPerPixel == 2) || | 49 ((window->surface->format->BytesPerPixel == 2) || |
50 (window->surface->format->BytesPerPixel == 4))) { | 50 (window->surface->format->BytesPerPixel == 4))) { |
51 display = window->surface; | 51 display = window->surface; |
52 } | 52 } |
53 } | 53 } |
54 overlay = NULL; | 54 overlay = NULL; |
55 yuv_hwaccel = SDL_getenv ("SDL_VIDEO_YUV_HWACCEL"); | 55 yuv_hwaccel = SDL_getenv("SDL_VIDEO_YUV_HWACCEL"); |
56 if (((display->flags & SDL_SCREEN_SURFACE) && _this->CreateYUVOverlay) && | 56 if (((display->flags & SDL_SCREEN_SURFACE) && _this->CreateYUVOverlay) && |
57 (!yuv_hwaccel || (SDL_atoi (yuv_hwaccel) > 0))) { | 57 (!yuv_hwaccel || (SDL_atoi(yuv_hwaccel) > 0))) { |
58 overlay = _this->CreateYUVOverlay (_this, w, h, format, display); | 58 overlay = _this->CreateYUVOverlay(_this, w, h, format, display); |
59 } | 59 } |
60 /* If hardware YUV overlay failed ... */ | 60 /* If hardware YUV overlay failed ... */ |
61 if (overlay == NULL) { | 61 if (overlay == NULL) { |
62 overlay = SDL_CreateYUV_SW (_this, w, h, format, display); | 62 overlay = SDL_CreateYUV_SW(_this, w, h, format, display); |
63 } | 63 } |
64 return overlay; | 64 return overlay; |
65 } | 65 } |
66 | 66 |
67 int | 67 int |
68 SDL_LockYUVOverlay (SDL_Overlay * overlay) | 68 SDL_LockYUVOverlay(SDL_Overlay * overlay) |
69 { | 69 { |
70 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 70 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
71 return overlay->hwfuncs->Lock (_this, overlay); | 71 return overlay->hwfuncs->Lock(_this, overlay); |
72 } | 72 } |
73 | 73 |
74 void | 74 void |
75 SDL_UnlockYUVOverlay (SDL_Overlay * overlay) | 75 SDL_UnlockYUVOverlay(SDL_Overlay * overlay) |
76 { | 76 { |
77 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 77 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
78 overlay->hwfuncs->Unlock (_this, overlay); | 78 overlay->hwfuncs->Unlock(_this, overlay); |
79 } | 79 } |
80 | 80 |
81 int | 81 int |
82 SDL_DisplayYUVOverlay (SDL_Overlay * overlay, SDL_Rect * dstrect) | 82 SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect) |
83 { | 83 { |
84 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 84 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
85 SDL_Rect src, dst; | 85 SDL_Rect src, dst; |
86 int srcx, srcy, srcw, srch; | 86 int srcx, srcy, srcw, srch; |
87 int dstx, dsty, dstw, dsth; | 87 int dstx, dsty, dstw, dsth; |
88 | 88 |
89 /* Clip the rectangle to the screen area */ | 89 /* Clip the rectangle to the screen area */ |
127 src.h = srch; | 127 src.h = srch; |
128 dst.x = dstx; | 128 dst.x = dstx; |
129 dst.y = dsty; | 129 dst.y = dsty; |
130 dst.w = dstw; | 130 dst.w = dstw; |
131 dst.h = dsth; | 131 dst.h = dsth; |
132 return overlay->hwfuncs->Display (_this, overlay, &src, &dst); | 132 return overlay->hwfuncs->Display(_this, overlay, &src, &dst); |
133 } | 133 } |
134 | 134 |
135 void | 135 void |
136 SDL_FreeYUVOverlay (SDL_Overlay * overlay) | 136 SDL_FreeYUVOverlay(SDL_Overlay * overlay) |
137 { | 137 { |
138 SDL_VideoDevice *_this = SDL_GetVideoDevice (); | 138 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
139 if (overlay) { | 139 if (overlay) { |
140 if (overlay->hwfuncs) { | 140 if (overlay->hwfuncs) { |
141 overlay->hwfuncs->FreeHW (_this, overlay); | 141 overlay->hwfuncs->FreeHW(_this, overlay); |
142 } | 142 } |
143 SDL_free (overlay); | 143 SDL_free(overlay); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 /* vi: set ts=4 sw=4 expandtab: */ | 147 /* vi: set ts=4 sw=4 expandtab: */ |