void Fl_Tool_Bar::draw() { int n; if(opened()) { // make it not draw the inside label: int saved = flags(); align(FL_ALIGN_TOP); if(damage() & ~FL_DAMAGE_CHILD) { draw_frame(); fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh()); for (n = children(); n--;) draw_child(*child(n)); draw_box(); draw_inside_label(); fl_pop_clip(); if(m_menubut->visible()) { fl_push_clip(w()-box()->dw()-(m_menubut->visible()?20:0), box()->dy(), 30, h()-box()->dh()); draw_child(*m_menubut); draw_box(); fl_pop_clip(); } for (n = 0; n < children(); n++) draw_outside_label(*child(n)); } else { fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh()); for(n = 0; n < children(); n++) { Fl_Widget& w = *child(n); if (w.damage() & FL_DAMAGE_CHILD_LABEL) { draw_outside_label(w); w.set_damage(w.damage() & ~FL_DAMAGE_CHILD_LABEL); } update_child(w); } fl_pop_clip(); } flags(saved); if (damage() & (FL_DAMAGE_EXPOSE|FL_DAMAGE_HIGHLIGHT|FL_DAMAGE_ALL)) { Fl_Flags f = 0; if (pushed) f.set(FL_VALUE); if (highlighted) f.set(FL_HIGHLIGHT); draw_glyph(0, 0, 0, glyph_size(), h(), f); } } else Fl_Bar::draw(); }
void Flu_Collapsable_Group :: draw() { int X; FluSimpleString l = open() ? "- " : "+ "; l += label(); button.label( l.c_str() ); // force fit the button if necessary if( _fit ) button.size( w()-12, button.labelsize()+6 ); else { // otherwise make it as big as its label int W = 0, H = 0; fl_font( button.labelfont(), button.labelsize() ); fl_measure( button.label(), W, H ); button.size( W+6, button.h() ); } // align the button if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - button.w() - 8; else X = w()/2 - button.w()/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+button.h()/2, w(), h()-button.h()/2, color() ); // clip and draw the internal group fl_clip( x()+2, y()+button.h()+1, w()-4, h()-button.h()-3 ); if( _changing ) { if( !_open ) group.resize( x(), y()-_originalHeight+(int)_currentHeight+_BUTTON_HEIGHT, w(), _originalHeight ); else group.resize( x(), y()-_newHeight+(int)_currentHeight+_BUTTON_HEIGHT, w(), _newHeight ); } draw_child( group ); fl_pop_clip(); // clear behind the button, resize, and draw fl_color( color() ); fl_rectf( x()+X, y(), button.w()+4, button.h() ); button.position( x()+X+2, y() ); draw_child( button ); button.label( 0 ); }
static int draw_child(struct sprite *s, struct srt *srt, struct sprite_trans * ts) { struct sprite_trans temp; struct matrix temp_matrix; struct sprite_trans *t = trans_mul(&s->t, ts, &temp, &temp_matrix); switch (s->type) { case TYPE_PICTURE: switch_program(t, PROGRAM_PICTURE); sprite_drawquad(s->s.pic, srt, t); return 0; case TYPE_POLYGON: switch_program(t, PROGRAM_PICTURE); sprite_drawpolygon(s->s.poly, srt, t); return 0; case TYPE_LABEL: if (s->data.text) { switch_program(t, s->s.label->edge ? PROGRAM_TEXT_EDGE : PROGRAM_TEXT); label_draw(s->data.text, s->s.label,srt,t); } return 0; case TYPE_ANCHOR: anchor_update(s, srt, t); return 0; case TYPE_ANIMATION: break; case TYPE_PANNEL: if (s->data.scissor) { // enable scissor set_scissor(s->s.pannel, srt, t); return 1; } else { return 0; } default: // todo : invalid type return 0; } // draw animation struct pack_animation *ani = s->s.ani; int frame = real_frame(s) + s->start_frame; struct pack_frame * pf = &ani->frame[frame]; int i; int scissor = 0; for (i=0;i<pf->n;i++) { struct pack_part *pp = &pf->part[i]; int index = pp->component_id; struct sprite * child = s->data.children[index]; if (child == NULL || child->visible == false) { continue; } struct sprite_trans temp2; struct matrix temp_matrix2; struct sprite_trans *ct = trans_mul(&pp->t, t, &temp2, &temp_matrix2); scissor += draw_child(child, srt, ct); } for (i=0;i<scissor;i++) { scissor_pop(); } return 0; }
void Fl_Popup_ListView::draw() { draw_frame(); if((damage() & ~FL_DAMAGE_CHILD)) draw_child(*m_listView); else update_child(*m_listView); //Fl_Popup_Window::draw(); }
void Flu_Choice_Group :: draw() { int i; // make sure the selected child is still a child bool found = false; for( i = 1; i < children(); i++ ) if( child(i) == selected ) { found = true; break; } if( !found ) selected = NULL; if( !selected && children() > 1 ) value( child(1) ); int lblW = 0, lblH = 0, X; for( i = 1; i < children(); i++ ) { int W = 0, H; fl_measure( child(i)->label(), W, H ); if( W > lblW ) lblW = W; if( H > lblH ) lblH = H; } lblW += 26; lblH += 6; // align the label if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - lblW - 8; else X = w()/2 - lblW/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+lblH/2, w(), h()-lblH/2, color() ); // clip and draw the children choice->resize( choice->x(), choice->y(), 0, 0 ); fl_clip( x()+2, y()+lblH+1, w()-4, h()-lblH-3 ); draw_children(); fl_pop_clip(); // clear behind the button and draw it fl_color( color() ); fl_rectf( x()+X, y(), lblW+4, lblH ); fl_color( labelcolor() ); choice->resize( x()+X+2, y(), lblW, lblH ); draw_child( *choice ); }
void sprite_draw_as_child(struct sprite *s, struct srt *srt, struct matrix *mat, uint32_t color) { if (s->visible) { struct sprite_trans st; st.mat = mat; st.color = color; st.additive = 0; st.program = PROGRAM_DEFAULT; draw_child(s, srt, &st); } }
void display_menu( menu_entry menu_entries[][AL_ENTRIES_PER_MENU], unsigned int menu_id ) { unsigned int i = 0; clear_menu(); for( i = 0; i < AL_ENTRIES_PER_MENU; i++ ) { switch( menu_entries[menu_id][i].type ) { case AL_MENU_TYPE_PARENT: draw_parent( i ); PrintMini( ( i * 21 ) + 4, 58, ( const unsigned char * )menu_entries[menu_id][i].name, MINI_REV ); break; case AL_MENU_TYPE_CHILD: draw_child( i ); PrintMini( ( i * 21 ) + 4, 58, ( const unsigned char * )menu_entries[menu_id][i].name, 0 ); break; case AL_MENU_TYPE_UP: draw_child( i ); PrintMini( ( i * 21 ) + 10, 58, ( const unsigned char * )AL_MENU_UP, 0 ); break; case AL_MENU_TYPE_PAGE_PREV: draw_child( i ); PrintMini( ( i * 21 ) + 10, 58, ( const unsigned char * )AL_MENU_PREV, 0 ); break; case AL_MENU_TYPE_PAGE_NEXT: draw_child( i ); PrintMini( ( i * 21 ) + 10, 58, ( const unsigned char * )AL_MENU_NEXT, 0 ); break; case AL_MENU_TYPE_EMPTY: default: break; } } }
void Flu_Combo_Box :: draw() { int W = 18, H = h()-4; int X = x()+w()-W-2, Y = y()+2; fl_draw_box( box(), x(), y(), w(), h(), color() ); // draw the arrow button fl_draw_box( (Fl_Boxtype)_valbox, X, Y, W, H, color() ); fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive(FL_FOREGROUND_COLOR) ); fl_polygon( X+W/2-5, Y+H/2-2, X+W/2+3, Y+H/2-2, X+W/2-1, Y+H/2+2 ); draw_child( input ); if( Fl::focus() == this ) draw_focus( FL_NO_BOX, input.x(), input.y(), input.w(), input.h() ); }
void sprite_draw(struct sprite *s, struct srt *srt) { if (s->visible) { draw_child(s, srt, NULL); } }
void draw_scene(void) { if (point_general->changement) { recalc_perspective(); if (point_general->effect > EFFECT_NUMBER - 1) { point_general->effect = 0; if (gen_gl_texture(knotbg)) upload_gl_texture(background_image); use_gl_texture(knotbg); } if (point_general->effect == 4) { if (gen_gl_texture(tunnel)) upload_gl_texture(tunnel_image); use_gl_texture(tunnel); } if (point_general->effect == 5) { if (gen_gl_texture(tentacle)) upload_gl_texture(tentacle_image); use_gl_texture(tentacle); } if (point_general->effect == 6) { if (gen_gl_texture(twist)) upload_gl_texture(twist_image); if (gen_gl_texture(twistbg)) upload_gl_texture(background_image); use_gl_texture(twist); } if (point_general->effect == 7) { if (gen_gl_texture(texchild)) upload_gl_texture(child_image); if (gen_gl_texture(childbg)) upload_gl_texture(energy_image); use_gl_texture(texchild); } if (point_general->effect == 8) { if (gen_gl_texture(energy)) upload_gl_texture(energy_image); use_gl_texture(energy); } point_general->changement = FALSE; } switch (point_general->effect) { case 0: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_knot(); break; case 1: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_spectrum(); break; case 2: if (!point_general->init) init_effect(); glEnable(GL_LIGHTING); draw_face(); break; case 3: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_glthreads(); break; case 4: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_tunnel(); break; case 5: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_tentacles(); break; case 6: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_twist(); break; case 7: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_child(); break; case 8: if (!point_general->init) init_effect(); glDisable(GL_LIGHTING); draw_energy(); break; default: break; } }
void surface_semaphore_test(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& mainInfo, const sk_gpu_test::ContextInfo& childInfo1, const sk_gpu_test::ContextInfo& childInfo2, bool flushContext) { GrContext* mainCtx = mainInfo.grContext(); if (!mainCtx->caps()->fenceSyncSupport()) { return; } const SkImageInfo ii = SkImageInfo::Make(MAIN_W, MAIN_H, kRGBA_8888_SkColorType, kPremul_SkAlphaType); sk_sp<SkSurface> mainSurface(SkSurface::MakeRenderTarget(mainCtx, SkBudgeted::kNo, ii, 0, kTopLeft_GrSurfaceOrigin, nullptr)); SkCanvas* mainCanvas = mainSurface->getCanvas(); mainCanvas->clear(SK_ColorBLUE); SkAutoTArray<GrBackendSemaphore> semaphores(2); #ifdef SK_VULKAN if (kVulkan_GrBackend == mainInfo.backend()) { // Initialize the secondary semaphore instead of having Ganesh create one internally GrVkGpu* gpu = static_cast<GrVkGpu*>(mainCtx->contextPriv().getGpu()); const GrVkInterface* interface = gpu->vkInterface(); VkDevice device = gpu->device(); VkSemaphore vkSem; VkSemaphoreCreateInfo createInfo; createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; createInfo.pNext = nullptr; createInfo.flags = 0; GR_VK_CALL_ERRCHECK(interface, CreateSemaphore(device, &createInfo, nullptr, &vkSem)); semaphores[1].initVulkan(vkSem); } #endif if (flushContext) { mainCtx->flushAndSignalSemaphores(2, semaphores.get()); } else { mainSurface->flushAndSignalSemaphores(2, semaphores.get()); } sk_sp<SkImage> mainImage = mainSurface->makeImageSnapshot(); GrBackendTexture backendTexture = mainImage->getBackendTexture(false); draw_child(reporter, childInfo1, backendTexture, semaphores[0]); #ifdef SK_VULKAN if (kVulkan_GrBackend == mainInfo.backend()) { // In Vulkan we need to make sure we are sending the correct VkImageLayout in with the // backendImage. After the first child draw the layout gets changed to SHADER_READ, so // we just manually set that here. GrVkImageInfo vkInfo; SkAssertResult(backendTexture.getVkImageInfo(&vkInfo)); vkInfo.updateImageLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); } #endif draw_child(reporter, childInfo2, backendTexture, semaphores[1]); }
void Fl_Canvas::draw() { Fl_Widget*const* a = array(); if (damage() & ~FL_DAMAGE_CHILD) // redraw the entire thing: { if (m_BG) { int X=0,Y=0; while (Y<w()) { while (X<h()) { m_BG->draw(parent()->x()+X,parent()->y()+Y); #if FL_MAJOR_VERSION == 1 && FL_MINOR_VERSION == 0 X+=m_BG->w; #else X+=m_BG->w(); #endif } #if FL_MAJOR_VERSION == 1 && FL_MINOR_VERSION == 0 Y+=m_BG->h; #else Y+=m_BG->h(); #endif X=0; } } else { draw_box(); } // draw minimised modules first for (int i=children(); i--;) { Fl_Widget& o = **a++; if (((Fl_DeviceGUI*)&o)->IsMinimised()) { draw_child(o); draw_outside_label(o); std::vector<int>::iterator sel = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), ((Fl_DeviceGUI*)&o)->GetID() ); if (sel != m_Selection.m_DeviceIds.end()) { fl_color(FL_YELLOW); fl_rect(o.x(), o.y(), o.w(), o.h()); } } } DrawWires(); // draw maximised modules on top of everything else Fl_Widget*const* a = array(); for (int i=children(); i--;) { Fl_Widget& o = **a++; if (!((Fl_DeviceGUI*)&o)->IsMinimised()) { draw_child(o); draw_outside_label(o); std::vector<int>::iterator sel = std::find( m_Selection.m_DeviceIds.begin(), m_Selection.m_DeviceIds.end(), ((Fl_DeviceGUI*)&o)->GetID() ); if (sel != m_Selection.m_DeviceIds.end()) { fl_color(FL_YELLOW); fl_rect(o.x(), o.y(), o.w(), o.h()); } } } } else // only redraw the children that need it: { for (int i=children(); i--;) update_child(**a++); } DrawSelection(); }
void Flu_Toggle_Group :: draw() { int lblW = 0, lblH, X, i; if( label() == 0 ) lblW = lblH = 0; else if( strlen( label() ) == 0 ) lblW = lblH = 0; else { measure_label( lblW, lblH ); lblW += 18; lblH += 2; } // align the label if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - lblW - 8; else X = w()/2 - lblW/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+lblH/2, w(), h()-lblH/2, color() ); unsigned char *active = 0; if( !chkBtn->value() ) { active = (unsigned char*)malloc( children() ); for( i = 1; i < children(); i++ ) { active[i-1] = child(i)->active(); child(i)->deactivate(); } } // clip and draw the children chkBtn->resize( chkBtn->x(), chkBtn->y(), 0, 0 ); fl_clip( x()+2, y()+lblH+1, w()-4, h()-lblH-3 ); draw_children(); fl_pop_clip(); // clear behind the button and draw it fl_color( color() ); fl_rectf( x()+X, y(), lblW+4, lblH ); fl_color( labelcolor() ); chkBtn->label( label() ); chkBtn->resize( x()+X+2, y(), lblW, lblH ); draw_child( *chkBtn ); if( !chkBtn->value() ) { for( i = 1; i < children(); i++ ) { if( active[i-1] ) child(i)->activate(); else child(i)->deactivate(); } free( active ); } }