static enum piglit_result draw(Display *dpy) { GLboolean pass = GL_TRUE; int draw_w = piglit_width / 4; int draw_h = piglit_height / 2; int rgb_x = piglit_width / 8; int rgb_y = piglit_height / 4; int rgba_x = piglit_width * 5 / 8; int rgba_y = piglit_height / 4; /* Clear background to gray */ glClearColor(0.5, 0.5, 0.5, 1.0); glClear(GL_COLOR_BUFFER_BIT); draw_pixmap(rgb_pixmap, rgb_x, rgb_y, draw_w, draw_h); draw_pixmap(rgba_pixmap, rgba_x, rgba_y, draw_w, draw_h); pass &= check_results(GL_FALSE, rgb_x, rgb_y, draw_w, draw_h); pass &= check_results(GL_TRUE, rgba_x, rgba_y, draw_w, draw_h); glXSwapBuffers(dpy, win); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
void BC_Pan::draw(int flash, int flush) { draw_top_background(parent_window, 0, 0, w, h); draw_pixmap(images[highlighted ? PAN_HI : PAN_UP]); get_channel_positions(value_x, value_y, value_positions, virtual_r, total_values); // draw channels int x1, y1; float scale = (float)(get_w() - PICON_W) / (virtual_r * 2); set_color(RED); for(int i = 0; i < total_values; i++) { // printf("BC_Pan::draw 1 %d %d %d %d\n", // i, // value_positions[i], // value_x[i], // value_y[i]); x1 = (int)(value_x[i] * scale); y1 = (int)(value_y[i] * scale); //printf("BC_Pan::draw 2 %d %d\n", x1, y1); CLAMP(x1, 0, get_w() - PICON_W); CLAMP(y1, 0, get_h() - PICON_H); draw_pixmap(images[PAN_CHANNEL_SMALL], x1, y1); // draw_box(x1, y1, PICON_W, PICON_H); } // draw stick set_color(GREEN); x1 = (int)(stick_x * scale); y1 = (int)(stick_y * scale); //printf("BC_Pan::draw 2 %d %d\n", x1, y1); CLAMP(x1, 0, get_w() - PICON_W); CLAMP(y1, 0, get_h() - PICON_H); draw_pixmap(images[PAN_STICK_SMALL], x1, y1); // x2 = x1 + PICON_W; // y2 = y1 + PICON_H; // draw_line(x1, y1, x2, y2); // draw_line(x2, y1, x1, y2); if(flash) this->flash(0); if(flush) this->flush(); }
int BC_PixmapSW::draw() { draw_top_background(parent_window, 0, 0, get_w(), get_h()); draw_pixmap(thepixmap); flash(); return 0; }
int BC_Pot::draw(int flush) { int x1, y1, x2, y2; draw_top_background(parent_window, 0, 0, get_w(), get_h()); draw_pixmap(images[status]); set_color(get_resources()->pot_needle_color); angle_to_coords(x1, y1, x2, y2, percentage_to_angle(get_percentage())); draw_line(x1, y1, x2, y2); flash(flush); return 0; }
int AboutPrefs::create_objects() { int x, y; BC_Resources *resources = BC_WindowBase::get_resources(); // add_subwindow(new BC_Title(mwindow->theme->preferencestitle_x, // mwindow->theme->preferencestitle_y, // _("About"), // LARGEFONT, // resources->text_default)); x = mwindow->theme->preferencesoptions_x; y = mwindow->theme->preferencesoptions_y + get_text_height(LARGEFONT); set_font(LARGEFONT); set_color(resources->text_default); draw_text(x, y, PROGRAM_NAME " " CINELERRA_VERSION); y += get_text_height(LARGEFONT); set_font(MEDIUMFONT); draw_text(x, y, COPYRIGHTTEXT1 #if defined(COPYRIGHTTEXT2) "\n" COPYRIGHTTEXT2 #endif #if defined(REPOMAINTXT) "\n" REPOMAINTXT #endif ); y += get_text_height(MEDIUMFONT) * 4; char versions[BCTEXTLEN]; sprintf(versions, _("Quicktime version %d.%d.%d (%s)\n" "Libmpeg3 version %d.%d.%d\n"), quicktime_major(), quicktime_minor(), quicktime_release(), FFMPEG_EXTERNALTEXT, mpeg3_major(), mpeg3_minor(), mpeg3_release()); draw_text(x, y, versions); y += get_text_height(MEDIUMFONT) * 3; set_font(LARGEFONT); draw_text(x, y, "Credits:"); y += get_text_height(LARGEFONT); set_font(MEDIUMFONT); char credits[BCTEXTLEN]; sprintf(credits, "Jack Crossfire\n" "Richard Baverstock\n" "Karl Bielefeldt\n" "Kevin Brosius\n" "Jean-Luc Coulon\n" "Jean-Michel POURE\n" "Jerome Cornet\n" "Pierre Marc Dumuid\n" "Alex Ferrer\n" "Jan Gerber\n" "Koen Muylkens\n" "Stefan de Konink\n" "Nathan Kurz\n" "Greg Mekkes\n" "Eric Seigne\n" "Joe Stewart\n" "Dan Streetman\n" #ifdef X_HAVE_UTF8_STRING "Gustavo Iñiguez\n" #else "Gustavo I\361iguez\n" #endif "Johannes Sixt\n" "Mark Taraba\n" "Andraz Tori\n" "Jonas Wulff\n" "David Arendt\n" ); draw_text(x, y, credits); int x_indented; x_indented = x + get_text_width(MEDIUMFONT, "Pierre Marc Dumuid") + 20; char credits_cont1[BCTEXTLEN]; sprintf(credits_cont1, #ifdef X_HAVE_UTF8_STRING "Einar Rünkaru\n" #else "Einar R\374nkaru\n" #endif "Monty Montgomery\n" ); draw_text(x_indented, y, credits_cont1); y = get_h() - 135; set_font(LARGEFONT); draw_text(x, y, "License:"); y += get_text_height(LARGEFONT); set_font(MEDIUMFONT); char license3[BCTEXTLEN]; sprintf(license3, _( "This program is free software; you can redistribute it and/or modify it under the terms\n" "of the GNU General Public License as published by the Free Software Foundation; either version\n" "2 of the License, or (at your option) any later version.\n" "\n" "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n" "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n" "PURPOSE. See the GNU General Public License for more details.\n" "\n")); draw_text(x, y, license3); x = get_w() - mwindow->theme->about_bg->get_w() - 10; y = mwindow->theme->preferencesoptions_y; BC_Pixmap *temp_pixmap = new BC_Pixmap(this, mwindow->theme->about_bg, PIXMAP_ALPHA); draw_pixmap(temp_pixmap, x, y); delete temp_pixmap; x += mwindow->theme->about_bg->get_w() + 10; y += get_text_height(LARGEFONT) * 2; flash(); flush(); return 0; }
/*ARGSUSED*/ static void Leave(Widget wid, XEvent *event, String *params, Cardinal *num_params) { XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)wid; XmPushButtonCallbackStruct call_value; if (Lab_IsMenupane(eb)) { #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) XmDisplay dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(wid)); Boolean etched_in = dpy->display.enable_etched_in_menu; #else Boolean etched_in = False; #endif if (_XmGetInDragMode((Widget)eb) && eb->pushbutton.armed && ( /* !ActiveTearOff || */ event->xcrossing.mode == NotifyNormal)) { eb->pushbutton.armed = FALSE; ((XmManagerWidget) XtParent(wid))->manager.active_child = NULL; if (etched_in && !XmIsTearOffButton(eb)) { XFillRectangle(XtDisplay(eb), XtWindow(eb), eb->pushbutton.background_gc, 0, 0, eb->core.width, eb->core.height); draw_label(eb, event, NULL); draw_pixmap(eb, event, NULL); } else XmeClearBorder (XtDisplay(eb), XtWindow(eb), eb->primitive.highlight_thickness, eb->primitive.highlight_thickness, eb->core.width - 2 * eb->primitive.highlight_thickness, eb->core.height - 2 * eb->primitive.highlight_thickness, eb->primitive.shadow_thickness); if (eb->pushbutton.disarm_callback) { XFlush(XtDisplay(eb)); call_value.reason = (int)XmCR_DISARM; call_value.event = event; XtCallCallbackList((Widget) eb, eb->pushbutton.disarm_callback, &call_value); } } } else { _XmPrimitiveLeave((Widget) eb, event, NULL, NULL); if (eb->pushbutton.armed == TRUE) { XtExposeProc expose; eb->pushbutton.armed = FALSE; XtProcessLock(); expose = XtClass(eb)->core_class.expose; XtProcessUnlock(); (*expose) (wid, event, (Region)NULL); draw_unhighlight(eb); draw_pixmap(eb, event, NULL); eb->pushbutton.armed = TRUE; } else { draw_unhighlight(eb); draw_pixmap(eb, event, NULL); } } }
/*ARGSUSED*/ static void Enter(Widget wid, XEvent *event, String *params, Cardinal *num_params) { XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) wid; XmPushButtonCallbackStruct call_value; if (Lab_IsMenupane(eb)) { if ((((ShellWidget) XtParent(XtParent(eb)))->shell.popped_up) && _XmGetInDragMode((Widget) eb)) { #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) XmDisplay dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(wid)); Boolean etched_in = dpy->display.enable_etched_in_menu; #else Boolean etched_in = False; #endif if (eb->pushbutton.armed) return; /* ...so KHelp event is delivered correctly. */ _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, TRUE); XtSetKeyboardFocus(XtParent(XtParent(eb)), (Widget) eb); _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, FALSE); eb->pushbutton.armed = TRUE; ((XmManagerWidget) XtParent(wid))->manager.active_child = wid; /* etched in menu button */ if (etched_in && !XmIsTearOffButton(eb)) { XFillRectangle(XtDisplay(eb), XtWindow(eb), eb->pushbutton.fill_gc, 0, 0, eb->core.width, eb->core.height); draw_label(eb, event, NULL); draw_pixmap(eb, event, NULL); } if ((eb->core.width > 2 * eb->primitive.highlight_thickness) && (eb->core.height > 2 * eb->primitive.highlight_thickness)) { XmeDrawShadows(XtDisplay(eb), XtWindow(eb), eb->primitive.top_shadow_GC, eb->primitive.bottom_shadow_GC, eb->primitive.highlight_thickness, eb->primitive.highlight_thickness, eb->core.width - 2 * eb->primitive.highlight_thickness, eb->core.height - 2 * eb->primitive.highlight_thickness, eb->primitive.shadow_thickness, (unsigned)(etched_in ? XmSHADOW_IN : XmSHADOW_OUT)); } if (eb->pushbutton.arm_callback) { XFlush(XtDisplay(eb)); call_value.reason = (int)XmCR_ARM; call_value.event = event; XtCallCallbackList((Widget) eb, eb->pushbutton.arm_callback, &call_value); } } } else { XtExposeProc expose; _XmPrimitiveEnter((Widget) eb, event, NULL, NULL); if (eb->pushbutton.armed == TRUE) { XtProcessLock(); expose = XtClass(eb)->core_class.expose; XtProcessUnlock(); (*expose) (wid, event, (Region) NULL); } draw_highlight(eb); draw_shadows(eb); draw_pixmap(eb, event, NULL); } }
int test_move(unsigned short xi, unsigned short yi, char *xpm[], unsigned short hor, short delta, unsigned short time1) { if(xpm == NULL) return 1; char* video_mem = NULL; int failure =0; int width, height; char* pix = NULL; if((pix = (char*) read_xpm(xpm, &width, &height)) == NULL) return 1; if((video_mem=(char *)vg_init(VBE_MODE_RES_1024x768)) == NULL) { printf("test_move(): vg_init() failed"); return 1; } int kbd_irq_set = 0; int timer_irq_set=0; if((kbd_irq_set = kbd_subscribe_int(0)) < 0){//subscribe kbd interrupts printf("test_move(): kbd_subscribe_int() failed \n"); failure = 1; } if((timer_irq_set = timer_subscribe_int()) < 0){//subscribe timer 0 interrupts printf("test_move(): timer_subscribe_int() failed \n"); failure = 1; } int ipc_status; message msg; int r; double step = (double)delta/(time1*60); double xfp = xi; double yfp = yi; if(!failure){ do{ /* Get a request message. */ if ( (r = driver_receive(ANY, &msg, &ipc_status)) != 0 ) { printf("driver_receive failed with: %d", r); continue; } if (is_ipc_notify(ipc_status)) { /* received notification */ switch (_ENDPOINT_P(msg.m_source)) { case HARDWARE: /* hardware interrupt notification */ if (msg.NOTIFY_ARG & kbd_irq_set) /* subscribed kbd interrupt */ if(kbd_int_handler()) failure = 1; if(msg.NOTIFY_ARG & timer_irq_set){ if(get_ticks() < time1 * 60){//enquanto tempo desjado nao passou timer_int_handler(); blank_secondary_buf();//clear buffer draw_pixmap(get_secondary_buf(),(int) xfp, (int) yfp, height, width, pix); commit_to_video_mem(); if(hor) xfp += step;//se movimento horizontal incrementar x else yfp +=step;//senao incrementar y } } break; default: break; /* no other notifications expected: do nothing */ } } else {/* received a standard message, not a notification */ /* no standard messages expected: do nothing */ } } while(get_scancode() != ESC_BREAK && !failure); } if(timer_unsubscribe_int()){//unsubscribe interrupts printf("test_move(): timer_unsubscribe_int() failed\n"); failure = 1; } if(kbd_unsubscribe_int()){//unsubscribe interrupts printf("test_move(): kbd_unsubscribe_int() failed\n"); failure = 1; } printf("Done\n"); if(vg_exit()){ printf("test_move(): vg_exit() failed"); return 1; } return failure; }