enum piglit_result piglit_display() { bool pass; glUseProgram(prog); glDisable(GL_FRAMEBUFFER_SRGB); /* Clear buffers */ if (resolve_fbo != 0) { glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo); glClear(GL_COLOR_BUFFER_BIT); } glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo); glClear(GL_COLOR_BUFFER_BIT); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, src_fbo); glClear(GL_COLOR_BUFFER_BIT); /* Draw the source image */ glViewport(0, 0, PATTERN_WIDTH, PATTERN_HEIGHT); piglit_draw_rect(-1, -1, 2, 2); /* Do the blit */ glBindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo); if (enable_srgb_framebuffer) glEnable(GL_FRAMEBUFFER_SRGB); glBlitFramebuffer(0, 0, PATTERN_WIDTH, scaled_blit ? 1 : PATTERN_HEIGHT, 0, 0, PATTERN_WIDTH, PATTERN_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST); glDisable(GL_FRAMEBUFFER_SRGB); /* If necessary, do a resolve blit */ if (resolve_fbo != 0) { glBindFramebuffer(GL_READ_FRAMEBUFFER, dst_fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, resolve_fbo); glBlitFramebuffer(0, 0, PATTERN_WIDTH, PATTERN_HEIGHT, 0, 0, PATTERN_WIDTH, PATTERN_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST); pass = analyze_image(resolve_fbo); } else { pass = analyze_image(dst_fbo); } return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { mlt_filter filter = (mlt_filter)mlt_frame_pop_service( frame ); mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); uint8_t* vs_image = NULL; VSPixelFormat vs_format = PF_NONE; // VS only works on progressive frames mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "consumer_deinterlace", 1 ); *format = validate_format( *format ); int error = mlt_frame_get_image( frame, image, format, width, height, 1 ); // Convert the received image to a format vid.stab can handle if ( !error ) { vs_format = mltimage_to_vsimage( *format, *width, *height, *image, &vs_image ); } if( vs_image ) { mlt_service_lock( MLT_FILTER_SERVICE(filter) ); char* results = mlt_properties_get( properties, "results" ); if( results && strcmp( results, "" ) ) { apply_results( filter, frame, vs_image, vs_format, *width, *height ); vsimage_to_mltimage( vs_image, *image, *format, *width, *height ); } else { analyze_image( filter, frame, vs_image, vs_format, *width, *height ); if( mlt_properties_get_int( properties, "show" ) == 1 ) { vsimage_to_mltimage( vs_image, *image, *format, *width, *height ); } } mlt_service_unlock( MLT_FILTER_SERVICE(filter) ); free_vsimage( vs_image, vs_format ); } return error; }
void init_images() { int i,j; button_image[0][0] = IMG_Load("images\\play_button.bmp"); button_image[1][0] = IMG_Load("images\\option_button.bmp"); button_image[2][0] = IMG_Load("images\\halloffame_button.bmp"); button_image[3][0] = IMG_Load("images\\credits_button.bmp"); button_image[4][0] = IMG_Load("images\\exit_button.bmp"); button_image[0][1] = IMG_Load("images\\play_button2.bmp"); button_image[1][1] = IMG_Load("images\\option_button2.bmp"); button_image[2][1] = IMG_Load("images\\halloffame_button2.bmp"); button_image[3][1] = IMG_Load("images\\credits_button2.bmp"); button_image[4][1] = IMG_Load("images\\exit_button2.bmp"); score_screen_image = IMG_Load("images\\option_screen.bmp"); score_screen_image = analyze_image(score_screen_image); option_screen_image = IMG_Load("images\\controls.bmp"); option_screen_image = analyze_image(option_screen_image); sound_icon[0] = IMG_Load("images\\sound_off.bmp"); sound_icon[1] = IMG_Load("images\\sound_on.bmp"); back_button_image = IMG_Load("images\\back_button.bmp"); back_button_image = analyze_image(back_button_image); for(i=0;i<2;++i) sound_icon[i] = analyze_image(sound_icon[i]); for( i = 0 ; i < TOTAL_NO_BUTTON ; ++i) { for(j=0;j<2;++j) { button_image[i][j] = analyze_image(button_image[i][j]); } } backk = IMG_Load("images\\welcome_screen.bmp"); backk = analyze_image(backk); }