src/video/SDL_yuv.c
branchSDL-1.2
changeset 4076 9a7c62bbc8b3
parent 1643 51038e80ae59
child 4159 a1b03ba2fcd0
equal deleted inserted replaced
4075:0207ca19fd8f 4076:9a7c62bbc8b3
    63 	return overlay;
    63 	return overlay;
    64 }
    64 }
    65 
    65 
    66 int SDL_LockYUVOverlay(SDL_Overlay *overlay)
    66 int SDL_LockYUVOverlay(SDL_Overlay *overlay)
    67 {
    67 {
       
    68 	if ( overlay == NULL ) {
       
    69 		SDL_SetError("Passed NULL overlay");
       
    70 		return -1;
       
    71 	}
    68 	return overlay->hwfuncs->Lock(current_video, overlay);
    72 	return overlay->hwfuncs->Lock(current_video, overlay);
    69 }
    73 }
    70 
    74 
    71 void SDL_UnlockYUVOverlay(SDL_Overlay *overlay)
    75 void SDL_UnlockYUVOverlay(SDL_Overlay *overlay)
    72 {
    76 {
       
    77 	if ( overlay == NULL ) {
       
    78 		return;
       
    79 	}
    73 	overlay->hwfuncs->Unlock(current_video, overlay);
    80 	overlay->hwfuncs->Unlock(current_video, overlay);
    74 }
    81 }
    75 
    82 
    76 int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect)
    83 int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect)
    77 {
    84 {
    78 	SDL_Rect src, dst;
    85 	SDL_Rect src, dst;
    79 	int srcx, srcy, srcw, srch;
    86 	int srcx, srcy, srcw, srch;
    80 	int dstx, dsty, dstw, dsth;
    87 	int dstx, dsty, dstw, dsth;
       
    88 
       
    89 	if ( overlay == NULL || dstrect == NULL ) {
       
    90 		SDL_SetError("Passed NULL overlay or dstrect");
       
    91 		return -1;
       
    92 	}
    81 
    93 
    82 	/* Clip the rectangle to the screen area */
    94 	/* Clip the rectangle to the screen area */
    83 	srcx = 0;
    95 	srcx = 0;
    84 	srcy = 0;
    96 	srcy = 0;
    85 	srcw = overlay->w;
    97 	srcw = overlay->w;
   126 	return overlay->hwfuncs->Display(current_video, overlay, &src, &dst);
   138 	return overlay->hwfuncs->Display(current_video, overlay, &src, &dst);
   127 }
   139 }
   128 
   140 
   129 void SDL_FreeYUVOverlay(SDL_Overlay *overlay)
   141 void SDL_FreeYUVOverlay(SDL_Overlay *overlay)
   130 {
   142 {
   131 	if ( overlay ) {
   143 	if ( overlay == NULL ) {
   132 		if ( overlay->hwfuncs ) {
   144 		return;
   133 			overlay->hwfuncs->FreeHW(current_video, overlay);
       
   134 		}
       
   135 		SDL_free(overlay);
       
   136 	}
   145 	}
       
   146 	if ( overlay->hwfuncs ) {
       
   147 		overlay->hwfuncs->FreeHW(current_video, overlay);
       
   148 	}
       
   149 	SDL_free(overlay);
   137 }
   150 }