iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/videovtb.c
/* allegro_gl_video_do_stretch_blit:
 * overload for all kind of video -> video and video -> screen stretchers
 * FIXME: Doesn't apply scale to the memory copy
 * FIXME: Doesn't work for video->video when FBO is not available.
 */
overload for all kind of video -> video and video -> screen stretchers
FIXME: Doesn't apply scale to the memory copy
FIXME: Doesn't work for video->video when FBO is not available.
overload for all kind of video - > video and video - > screen stretchers FIXME : Doesn ' t apply scale to the memory copy FIXME : Doesn ' t work for video - > video when FBO is not available .
static void allegro_gl_video_do_stretch_blit(BITMAP *source, BITMAP *dest,
               int source_x, int source_y, int source_width, int source_height,
               int dest_x, int dest_y, int dest_width, int dest_height,
               int masked) {
	double scalew = ((double)dest_width) / source_width;
	double scaleh = ((double)dest_height) / source_height;
	GLint matrix_mode;
	if (dest->clip) {
		if ((dest_x >= dest->cr) || (dest_y >= dest->cb)
		 || (dest_x + dest_width < dest->cl) || (dest_y + dest_height < dest->ct)) {
			return;
		}
		if (dest_x < dest->cl) {
			source_x -= (dest_x - dest->cl) / scalew;
			dest_x = dest->cl;
		}
		if (dest_y < dest->ct) {
			source_y -= (dest_y - dest->ct) / scaleh;
			dest_y = dest->ct;
		}
		if (dest_x + dest_width > dest->cr) {
			source_width -= (dest_x + dest_width - dest->cr) / scalew;
			dest_width = dest->cr - dest_x;
		}
		if (dest_y + dest_height > dest->cb) {
			source_height -= (dest_y + dest_height - dest->cb) / scaleh;
			dest_height = dest->cb - dest_y;
		}
	}
	glGetIntegerv(GL_MATRIX_MODE, &matrix_mode);
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glTranslated(dest_x, dest_y, 0.);
	glScaled(scalew, scaleh, 1.);
	glTranslated(-dest_x, -dest_y, 0.);
	if (masked) {
		if (is_screen_bitmap(dest)) {
			do_masked_blit_screen(source, dest, source_x, source_y,
                                  dest_x, dest_y, source_width, source_height,
                                  FALSE, AGL_REGULAR_BMP);
		}
		else {
			do_masked_blit_video(source, dest, source_x, source_y,
                                 dest_x, dest_y, source_width, source_height,
                                 FALSE, AGL_REGULAR_BMP);
		}
	}
	else {
		allegro_gl_screen_blit_to_self(source, dest, source_x, source_y,
                           dest_x, dest_y, source_width, source_height);
	}
	glPopMatrix();
	glMatrixMode(matrix_mode);
	return;
}
static void allegro_gl_video_do_stretch_blit ( BITMAP * source , BITMAP * dest , int source_x , int source_y , int source_width , int source_height , int dest_x , int dest_y , int dest_width , int dest_height , int masked ) { double scalew = ( ( double ) dest_width ) / source_width ; double scaleh = ( ( double ) dest_height ) / source_height ; GLint matrix_mode ; if ( dest -> clip ) { if ( ( dest_x >= dest -> cr ) || ( dest_y >= dest -> cb ) || ( dest_x + dest_width < dest -> cl ) || ( dest_y + dest_height < dest -> ct ) ) { return ; } if ( dest_x < dest -> cl ) { source_x -= ( dest_x - dest -> cl ) / scalew ; dest_x = dest -> cl ; } if ( dest_y < dest -> ct ) { source_y -= ( dest_y - dest -> ct ) / scaleh ; dest_y = dest -> ct ; } if ( dest_x + dest_width > dest -> cr ) { source_width -= ( dest_x + dest_width - dest -> cr ) / scalew ; dest_width = dest -> cr - dest_x ; } if ( dest_y + dest_height > dest -> cb ) { source_height -= ( dest_y + dest_height - dest -> cb ) / scaleh ; dest_height = dest -> cb - dest_y ; } } glGetIntegerv ( GL_MATRIX_MODE , & matrix_mode ) ; glMatrixMode ( GL_MODELVIEW ) ; glPushMatrix ( ) ; glTranslated ( dest_x , dest_y , 0. ) ; glScaled ( scalew , scaleh , 1. ) ; glTranslated ( - dest_x , - dest_y , 0. ) ; if ( masked ) { if ( is_screen_bitmap ( dest ) ) { do_masked_blit_screen ( source , dest , source_x , source_y , dest_x , dest_y , source_width , source_height , FALSE , AGL_REGULAR_BMP ) ; } else { do_masked_blit_video ( source , dest , source_x , source_y , dest_x , dest_y , source_width , source_height , FALSE , AGL_REGULAR_BMP ) ; } } else { allegro_gl_screen_blit_to_self ( source , dest , source_x , source_y , dest_x , dest_y , source_width , source_height ) ; } glPopMatrix ( ) ; glMatrixMode ( matrix_mode ) ; return ; }
allegro_gl_video_do_stretch_blit:
 overload for all kind of video -> video and video -> screen stretchers
 FIXME: Doesn't apply scale to the memory copy
 FIXME: Doesn't work for video->video when FBO is not available.
allegro_gl_video_do_stretch_blit : overload for all kind of video - > video and video - > screen stretchers FIXME : Doesn ' t apply scale to the memory copy FIXME : Doesn ' t work for video - > video when FBO is not available .
/* note: src is a video bitmap, dest is not a memory bitmap */ /* BITMAP_BLIT_CLIP macro from glvtable.c is no good for scaled images. */