(file) Return to xaaNonTEText.c CVS log (file) (dir) Up to [XFree86 CVS] / xc / programs / Xserver / hw / xfree86 / xaa

  1 tsi   1.15 /* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaNonTEText.c,v 1.14tsi Exp $ */
  2 dawes 1.2  
  3            /********************************************************************
  4            
  5               In this file we have GC level replacements for PolyText8/16,
  6               ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional) 
  7               fonts. The idea is that everything in this file is device independent.
  8               The mentioned GCOps are merely wrappers for the 
  9               PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
 10               functions which calculate the boxes containing arbitrarily clipped 
 11               text and passes them to the NonTEGlyphRenderer which will usually 
 12               be a lower level XAA function which renders these clipped glyphs using
 13               the basic color expansion functions exported by the chipset driver.
 14               The NonTEGlyphRenderer itself may optionally be driver supplied to
 15               facilitate work-arounds/optimizations at a higher level than usual.
 16            
 17 dawes 1.5     Written by Mark Vojkovich (mvojkovi@ucsd.edu)
 18 dawes 1.2  
 19            ********************************************************************/
 20            
 21            #include "misc.h"
 22            #include "xf86.h"
 23            #include "xf86_ansic.h"
 24            #include "xf86_OSproc.h"
 25            
 26 tsi   1.15 #include <X11/X.h>
 27            #include <X11/fonts/font.h>
 28 dawes 1.2  #include "scrnintstr.h"
 29            #include "dixfontstr.h"
 30            #include "xf86str.h"
 31            #include "xaa.h"
 32 dawes 1.8  #include "xaacexp.h"
 33 dawes 1.2  #include "xaalocal.h"
 34            #include "gcstruct.h"
 35            #include "pixmapstr.h"
 36            
 37            
 38            static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
 39            				int xInit, int yInit, FontPtr font,
 40 dawes 1.8  				int fg, int bg, unsigned planemask,
 41 dawes 1.2  				RegionPtr cclip, int nglyph,
 42            				unsigned char* gBase, CharInfoPtr *ppci);
 43 dawes 1.5  static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
 44 dawes 1.2  				int xInit, int yInit, FontPtr font,
 45            				int fg, int rop, unsigned planemask,
 46            				RegionPtr cclip, int nglyph,
 47            				unsigned char* gBase, CharInfoPtr *ppci);
 48            
 49            /********************************************************************
 50            
 51               GC level replacements for PolyText8/16 and ImageText8/16
 52               for NonTE fonts when using color expansion.
 53            
 54            ********************************************************************/
 55            
 56            
 57            int
 58            XAAPolyText8NonTEColorExpansion(
 59                DrawablePtr pDraw,
 60                GCPtr	pGC,
 61                int		x, 
 62                int 	y,
 63                int 	count,
 64                char	*chars )
 65 dawes 1.2  {
 66                XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
 67 dawes 1.5      unsigned long n;
 68                int width = 0;
 69 dawes 1.2  
 70 dawes 1.5      (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count, 
 71            		(unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
 72 dawes 1.2  
 73 dawes 1.5      if(n) {
 74            	width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn, 
 75            		x + pDraw->x, y + pDraw->y, pGC->font, 
 76            		pGC->fgPixel, pGC->alu, pGC->planemask, 
 77            		pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
 78             		infoRec->CharInfo);
 79                }
 80 dawes 1.2  
 81 dawes 1.5      return (x + width);
 82 dawes 1.2  }
 83            
 84            
 85            int
 86            XAAPolyText16NonTEColorExpansion(
 87                DrawablePtr pDraw,
 88                GCPtr	pGC,
 89                int		x, 
 90                int		y,
 91                int		count,
 92                unsigned short *chars )
 93            {
 94                XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
 95 dawes 1.5      unsigned long n;
 96                int width = 0;
 97 dawes 1.2  
 98 dawes 1.5      (*pGC->font->get_glyphs)(
 99            		pGC->font, (unsigned long)count, (unsigned char *)chars,
100            		(FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
101            		&n, infoRec->CharInfo);
102            
103                if(n) {
104            	width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn, 
105            		x + pDraw->x, y + pDraw->y, pGC->font, 
106            		pGC->fgPixel, pGC->alu, pGC->planemask, 
107            		pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
108            		infoRec->CharInfo);
109                }
110 dawes 1.2  
111 dawes 1.5      return (x + width);
112 dawes 1.2  }
113            
114            
115            void
116            XAAImageText8NonTEColorExpansion(
117                DrawablePtr pDraw,
118                GCPtr	pGC,
119                int		x, 
120                int		y,
121                int		count,
122 dawes 1.6      char	*chars 
123            ){
124 dawes 1.2      XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
125                unsigned long n;
126            
127 dawes 1.6      if(!REGION_NUM_RECTS(pGC->pCompositeClip))
128            	return;
129            
130 dawes 1.5      (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count, 
131            		(unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
132 dawes 1.2  
133                if(n) ImageGlyphBltNonTEColorExpansion(
134            	infoRec->pScrn, x + pDraw->x, y + pDraw->y,
135 dawes 1.8  	pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask, 
136 dawes 1.5  	pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
137 dawes 1.2  }
138            
139            
140            void
141            XAAImageText16NonTEColorExpansion(
142                DrawablePtr pDraw,
143                GCPtr	pGC,
144                int		x, 
145                int		y,
146                int		count,
147 dawes 1.6      unsigned short *chars 
148            ){
149 dawes 1.2      XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
150                unsigned long n;
151            
152 dawes 1.6      if(!REGION_NUM_RECTS(pGC->pCompositeClip))
153            	return;
154            
155 dawes 1.5      (*pGC->font->get_glyphs)(
156            		pGC->font, (unsigned long)count, (unsigned char *)chars,
157            		(FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
158            		&n, infoRec->CharInfo);
159 dawes 1.2  
160                if(n) ImageGlyphBltNonTEColorExpansion(
161            	infoRec->pScrn, x + pDraw->x, y + pDraw->y,
162 dawes 1.8  	pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask, 
163 dawes 1.5  	pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
164 dawes 1.2  }
165            
166            
167            
168            /********************************************************************
169            
170               GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
171               NonTE fonts when using color expansion.
172            
173            ********************************************************************/
174            
175            
176            void
177            XAAImageGlyphBltNonTEColorExpansion(
178                DrawablePtr pDraw,
179                GCPtr pGC,
180                int xInit, int yInit,
181                unsigned int nglyph,
182                CharInfoPtr *ppci,      /* array of character info */
183                pointer pglyphBase	       /* start of array of glyphs */
184 dawes 1.6  ){
185 dawes 1.2      XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
186            
187 dawes 1.6      if(!REGION_NUM_RECTS(pGC->pCompositeClip))
188            	return;
189            
190 dawes 1.2      ImageGlyphBltNonTEColorExpansion(
191            	infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
192 dawes 1.8  	pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask, 
193 dawes 1.2  	pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
194            }
195            
196            void
197            XAAPolyGlyphBltNonTEColorExpansion(
198                DrawablePtr pDraw,
199                GCPtr pGC,
200                int xInit, int yInit,
201                unsigned int nglyph,
202                CharInfoPtr *ppci,      /* array of character info */
203                pointer pglyphBase	       /* start of array of glyphs */
204 dawes 1.6  ){
205 dawes 1.2      XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
206 dawes 1.6  
207                if(!REGION_NUM_RECTS(pGC->pCompositeClip))
208            	return;
209 dawes 1.2  
210                PolyGlyphBltNonTEColorExpansion(
211            	infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
212            	pGC->font, pGC->fgPixel, pGC->alu, pGC->planemask, 
213            	pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
214            }
215            
216            
217            
218            
219            /********************************************************************
220            
221               ImageGlyphBltNonTEColorExpansion -
222               PolyGlyphBltNonTEColorExpansion -
223            
224               These guys compute the clipped pieces of text and send it to
225               the lower-level function which will handle acceleration of 
226               arbitrarily clipped text.
227              
228            ********************************************************************/
229            
230 dawes 1.2  
231            
232            static int
233            CollectCharacterInfo(
234 dawes 1.5      NonTEGlyphPtr glyphs,
235 dawes 1.2      unsigned int nglyph,
236                CharInfoPtr *ppci,
237 dawes 1.5      FontPtr pfont
238            ){
239               int i, w = 0;
240               
241               for(i = 0; i < nglyph; i++, ppci++, glyphs++) {
242            	glyphs->bits = (unsigned char*)((*ppci)->bits);
243            	glyphs->start = w + (*ppci)->metrics.leftSideBearing;
244            	glyphs->end = w + (*ppci)->metrics.rightSideBearing;
245            	glyphs->yoff = (*ppci)->metrics.ascent;
246            	glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
247 dawes 1.9  	glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
248 dawes 1.5  	w += (*ppci)->metrics.characterWidth;
249               }
250               return w;
251 dawes 1.2  }
252            
253            
254            static void
255 dawes 1.8  PolyGlyphBltAsSingleBitmap (
256               ScrnInfoPtr pScrn,
257               int nglyph,
258               FontPtr font,
259               int xInit,
260               int yInit,
261               int nbox,
262               BoxPtr pbox,
263               int fg,
264               int rop,
265               unsigned planemask
266            ){
267                XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
268                CARD32 *block, *pntr, *bits;
269 mvojkovi 1.12     int pitch, topLine, botLine, top, bot, height;
270 dawes    1.8      int Left, Right, Top, Bottom;
271                   int LeftEdge, RightEdge;
272                   int bitPitch, shift, size, i, skippix;
273                   NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
274                   Bool extra;
275               	
276                   Left = xInit + infoRec->GlyphInfo[0].start;
277                   Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
278                   Top = yInit - FONTMAXBOUNDS(font,ascent);
279                   Bottom = yInit + FONTMAXBOUNDS(font,descent);
280               
281                   /* get into the first band that may contain part of our string */
282                   while(nbox && (Top >= pbox->y2)) {
283               	pbox++; nbox--;
284                   }
285               
286                   if(!nbox) return;
287               
288                   pitch = (Right - Left + 31) >> 5;
289 dawes    1.14     size = (pitch << 2) * (Bottom - Top);
290 dawes    1.8      block = (CARD32*)ALLOCATE_LOCAL(size);
291                   bzero(block, size);
292               
293 dawes    1.14     topLine = 10000; botLine = -10000;
294               
295 dawes    1.8      while(nglyph--) {
296               	top = -glyphs->yoff;
297               	bot = top + glyphs->height;
298 dawes    1.14 	if(top < topLine) topLine = top;
299               	if(bot > botLine) botLine = bot;
300 dawes    1.8  	skippix = glyphs->start - infoRec->GlyphInfo[0].start;
301               	bits = (CARD32*)glyphs->bits;
302               	bitPitch = glyphs->srcwidth >> 2;
303               	pntr = block + ((FONTMAXBOUNDS(font,ascent) + top) * pitch) +
304               				(skippix >> 5);
305               	shift = skippix & 31;
306               	extra = ((shift + glyphs->end - glyphs->start) > 32);
307               
308               	for(i = top; i < bot; i++) {
309               	    *pntr |= SHIFT_L(*bits, shift);
310               	    if(extra)
311               		*(pntr + 1) |= SHIFT_R(*bits,32 - shift);
312               	    pntr += pitch;
313               	    bits += bitPitch;
314               	}
315               
316               	glyphs++;
317                   }
318               
319                   pntr = block + ((FONTMAXBOUNDS(font,ascent) + topLine) * pitch);
320               
321 dawes    1.8      Top = yInit + topLine;
322                   Bottom = yInit + botLine;
323               
324                   while(nbox && (Top >= pbox->y2)) {
325               	pbox++; nbox--;
326                   }
327               
328 dawes    1.10     while(nbox && (Bottom > pbox->y1)) {
329 dawes    1.8  	LeftEdge = max(Left, pbox->x1);
330               	RightEdge = min(Right, pbox->x2);
331               
332               	if(RightEdge > LeftEdge) {
333               	    skippix = LeftEdge - Left;
334               	    topLine = max(Top, pbox->y1);
335 mvojkovi 1.12 	    botLine = min(Bottom, pbox->y2);	
336               	    height = botLine - topLine;
337 dawes    1.8  
338 mvojkovi 1.12 	    if(height > 0) 
339               	       (*infoRec->WriteBitmap)(pScrn, LeftEdge, topLine, 
340               			RightEdge - LeftEdge, height,
341 dawes    1.8  			(unsigned char*)(pntr + ((topLine - Top) * pitch) +
342               				(skippix >> 5)),
343               			pitch << 2, skippix & 31, fg, -1, rop, planemask);
344               	}
345               
346               	nbox--; pbox++;
347                   }
348               
349                   DEALLOCATE_LOCAL(block);
350               }
351               
352               static void
353 dawes    1.2  ImageGlyphBltNonTEColorExpansion(
354                  ScrnInfoPtr pScrn,
355                  int xInit, int yInit,
356                  FontPtr font,
357 dawes    1.8     int fg, int bg,
358 dawes    1.2     unsigned planemask,
359                  RegionPtr cclip,
360                  int nglyph,
361                  unsigned char* gBase,
362 dawes    1.4     CharInfoPtr *ppci 
363               ){
364 dawes    1.2      XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
365 dawes    1.5      int skippix, skipglyph, width, n, i;
366                   int Left, Right, Top, Bottom;
367                   int LeftEdge, RightEdge, ytop, ybot;
368 dawes    1.2      int nbox = REGION_NUM_RECTS(cclip);
369                   BoxPtr pbox = REGION_RECTS(cclip);
370 dawes    1.8      Bool AlreadySetup = FALSE;
371 dawes    1.2  
372 dawes    1.5      width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
373 dawes    1.2  
374 dawes    1.8      /* find our backing rectangle dimensions */
375                   Left = xInit;
376                   Right = Left + width;
377                   Top = yInit - FONTASCENT(font);
378                   Bottom = yInit + FONTDESCENT(font);
379 dawes    1.4  
380 dawes    1.8      /* get into the first band that may contain part of our box */
381 dawes    1.2      while(nbox && (Top >= pbox->y2)) {
382               	pbox++; nbox--;
383                   }
384               
385                   while(nbox && (Bottom >= pbox->y1)) {
386 dawes    1.4  	/* handle backing rect first */
387 dawes    1.8  	LeftEdge = max(Left, pbox->x1);
388               	RightEdge = min(Right, pbox->x2);
389 dawes    1.5  	if(RightEdge > LeftEdge) {	    
390 dawes    1.8  	    ytop = max(Top, pbox->y1);
391               	    ybot = min(Bottom, pbox->y2);
392 dawes    1.4  
393               	    if(ybot > ytop) {
394 dawes    1.8  		if(!AlreadySetup) {
395               		   (*infoRec->SetupForSolidFill)(pScrn, bg, GXcopy, planemask);
396               		   AlreadySetup = TRUE;
397               		}
398 dawes    1.4  		(*infoRec->SubsequentSolidFillRect)(pScrn, 
399 dawes    1.5  			LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop);
400 dawes    1.4  	    }
401               	}
402 dawes    1.8  	nbox--; pbox++;
403                   }
404                
405                   nbox = REGION_NUM_RECTS(cclip);
406                   pbox = REGION_RECTS(cclip);
407 dawes    1.4  
408 mvojkovi 1.12     if(infoRec->WriteBitmap && (nglyph > 1) && 
409               			((FONTMAXBOUNDS(font, rightSideBearing) - 
410                         		FONTMINBOUNDS(font, leftSideBearing)) <= 32)) 
411                  {
412 dawes    1.8  	PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font, 
413               				xInit, yInit, nbox, pbox,
414               				fg, GXcopy, planemask);
415               
416               	return;
417                   }
418               
419                   /* compute an approximate but covering bounding box */
420                   Left = xInit + infoRec->GlyphInfo[0].start;
421                   Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
422                   Top = yInit - FONTMAXBOUNDS(font,ascent);
423                   Bottom = yInit + FONTMAXBOUNDS(font,descent);
424               
425                   /* get into the first band that may contain part of our box */
426                   while(nbox && (Top >= pbox->y2)) {
427               	pbox++; nbox--;
428                   }
429               
430                   /* stop when the lower edge of the box is beyond our string */
431                   while(nbox && (Bottom >= pbox->y1)) {
432               	LeftEdge = max(Left, pbox->x1);
433 dawes    1.8  	RightEdge = min(Right, pbox->x2);
434 dawes    1.5  
435               	if(RightEdge > LeftEdge) { /* we're possibly drawing something */
436 dawes    1.8  	    ytop = max(Top, pbox->y1);
437               	    ybot = min(Bottom, pbox->y2);
438 dawes    1.4  	    if(ybot > ytop) {
439 dawes    1.5  		skippix = LeftEdge - xInit;
440 dawes    1.2  		skipglyph = 0;
441 dawes    1.5  		while(skippix >= infoRec->GlyphInfo[skipglyph].end)
442               		   skipglyph++;
443 dawes    1.2  
444 dawes    1.5  		skippix = RightEdge - xInit;
445               		n = 0; i = skipglyph;
446               		while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
447               		    i++; n++;
448               		}
449               
450               		if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
451               			xInit, yInit, n, infoRec->GlyphInfo + skipglyph, 
452 dawes    1.8  			pbox, fg, GXcopy, planemask); 
453 dawes    1.2  	    }
454               	}
455               
456               	nbox--; pbox++;
457                   }
458               }
459               
460               
461 dawes    1.5  static int
462 dawes    1.2  PolyGlyphBltNonTEColorExpansion(
463                  ScrnInfoPtr pScrn,
464                  int xInit, int yInit,
465                  FontPtr font,
466                  int fg, int rop,
467                  unsigned planemask,
468                  RegionPtr cclip,
469                  int nglyph,
470                  unsigned char* gBase,
471 dawes    1.5     CharInfoPtr *ppci 
472               ){
473 dawes    1.2      XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
474 dawes    1.5      int skippix, skipglyph, width, n, i;
475 dawes    1.2      int Left, Right, Top, Bottom;
476 dawes    1.5      int LeftEdge, RightEdge;
477 dawes    1.2      int nbox = REGION_NUM_RECTS(cclip);
478                   BoxPtr pbox = REGION_RECTS(cclip);
479               
480 dawes    1.5      width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
481 dawes    1.8  
482                   if(!nbox)
483               	return width;
484               
485 dawes    1.11     if((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
486 dawes    1.8  	((FONTMAXBOUNDS(font, rightSideBearing) - 
487                         FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
488               
489               	 PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font, 
490               				xInit, yInit, nbox, pbox,
491               				fg, rop, planemask);
492               
493               	return width;
494                   }
495 dawes    1.5  
496                   /* compute an approximate but covering bounding box */
497                   Left = xInit + infoRec->GlyphInfo[0].start;
498                   Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
499 dawes    1.3      Top = yInit - FONTMAXBOUNDS(font,ascent);
500                   Bottom = yInit + FONTMAXBOUNDS(font,descent);
501 dawes    1.5  
502 dawes    1.2      /* get into the first band that may contain part of our string */
503                   while(nbox && (Top >= pbox->y2)) {
504               	pbox++; nbox--;
505                   }
506               
507                   /* stop when the lower edge of the box is beyond our string */
508                   while(nbox && (Bottom >= pbox->y1)) {
509               	LeftEdge = max(Left, pbox->x1);
510               	RightEdge = min(Right, pbox->x2);
511               
512 dawes    1.5  	if(RightEdge > LeftEdge) { /* we're possibly drawing something */
513 dawes    1.2  
514 dawes    1.5  	    skippix = LeftEdge - xInit;
515 dawes    1.2  	    skipglyph = 0;
516 dawes    1.5  	    while(skippix >= infoRec->GlyphInfo[skipglyph].end)
517 dawes    1.2  		skipglyph++;
518               
519 dawes    1.5  	    skippix = RightEdge - xInit;
520               	    n = 0; i = skipglyph;
521               	    while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
522               		i++; n++;
523               	    }
524               
525               	    if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
526               			xInit, yInit, n, infoRec->GlyphInfo + skipglyph, 
527               			pbox, fg, rop, planemask); 
528 dawes    1.2  	}
529               
530               	nbox--; pbox++;
531                   }
532 dawes    1.5      return width;
533               }
534               
535               
536               /* It is possible that the none of the glyphs passed to the 
537                  NonTEGlyphRenderer will be drawn.  This function being called
538                  indicates that part of the text string's bounding box is visible
539                  but not necessarily that any of the characters are visible */
540               
541               void XAANonTEGlyphRenderer(
542                  ScrnInfoPtr pScrn,
543                  int x, int y, int n,
544                  NonTEGlyphPtr glyphs,
545                  BoxPtr pbox,
546                  int fg, int rop,
547                  unsigned int planemask
548               ){
549                   XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
550                   int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
551                   unsigned char *src;
552               
553 dawes    1.5      for(i = 0; i < n; i++, glyphs++) {
554               	x1 = x + glyphs->start;
555               	x2 = x + glyphs->end;
556               	y1 = y - glyphs->yoff;
557               	y2 = y1 + glyphs->height;
558               
559               	if(y1 < pbox->y1) {
560               	    skiptop = pbox->y1 - y1;
561               	    y1 = pbox->y1;
562               	} else skiptop = 0;
563               	if(y2 > pbox->y2) y2 = pbox->y2;
564               	h = y2 - y1;
565               	if(h <= 0) continue;
566               
567               	if(x1 < pbox->x1) {
568               	    skipleft = pbox->x1 - x1;
569               	    x1 = pbox->x1;
570               	} else skipleft = 0;
571               	if(x2 > pbox->x2) x2 = pbox->x2;
572               
573               	w = x2 - x1;
574 dawes    1.5  
575               	if(w > 0) {
576               	    src = glyphs->bits + (skiptop * glyphs->srcwidth);
577               
578               	    if(skipleft) {
579               		src += (skipleft >> 5) << 2;
580               		skipleft &= 31;
581               	    }
582               
583               	    (*infoRec->WriteBitmap)(pScrn, x1, y1, w, h, src,
584               			glyphs->srcwidth, skipleft, fg, -1, rop, planemask);
585               	}
586                   }  
587               
588 dawes    1.2  }

Powered by
ViewCVS 0.9.2