int GdBeginDr(Drauing *drawing, GpBox *damage, int landscape) { int needToRedraw= 0; Engine *eng; if (damage) { /* If drawing has incurred damage, report damage to ALL engines interested in the drawing (not just active engines). */ for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng)) if (eng->drawing==drawing) GpDamage(eng, drawing, damage); } /* Loop on active engines to alert them that drawing is coming. */ for (eng=GpNextActive(0) ; eng ; eng=GpNextActive(eng)) { if (eng->drawing!=drawing) { /* This engine is not marked as interested in this drawing. Mark it, and reset damaged and lastDrawn flags so that no elements will be inhibited. */ eng->drawing= drawing; eng->lastDrawn= -1; eng->damaged= 0; if (landscape != eng->landscape) { eng->landscape= landscape; /* This change will be detected and acted upon by the first call to the ChangeMap method (GpSetTrans). */ } /* The semantics here are subtle -- After a ClearDrawing, GdDetach zeroes eng->drawing in order to communicate that the drawing has been cleared. Thus, the code gets here on a GdDraw after the drawing has been cleared, so the time has come to carry out the deferred clearing of this engine's plotting surface. */ GpClear(eng, CONDITIONALLY); needToRedraw= 1; } else if (eng->damaged) { /* This engine was interested in the drawing, which has been damaged. Clear damaged area in preparation for repair work. (This is redundant if the damage was due to an X windows expose event, but the resulting inefficiency is very small.) */ eng->ClearArea(eng, &eng->damage); needToRedraw= 1; } else if (eng->lastDrawn<drawing->nElements-1) { needToRedraw= 1; } } gdNowRendering= gdMaxRendered= -1; return needToRedraw; }
void GhHCP(void) { Engine *hcp= currentDevice<0? 0 : ghDevices[currentDevice].hcp; if (!hcp) hcp= hcpDefault; if (!hcp) return; GpPreempt(hcp); if (gdraw_hook) gdraw_hook(hcp, 4); GdDraw(0); /* NB- must be very careful not to Preempt twice with GdDrawLegends */ if (ghDevices[currentDevice].doLegends) GdDrawLegends(0); GpClear(0, ALWAYS); GpFlush(0); if (gdraw_hook) gdraw_hook(hcp, 5); GpPreempt(0); }
void GhFMA(void) { Engine *display; Engine *hcp= 0; if (currentDevice<0) return; display= ghDevices[currentDevice].display; if (animateOn && !display) animateOn= 0; if (hcpOn) { hcp= ghDevices[currentDevice].hcp; if (!hcp) hcp= hcpDefault; if (hcp) GpActivate(hcp); } if (gdraw_hook) gdraw_hook(display, 2); GdDraw(1); if (hcpOn && hcp && ghDevices[currentDevice].doLegends) GdDrawLegends(hcp); if (animateOn) GxStrobe(display, 1); GpFlush(0); if (animateOn!=1) GdClear(0); else GdClearSystem(); if (gdraw_hook) gdraw_hook(display, 3); if (hcpOn && hcp) { GpClear(hcp, CONDITIONALLY); GpDeactivate(hcp); } ghDevices[currentDevice].fmaCount++; if (++fmaCount > 100) { /* clean house once in a while */ fmaCount= 0; GaFreeScratch(); } }