comparison src/video/SDL_yuv.c @ 660:73440ac574a2

You can't create a YUV overlay in OpenGL mode
author Sam Lantinga <slouken@libsdl.org>
date Sat, 26 Jul 2003 20:02:00 +0000
parents f6ffac90895c
children cf9dd3aa6756
comparison
equal deleted inserted replaced
659:e3d0517bf67e 660:73440ac574a2
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <string.h> 31 #include <string.h>
32 32
33 #include "SDL_getenv.h" 33 #include "SDL_getenv.h"
34 #include "SDL_video.h" 34 #include "SDL_video.h"
35 #include "SDL_error.h"
35 #include "SDL_sysvideo.h" 36 #include "SDL_sysvideo.h"
36 #include "SDL_yuvfuncs.h" 37 #include "SDL_yuvfuncs.h"
37 #include "SDL_yuv_sw_c.h" 38 #include "SDL_yuv_sw_c.h"
38 39
39 40
43 SDL_VideoDevice *video = current_video; 44 SDL_VideoDevice *video = current_video;
44 SDL_VideoDevice *this = current_video; 45 SDL_VideoDevice *this = current_video;
45 const char *yuv_hwaccel; 46 const char *yuv_hwaccel;
46 SDL_Overlay *overlay; 47 SDL_Overlay *overlay;
47 48
48 overlay = NULL; 49 if ( (SDL_VideoSurface->flags & SDL_OPENGL) == SDL_OPENGL ) {
50 SDL_SetError("YUV overlays are not supported in OpenGL mode");
51 return NULL;
52 }
49 53
50 /* Display directly on video surface, if possible */ 54 /* Display directly on video surface, if possible */
51 if ( getenv("SDL_VIDEO_YUV_DIRECT") ) { 55 if ( getenv("SDL_VIDEO_YUV_DIRECT") ) {
52 if ( (display == SDL_PublicSurface) && 56 if ( (display == SDL_PublicSurface) &&
53 ((SDL_VideoSurface->format->BytesPerPixel == 2) || 57 ((SDL_VideoSurface->format->BytesPerPixel == 2) ||
54 (SDL_VideoSurface->format->BytesPerPixel == 4)) ) { 58 (SDL_VideoSurface->format->BytesPerPixel == 4)) ) {
55 display = SDL_VideoSurface; 59 display = SDL_VideoSurface;
56 } 60 }
57 } 61 }
62 overlay = NULL;
58 yuv_hwaccel = getenv("SDL_VIDEO_YUV_HWACCEL"); 63 yuv_hwaccel = getenv("SDL_VIDEO_YUV_HWACCEL");
59 if ( ((display == SDL_VideoSurface) && video->CreateYUVOverlay) && 64 if ( ((display == SDL_VideoSurface) && video->CreateYUVOverlay) &&
60 (!yuv_hwaccel || (atoi(yuv_hwaccel) > 0)) ) { 65 (!yuv_hwaccel || (atoi(yuv_hwaccel) > 0)) ) {
61 overlay = video->CreateYUVOverlay(this, w, h, format, display); 66 overlay = video->CreateYUVOverlay(this, w, h, format, display);
62 } 67 }