static void render_glyph(glyph_entity* ge, const shape_character_def* sh, int fontsize) // Render the given outline shape into a antialiased bitmap { assert(ge); assert(sh); assert(s_render_buffer); // // Tesselate and render the shape into a software buffer. // // Clear the render output to 0. memset(s_render_buffer, 0, s_rendering_box * s_rendering_box); int version = sh->get_player()->get_root()->get_movie_version(); float scale = OVERSAMPLE_FACTOR * fontsize / 1024.0f; // the EM square is 1024 x 1024 // Look at glyph bounds; adjust origin to make sure // the shape will fit in our output in left-top corner. rect glyph_bounds; sh->compute_bound(&glyph_bounds); float offset_x = - glyph_bounds.m_x_min; float offset_y = - glyph_bounds.m_y_min; s_render_matrix.set_identity(); s_render_matrix.concatenate_scale(version > 7 ? scale / 20.0f : scale); s_render_matrix.concatenate_translation(offset_x, offset_y); // Tesselate & draw the shape. draw_into_software_buffer accepter; sh->tesselate( (float) s_rendering_box / (float) s_glyph_render_size * 0.5f, &accepter); antialias(); // print_glyph(s_render_buffer, s_rendering_box, s_rendering_box); // print_glyph(s_image_buffer, GLYPH_CACHE_TEXTURE_SIZE, GLYPH_CACHE_TEXTURE_SIZE); ge->m_bi = render::create_bitmap_info_alpha(GLYPH_CACHE_TEXTURE_SIZE, GLYPH_CACHE_TEXTURE_SIZE, s_image_buffer); // Fill in rendered_glyph_info. scale = version > 7 ? 1024 * 20 : 1024; scale /= fontsize / (float) GLYPH_CACHE_TEXTURE_SIZE; ge->m_bounds.m_x_min = offset_x / scale; ge->m_bounds.m_x_max = 1; ge->m_bounds.m_y_min = offset_y / scale; ge->m_bounds.m_y_max = 1; }
int QtGnuplotWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 8) qt_static_metacall(this, _c, _id, _a); _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = antialias(); break; case 1: *reinterpret_cast< bool*>(_v) = rounded(); break; case 2: *reinterpret_cast< bool*>(_v) = replotOnResize(); break; case 3: *reinterpret_cast< QColor*>(_v) = backgroundColor(); break; case 4: *reinterpret_cast< bool*>(_v) = statusLabelActive(); break; } _id -= 5; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setAntialias(*reinterpret_cast< bool*>(_v)); break; case 1: setRounded(*reinterpret_cast< bool*>(_v)); break; case 2: setReplotOnResize(*reinterpret_cast< bool*>(_v)); break; case 3: setBackgroundColor(*reinterpret_cast< QColor*>(_v)); break; case 4: setStatusLabelActive(*reinterpret_cast< bool*>(_v)); break; } _id -= 5; } else if (_c == QMetaObject::ResetProperty) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 5; } #endif // QT_NO_PROPERTIES return _id; }
JSValue JSHTMLCanvasElement::getContext(ExecState* exec) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); const UString& contextId = exec->argument(0).toString(exec)->value(exec); RefPtr<CanvasContextAttributes> attrs; #if ENABLE(WEBGL) if (contextId == "experimental-webgl" || contextId == "webkit-3d") { attrs = WebGLContextAttributes::create(); WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get()); if (exec->argumentCount() > 1 && exec->argument(1).isObject()) { JSObject* jsAttrs = exec->argument(1).getObject(); Identifier alpha(exec, "alpha"); if (jsAttrs->hasProperty(exec, alpha)) webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean(exec)); Identifier depth(exec, "depth"); if (jsAttrs->hasProperty(exec, depth)) webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean(exec)); Identifier stencil(exec, "stencil"); if (jsAttrs->hasProperty(exec, stencil)) webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean(exec)); Identifier antialias(exec, "antialias"); if (jsAttrs->hasProperty(exec, antialias)) webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean(exec)); Identifier premultipliedAlpha(exec, "premultipliedAlpha"); if (jsAttrs->hasProperty(exec, premultipliedAlpha)) webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec)); Identifier preserveDrawingBuffer(exec, "preserveDrawingBuffer"); if (jsAttrs->hasProperty(exec, preserveDrawingBuffer)) webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean(exec)); } } #endif CanvasRenderingContext* context = canvas->getContext(ustringToString(contextId), attrs.get()); if (!context) return jsNull(); JSValue jsValue = toJS(exec, globalObject(), WTF::getPtr(context)); #if ENABLE(WEBGL) if (context->is3d() && InspectorInstrumentation::hasFrontends()) { ScriptObject glContext(exec, jsValue.getObject()); ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(canvas->document(), glContext); if (!wrapped.hasNoValue()) return wrapped.jsValue(); } #endif return jsValue; }
void ShowScene2(int mode, int view_mode, int quad, GLint s_left, GLint s_down){ if(rotation_type==EYE_CENTERED&&nskyboxinfo>0)draw_skybox(); if(UpdateLIGHTS==1)updateLights(light_position0,light_position1); if(mode==DRAWSCENE){ glPointSize((float)1.0); /* ++++++++++++++++++++++++ draw trees +++++++++++++++++++++++++ */ if(ntreeinfo>0){ CLIP_GEOMETRY; drawtrees(); SNIFF_ERRORS("after drawtrees"); } /* ++++++++++++++++++++++++ draw particles +++++++++++++++++++++++++ */ if(showsmoke==1){ CLIP_VALS; drawpart_frame(); } /* ++++++++++++++++++++++++ draw evacuation +++++++++++++++++++++++++ */ if(showevac==1){ CLIP_VALS; drawevac_frame(); } /* ++++++++++++++++++++++++ draw targets +++++++++++++++++++++++++ */ if(showtarget==1){ CLIP_VALS; drawTargets(); } #ifdef pp_GEOMTEST if(show_geomtest==1){ CLIP_GEOMETRY; draw_geomtestclip(); draw_geomtestoutline(); } if(show_cutcells==1)draw_geom_cutcells(); #endif /* ++++++++++++++++++++++++ draw circular vents +++++++++++++++++++++++++ */ if(ncvents>0&&visCircularVents!=VENT_HIDE){ CLIP_GEOMETRY; DrawCircVents(visCircularVents); } /* ++++++++++++++++++++++++ draw sensors/sprinklers/heat detectors +++++++++++++++++++++++++ */ CLIP_GEOMETRY; draw_devices(); #ifdef pp_PILOT draw_pilot(); #endif SNIFF_ERRORS("after draw_devices"); if(visaxislabels==1){ UNCLIP; outputAxisLabels(); SNIFF_ERRORS("after outputAxisLables"); } /* ++++++++++++++++++++++++ draw user ticks +++++++++++++++++++++++++ */ if(visUSERticks==1){ antialias(ON); UNCLIP; draw_user_ticks(); antialias(OFF); SNIFF_ERRORS("after drawticks"); } /* ++++++++++++++++++++++++ draw ticks +++++++++++++++++++++++++ */ if(visFDSticks==1&&ntickinfo>0){ UNCLIP; drawticks(); SNIFF_ERRORS("after drawticks"); } /* ++++++++++++++++++++++++ draw ticks +++++++++++++++++++++++++ */ if(showgravity==1){ UNCLIP; drawaxis(); SNIFF_ERRORS("after drawaxis"); } /* draw the box framing the simulation (corners at (0,0,0) (xbar,ybar,zbar) */ /* ++++++++++++++++++++++++ draw simulation frame (corners at (0,0,0) and (xbar,ybar,zbar) +++++++++++++++++++++++++ */ if(isZoneFireModel==0&&visFrame==1&&highlight_flag==2){ CLIP_GEOMETRY; drawoutlines(); SNIFF_ERRORS("after drawoutlines"); } if(show_rotation_center==1){ unsigned char pcolor[4]; CLIP_GEOMETRY; glPushMatrix(); glTranslatef(camera_current->xcen,camera_current->ycen,camera_current->zcen); pcolor[0]=255*foregroundcolor[0]; pcolor[1]=255*foregroundcolor[1]; pcolor[2]=255*foregroundcolor[2]; drawsphere(0.03,pcolor); glPopMatrix(); } /* ++++++++++++++++++++++++ draw mesh +++++++++++++++++++++++++ */ if(setPDIM==1){ if(visGrid!=noGridnoProbe){ int igrid; mesh *meshi; UNCLIP; for(igrid=0;igrid<nmeshes;igrid++){ meshi=meshinfo+igrid; drawgrid(meshi); SNIFF_ERRORS("drawgrid"); } } } } /* end of if(mode==DRAWSCENE) code segment */ /* ++++++++++++++++++++++++ draw selected devices +++++++++++++++++++++++++ */ if(mode==SELECTOBJECT){ if(select_device==1){ CLIP_GEOMETRY; draw_devices(); SNIFF_ERRORS("after drawselect_devices"); return; } } /* ++++++++++++++++++++++++ draw selected avatars +++++++++++++++++++++++++ */ if(mode==SELECTOBJECT){ if(select_avatar==1){ CLIP_GEOMETRY; drawselect_avatars(); SNIFF_ERRORS("after drawselect_avatars"); return; } } /* ++++++++++++++++++++++++ draw selected tours +++++++++++++++++++++++++ */ if(mode==SELECTOBJECT){ if(edittour==1&&ntours>0){ CLIP_GEOMETRY; drawselect_tours(); SNIFF_ERRORS("after drawselect_tours"); return; } } /* ++++++++++++++++++++++++ draw tours +++++++++++++++++++++++++ */ if(showtours==1){ CLIP_GEOMETRY; drawtours(); SNIFF_ERRORS("after drawtours"); } /* ++++++++++++++++++++++++ draw stereo parallax indicator +++++++++++++++++++++++++ */ if(show_parallax==1){ UNCLIP; antialias(ON); glLineWidth(linewidth); glBegin(GL_LINES); glColor3fv(foregroundcolor); glVertex3f(0.75,0.0,0.25); glVertex3f(0.75,1.0,0.25); glEnd(); antialias(OFF); } /* ++++++++++++++++++++++++ draw blockages +++++++++++++++++++++++++ */ CLIP_GEOMETRY; drawBlockages(mode,DRAW_OPAQUE); SNIFF_ERRORS("drawBlockages"); /* ++++++++++++++++++++++++ draw triangles +++++++++++++++++++++++++ */ if(ngeominfoptrs>0){ CLIP_GEOMETRY; draw_geom(DRAW_OPAQUE,GEOM_STATIC); draw_geom(DRAW_OPAQUE,GEOM_DYNAMIC); } /* ++++++++++++++++++++++++ draw shooter points +++++++++++++++++++++++++ */ if(showshooter!=0&&shooter_active==1){ CLIP_VALS; draw_shooter(); } /* ++++++++++++++++++++++++ draw terrain +++++++++++++++++++++++++ */ if(visTerrainType!=TERRAIN_HIDDEN&&nterraininfo>0){ int i; //shaded 17 0 //stepped 18 1 //line 19 2 //texture 20 3 //hidden 20 4 CLIP_GEOMETRY; for(i=0;i<nterraininfo;i++){ terraindata *terri; int only_geom; terri = terraininfo + i; if(terri->loaded==1){ only_geom=0; } else{ only_geom=1; } switch(visTerrainType){ case TERRAIN_3D: drawterrain(terri,only_geom); break; case TERRAIN_2D_STEPPED: if(cullfaces==1)glDisable(GL_CULL_FACE); glPushMatrix(); glScalef(SCALE2SMV(1.0),SCALE2SMV(1.0),SCALE2SMV(1.0)); glTranslatef(-xbar0,-ybar0,-zbar0); DrawContours(&meshinfo[i].terrain_contour); glPopMatrix(); if(cullfaces==1)glEnable(GL_CULL_FACE); break; case TERRAIN_2D_LINE: glPushMatrix(); glScalef(SCALE2SMV(1.0),SCALE2SMV(1.0),SCALE2SMV(1.0)); glTranslatef(-xbar0,-ybar0,-zbar0); DrawLineContours(&meshinfo[i].terrain_contour,1.0); glPopMatrix(); break; case TERRAIN_3D_MAP: if(terrain_texture!=NULL&&terrain_texture->loaded==1){ drawterrain_texture(terri,only_geom); } else{ drawterrain(terri,only_geom); } break; default: ASSERT(FFALSE); break; } } } /* ++++++++++++++++++++++++ draw slice files +++++++++++++++++++++++++ */ if(show_gslice_triangles==1||show_gslice_normal==1||show_gslice_normal_keyboard==1||show_gslice_triangulation==1){ CLIP_VALS; drawgslice_outline(); } if((show_slices_and_vectors==1&&showvslice==1)||(showslice==1&&use_transparency_data==0)){ CLIP_VALS; drawslice_frame(); } /* ++++++++++++++++++++++++ draw boundary files +++++++++++++++++++++++++ */ if(showpatch==1){ CLIP_VALS; drawpatch_frame(); } /* ++++++++++++++++++++++++ draw labels +++++++++++++++++++++++++ */ if(visLabels==1){ CLIP_GEOMETRY; drawLabels(); } /* ++++++++++++++++++++++++ draw animated isosurfaces +++++++++++++++++++++++++ */ //if(isoinfo!=NULL)drawspherepoints(sphereinfo); if(showiso==1){ CLIP_VALS; drawiso(DRAW_OPAQUE); } /* ++++++++++++++++++++++++ draw zone fire modeling info +++++++++++++++++++++++++ */ if(nrooms>0){ CLIP_GEOMETRY; drawroomgeom(); SNIFF_ERRORS("after drawroomgeom"); } if(nrooms>0){ if(showzone==1){ CLIP_VALS; drawfiredata(); SNIFF_ERRORS("after drawroomdata"); if(ReadZoneFile==1&&nzvents>0){ drawventdata(); SNIFF_ERRORS("after drawventdata"); } } } //********************************************************************************** //********************************************************************************** //********************************************************************************** // nothing transparent should be drawn before this portion of the code // (ie draw all opaque objects first then draw transparent objects //********************************************************************************** //********************************************************************************** //********************************************************************************** /* ++++++++++++++++++++++++ draw triangles +++++++++++++++++++++++++ */ if(ngeominfoptrs>0){ CLIP_GEOMETRY; draw_geom(DRAW_TRANSPARENT,GEOM_STATIC); draw_geom(DRAW_TRANSPARENT,GEOM_DYNAMIC); } if(showiso==1){ CLIP_VALS; drawiso(DRAW_TRANSPARENT); } /* ++++++++++++++++++++++++ draw transparent faces +++++++++++++++++++++++++ */ CLIP_GEOMETRY; draw_transparent_faces(); /* ++++++++++++++++++++++++ draw 3D smoke +++++++++++++++++++++++++ */ if(show3dsmoke==1||showvolrender==1){ CLIP_VALS; drawsmoke_frame(); } if(active_smokesensors==1&&show_smokesensors!=0){ CLIP_VALS; getsmokesensors(); draw_devices_val(); } /* ++++++++++++++++++++++++ draw zone fire modeling info +++++++++++++++++++++++++ */ if(nrooms>0&&showzone==1){ CLIP_VALS; drawroomdata(); SNIFF_ERRORS("after drawroomdata"); } /* ++++++++++++++++++++++++ draw slice files +++++++++++++++++++++++++ */ if((show_slices_and_vectors==1&&showvslice==1)||(showslice==1&&use_transparency_data==1)){ CLIP_VALS; drawslice_frame(); SNIFF_ERRORS("after drawslice_frame"); } /* ++++++++++++++++++++++++ draw transparent blockages +++++++++++++++++++++++++ */ // draw_demo(20,20); // draw_demo2(1); CLIP_GEOMETRY; drawBlockages(mode,DRAW_TRANSPARENT); SNIFF_ERRORS("after drawBlokcages"); /* ++++++++++++++++++++++++ draw vector slice files +++++++++++++++++++++++++ */ if(showvslice==1){ CLIP_VALS; drawvslice_frame(); } SNIFF_ERRORS("after drawvslice"); /* ++++++++++++++++++++++++ draw plot3d files +++++++++++++++++++++++++ */ if(showplot3d==1){ CLIP_VALS; drawplot3d_frame(); } SNIFF_ERRORS("after drawplot3d"); }