1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
/************************************************************************/
/* Ted, main module. */
/************************************************************************/
# include "config.h"
# include <stddef.h>
# include <stdio.h>
# include <appGeo.h>
# include "appDraw.h"
# include <debugon.h>
/************************************************************************/
/* Collect exposures for optimised drawing. */
/************************************************************************/
void appCollectExposures( DocumentRectangle * drClip,
int ox,
int oy,
Display * display,
Window win,
GC gc,
XEvent * event )
{
Region region;
region= XCreateRegion();
XtAddExposureToRegion( event, region );
drClip->drX0= ox+ event->xexpose.x;
drClip->drY0= oy+ event->xexpose.y;
drClip->drX1= ox+ event->xexpose.x+ event->xexpose.width;
drClip->drY1= oy+ event->xexpose.y+ event->xexpose.height;
/*
printf( "======: [%4d+%4d]x[%4d+%4d]\n",
drClip->drX0,
drClip->drX1- drClip->drX0+ 1,
drClip->drY0,
drClip->drY1- drClip->drY0+ 1 );
*/
while( QLength( display ) > 0 )
{
XEvent nextEvent;
DocumentRectangle drMore;
XPeekEvent( display, &nextEvent );
if ( nextEvent.type != Expose && nextEvent.type != GraphicsExpose )
{ break; }
if ( nextEvent.xexpose.window != win )
{ break; }
XNextEvent( display, &nextEvent );
XtAddExposureToRegion( &nextEvent, region );
drMore.drX0= ox+ nextEvent.xexpose.x;
drMore.drY0= oy+ nextEvent.xexpose.y;
drMore.drX1= ox+ nextEvent.xexpose.x+ nextEvent.xexpose.width;
drMore.drY1= oy+ nextEvent.xexpose.y+ nextEvent.xexpose.height;
/*
printf( "++++++: [%4d+%4d]x[%4d+%4d]\n",
drMore.drX0,
drMore.drX1- drMore.drX0+ 1,
drMore.drY0,
drMore.drY1- drMore.drY0+ 1 );
*/
docUnionRectangle( drClip, drClip, &drMore );
/*
printf( "......: [%4d+%4d]x[%4d+%4d]\n",
drClip->drX0,
drClip->drX1- drClip->drX0+ 1,
drClip->drY0,
drClip->drY1- drClip->drY0+ 1 );
*/
}
XSetRegion( display, gc, region );
XDestroyRegion( region );
return;
}
/************************************************************************/
/* Initialise drawing data. */
/************************************************************************/
void appInitDrawingData( AppDrawingData * add )
{
add->sgMagnification= 1.0;
add->addMagnifiedPixelsPerTwip= 0.0;
add->addAfmDirectory= (char *)0;
add->addDisplay= (Display *)0;
appInitFontList( &(add->addPhysicalFontList) );
}
void appCleanDrawingData( AppDrawingData * add )
{
if ( add->addDisplay )
{ appCleanFontList( add->addDisplay, &(add->addPhysicalFontList) ); }
return ;
}
|