2 Copyright (C) 1999. The XFree86 Project Inc.
4 Written by Mark Vojkovich (mvojkovi@ucsd.edu)
6 Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
9 #ifdef HAVE_XORG_CONFIG_H
10 #include <xorg-config.h>
14 #include <X11/Xproto.h>
16 #include "pixmapstr.h"
18 #include <X11/fonts/font.h>
20 #include "scrnintstr.h"
21 #include "windowstr.h"
23 #include "dixfontstr.h"
24 #include <X11/fonts/fontstruct.h>
29 #include "picturestr.h"
31 static Bool
ShadowCloseScreen(ScreenPtr pScreen
);
32 static void ShadowCopyWindow(WindowPtr pWin
,
33 DDXPointRec ptOldOrg
, RegionPtr prgn
);
34 static Bool
ShadowCreateGC(GCPtr pGC
);
36 static Bool
ShadowEnterVT(ScrnInfoPtr pScrn
);
37 static void ShadowLeaveVT(ScrnInfoPtr pScrn
);
39 static void ShadowComposite(CARD8 op
,
48 INT16 yDst
, CARD16 width
, CARD16 height
);
52 RefreshAreaFuncPtr preRefresh
;
53 RefreshAreaFuncPtr postRefresh
;
54 CloseScreenProcPtr CloseScreen
;
55 CopyWindowProcPtr CopyWindow
;
56 CreateGCProcPtr CreateGC
;
57 ModifyPixmapHeaderProcPtr ModifyPixmapHeader
;
58 CompositeProcPtr Composite
;
59 Bool (*EnterVT
) (ScrnInfoPtr
);
60 void (*LeaveVT
) (ScrnInfoPtr
);
62 } ShadowScreenRec
, *ShadowScreenPtr
;
67 } ShadowGCRec
, *ShadowGCPtr
;
69 static DevPrivateKeyRec ShadowScreenKeyRec
;
71 #define ShadowScreenKey (&ShadowScreenKeyRec)
73 static DevPrivateKeyRec ShadowGCKeyRec
;
75 #define ShadowGCKey (&ShadowGCKeyRec)
77 #define GET_SCREEN_PRIVATE(pScreen) \
78 (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
79 #define GET_GC_PRIVATE(pGC) \
80 (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey)
82 #define SHADOW_GC_FUNC_PROLOGUE(pGC)\
83 ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
84 (pGC)->funcs = pGCPriv->funcs;\
86 (pGC)->ops = pGCPriv->ops
88 #define SHADOW_GC_FUNC_EPILOGUE(pGC)\
89 pGCPriv->funcs = (pGC)->funcs;\
90 (pGC)->funcs = &ShadowGCFuncs;\
92 pGCPriv->ops = (pGC)->ops;\
93 (pGC)->ops = &ShadowGCOps;\
96 #define SHADOW_GC_OP_PROLOGUE(pGC)\
97 ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
98 ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
99 GCFuncs *oldFuncs = pGC->funcs;\
100 pGC->funcs = pGCPriv->funcs;\
101 pGC->ops = pGCPriv->ops
103 #define SHADOW_GC_OP_EPILOGUE(pGC)\
104 pGCPriv->ops = pGC->ops;\
105 pGC->funcs = oldFuncs;\
106 pGC->ops = &ShadowGCOps
108 #define IS_VISIBLE(pWin) (pPriv->vtSema && \
109 (((WindowPtr)pWin)->visibility != VisibilityFullyObscured))
111 #define TRIM_BOX(box, pGC) { \
112 BoxPtr extents = &pGC->pCompositeClip->extents;\
113 if(box.x1 < extents->x1) box.x1 = extents->x1; \
114 if(box.x2 > extents->x2) box.x2 = extents->x2; \
115 if(box.y1 < extents->y1) box.y1 = extents->y1; \
116 if(box.y2 > extents->y2) box.y2 = extents->y2; \
119 #define TRANSLATE_BOX(box, pDraw) { \
120 box.x1 += pDraw->x; \
121 box.x2 += pDraw->x; \
122 box.y1 += pDraw->y; \
123 box.y2 += pDraw->y; \
126 #define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \
127 TRANSLATE_BOX(box, pDraw); \
128 TRIM_BOX(box, pGC); \
131 #define BOX_NOT_EMPTY(box) \
132 (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
135 ShadowFBInit2(ScreenPtr pScreen
,
136 RefreshAreaFuncPtr preRefreshArea
,
137 RefreshAreaFuncPtr postRefreshArea
)
139 ScrnInfoPtr pScrn
= xf86ScreenToScrn(pScreen
);
140 ShadowScreenPtr pPriv
;
141 PictureScreenPtr ps
= GetPictureScreenIfSet(pScreen
);
143 if (!preRefreshArea
&& !postRefreshArea
)
146 if (!dixRegisterPrivateKey(&ShadowScreenKeyRec
, PRIVATE_SCREEN
, 0))
149 if (!dixRegisterPrivateKey
150 (&ShadowGCKeyRec
, PRIVATE_GC
, sizeof(ShadowGCRec
)))
153 if (!(pPriv
= (ShadowScreenPtr
) malloc(sizeof(ShadowScreenRec
))))
156 dixSetPrivate(&pScreen
->devPrivates
, ShadowScreenKey
, pPriv
);
158 pPriv
->pScrn
= pScrn
;
159 pPriv
->preRefresh
= preRefreshArea
;
160 pPriv
->postRefresh
= postRefreshArea
;
161 pPriv
->vtSema
= TRUE
;
163 pPriv
->CloseScreen
= pScreen
->CloseScreen
;
164 pPriv
->CopyWindow
= pScreen
->CopyWindow
;
165 pPriv
->CreateGC
= pScreen
->CreateGC
;
166 pPriv
->ModifyPixmapHeader
= pScreen
->ModifyPixmapHeader
;
168 pPriv
->EnterVT
= pScrn
->EnterVT
;
169 pPriv
->LeaveVT
= pScrn
->LeaveVT
;
171 pScreen
->CloseScreen
= ShadowCloseScreen
;
172 pScreen
->CopyWindow
= ShadowCopyWindow
;
173 pScreen
->CreateGC
= ShadowCreateGC
;
175 pScrn
->EnterVT
= ShadowEnterVT
;
176 pScrn
->LeaveVT
= ShadowLeaveVT
;
179 pPriv
->Composite
= ps
->Composite
;
180 ps
->Composite
= ShadowComposite
;
187 ShadowFBInit(ScreenPtr pScreen
, RefreshAreaFuncPtr refreshArea
)
189 return ShadowFBInit2(pScreen
, NULL
, refreshArea
);
192 /**********************************************************/
195 ShadowEnterVT(ScrnInfoPtr pScrn
)
198 ShadowScreenPtr pPriv
= GET_SCREEN_PRIVATE(pScrn
->pScreen
);
200 pScrn
->EnterVT
= pPriv
->EnterVT
;
201 ret
= (*pPriv
->EnterVT
) (pScrn
);
202 pPriv
->EnterVT
= pScrn
->EnterVT
;
203 pScrn
->EnterVT
= ShadowEnterVT
;
205 pPriv
->vtSema
= TRUE
;
213 ShadowLeaveVT(ScrnInfoPtr pScrn
)
215 ShadowScreenPtr pPriv
= GET_SCREEN_PRIVATE(pScrn
->pScreen
);
217 pPriv
->vtSema
= FALSE
;
219 pScrn
->LeaveVT
= pPriv
->LeaveVT
;
220 (*pPriv
->LeaveVT
) (pScrn
);
221 pPriv
->LeaveVT
= pScrn
->LeaveVT
;
222 pScrn
->LeaveVT
= ShadowLeaveVT
;
225 /**********************************************************/
228 ShadowCloseScreen(ScreenPtr pScreen
)
230 ScrnInfoPtr pScrn
= xf86ScreenToScrn(pScreen
);
231 ShadowScreenPtr pPriv
= GET_SCREEN_PRIVATE(pScreen
);
232 PictureScreenPtr ps
= GetPictureScreenIfSet(pScreen
);
234 pScreen
->CloseScreen
= pPriv
->CloseScreen
;
235 pScreen
->CopyWindow
= pPriv
->CopyWindow
;
236 pScreen
->CreateGC
= pPriv
->CreateGC
;
237 pScreen
->ModifyPixmapHeader
= pPriv
->ModifyPixmapHeader
;
239 pScrn
->EnterVT
= pPriv
->EnterVT
;
240 pScrn
->LeaveVT
= pPriv
->LeaveVT
;
243 ps
->Composite
= pPriv
->Composite
;
246 free((pointer
) pPriv
);
248 return (*pScreen
->CloseScreen
) (pScreen
);
252 ShadowCopyWindow(WindowPtr pWin
, DDXPointRec ptOldOrg
, RegionPtr prgn
)
254 ScreenPtr pScreen
= pWin
->drawable
.pScreen
;
255 ShadowScreenPtr pPriv
= GET_SCREEN_PRIVATE(pScreen
);
261 RegionCopy(&rgnDst
, prgn
);
263 RegionTranslate(&rgnDst
,
264 pWin
->drawable
.x
- ptOldOrg
.x
,
265 pWin
->drawable
.y
- ptOldOrg
.y
);
266 RegionIntersect(&rgnDst
, &pWin
->borderClip
, &rgnDst
);
267 if ((num
= RegionNumRects(&rgnDst
))) {
268 if (pPriv
->preRefresh
)
269 (*pPriv
->preRefresh
) (pPriv
->pScrn
, num
, RegionRects(&rgnDst
));
272 RegionUninit(&rgnDst
);
276 pScreen
->CopyWindow
= pPriv
->CopyWindow
;
277 (*pScreen
->CopyWindow
) (pWin
, ptOldOrg
, prgn
);
278 pScreen
->CopyWindow
= ShadowCopyWindow
;
281 if (pPriv
->postRefresh
)
282 (*pPriv
->postRefresh
) (pPriv
->pScrn
, num
, RegionRects(&rgnDst
));
283 RegionUninit(&rgnDst
);
288 ShadowComposite(CARD8 op
,
296 INT16 xDst
, INT16 yDst
, CARD16 width
, CARD16 height
)
298 ScreenPtr pScreen
= pDst
->pDrawable
->pScreen
;
299 ShadowScreenPtr pPriv
= GET_SCREEN_PRIVATE(pScreen
);
300 PictureScreenPtr ps
= GetPictureScreen(pScreen
);
303 Bool boxNotEmpty
= FALSE
;
305 if (pPriv
->vtSema
&& pDst
->pDrawable
->type
== DRAWABLE_WINDOW
) {
307 box
.x1
= pDst
->pDrawable
->x
+ xDst
;
308 box
.y1
= pDst
->pDrawable
->y
+ yDst
;
309 box
.x2
= box
.x1
+ width
;
310 box
.y2
= box
.y1
+ height
;
312 extents
= &pDst
->pCompositeClip
->extents
;
313 if (box
.x1
< extents
->x1
)
314 box
.x1
= extents
->x1
;
315 if (box
.x2
> extents
->x2
)
316 box
.x2
= extents
->x2
;
317 if (box
.y1
< extents
->y1
)
318 box
.y1
= extents
->y1
;
319 if (box
.y2
> extents
->y2
)
320 box
.y2
= extents
->y2
;
322 if (BOX_NOT_EMPTY(box
)) {
323 if (pPriv
->preRefresh
)
324 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
329 ps
->Composite
= pPriv
->Composite
;
330 (*ps
->Composite
) (op
, pSrc
, pMask
, pDst
, xSrc
, ySrc
,
331 xMask
, yMask
, xDst
, yDst
, width
, height
);
332 ps
->Composite
= ShadowComposite
;
334 if (pPriv
->postRefresh
&& boxNotEmpty
) {
335 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
339 /**********************************************************/
341 static void ShadowValidateGC(GCPtr
, unsigned long, DrawablePtr
);
342 static void ShadowChangeGC(GCPtr
, unsigned long);
343 static void ShadowCopyGC(GCPtr
, unsigned long, GCPtr
);
344 static void ShadowDestroyGC(GCPtr
);
345 static void ShadowChangeClip(GCPtr
, int, pointer
, int);
346 static void ShadowDestroyClip(GCPtr
);
347 static void ShadowCopyClip(GCPtr
, GCPtr
);
349 GCFuncs ShadowGCFuncs
= {
350 ShadowValidateGC
, ShadowChangeGC
, ShadowCopyGC
, ShadowDestroyGC
,
351 ShadowChangeClip
, ShadowDestroyClip
, ShadowCopyClip
354 extern GCOps ShadowGCOps
;
357 ShadowCreateGC(GCPtr pGC
)
359 ScreenPtr pScreen
= pGC
->pScreen
;
360 ShadowScreenPtr pPriv
= GET_SCREEN_PRIVATE(pScreen
);
361 ShadowGCPtr pGCPriv
= GET_GC_PRIVATE(pGC
);
364 pScreen
->CreateGC
= pPriv
->CreateGC
;
365 if ((ret
= (*pScreen
->CreateGC
) (pGC
))) {
367 pGCPriv
->funcs
= pGC
->funcs
;
368 pGC
->funcs
= &ShadowGCFuncs
;
370 pScreen
->CreateGC
= ShadowCreateGC
;
376 ShadowValidateGC(GCPtr pGC
, unsigned long changes
, DrawablePtr pDraw
)
378 SHADOW_GC_FUNC_PROLOGUE(pGC
);
379 (*pGC
->funcs
->ValidateGC
) (pGC
, changes
, pDraw
);
380 if (pDraw
->type
== DRAWABLE_WINDOW
)
381 pGCPriv
->ops
= pGC
->ops
; /* just so it's not NULL */
384 SHADOW_GC_FUNC_EPILOGUE(pGC
);
388 ShadowDestroyGC(GCPtr pGC
)
390 SHADOW_GC_FUNC_PROLOGUE(pGC
);
391 (*pGC
->funcs
->DestroyGC
) (pGC
);
392 SHADOW_GC_FUNC_EPILOGUE(pGC
);
396 ShadowChangeGC(GCPtr pGC
, unsigned long mask
)
398 SHADOW_GC_FUNC_PROLOGUE(pGC
);
399 (*pGC
->funcs
->ChangeGC
) (pGC
, mask
);
400 SHADOW_GC_FUNC_EPILOGUE(pGC
);
404 ShadowCopyGC(GCPtr pGCSrc
, unsigned long mask
, GCPtr pGCDst
)
406 SHADOW_GC_FUNC_PROLOGUE(pGCDst
);
407 (*pGCDst
->funcs
->CopyGC
) (pGCSrc
, mask
, pGCDst
);
408 SHADOW_GC_FUNC_EPILOGUE(pGCDst
);
412 ShadowChangeClip(GCPtr pGC
, int type
, pointer pvalue
, int nrects
)
414 SHADOW_GC_FUNC_PROLOGUE(pGC
);
415 (*pGC
->funcs
->ChangeClip
) (pGC
, type
, pvalue
, nrects
);
416 SHADOW_GC_FUNC_EPILOGUE(pGC
);
420 ShadowCopyClip(GCPtr pgcDst
, GCPtr pgcSrc
)
422 SHADOW_GC_FUNC_PROLOGUE(pgcDst
);
423 (*pgcDst
->funcs
->CopyClip
) (pgcDst
, pgcSrc
);
424 SHADOW_GC_FUNC_EPILOGUE(pgcDst
);
428 ShadowDestroyClip(GCPtr pGC
)
430 SHADOW_GC_FUNC_PROLOGUE(pGC
);
431 (*pGC
->funcs
->DestroyClip
) (pGC
);
432 SHADOW_GC_FUNC_EPILOGUE(pGC
);
435 /**********************************************************/
438 ShadowFillSpans(DrawablePtr pDraw
,
440 int nInit
, DDXPointPtr pptInit
, int *pwidthInit
, int fSorted
)
442 SHADOW_GC_OP_PROLOGUE(pGC
);
444 if (IS_VISIBLE(pDraw
) && nInit
) {
445 DDXPointPtr ppt
= pptInit
;
446 int *pwidth
= pwidthInit
;
449 Bool boxNotEmpty
= FALSE
;
452 box
.x2
= box
.x1
+ *pwidth
;
453 box
.y2
= box
.y1
= ppt
->y
;
460 if (box
.x2
< (ppt
->x
+ *pwidth
))
461 box
.x2
= ppt
->x
+ *pwidth
;
464 else if (box
.y2
< ppt
->y
)
470 if (!pGC
->miTranslate
) {
471 TRANSLATE_BOX(box
, pDraw
);
475 if (BOX_NOT_EMPTY(box
)) {
476 if (pPriv
->preRefresh
)
477 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
481 (*pGC
->ops
->FillSpans
) (pDraw
, pGC
, nInit
, pptInit
, pwidthInit
,
484 if (boxNotEmpty
&& pPriv
->postRefresh
)
485 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
488 (*pGC
->ops
->FillSpans
) (pDraw
, pGC
, nInit
, pptInit
, pwidthInit
,
491 SHADOW_GC_OP_EPILOGUE(pGC
);
495 ShadowSetSpans(DrawablePtr pDraw
,
498 DDXPointPtr pptInit
, int *pwidthInit
, int nspans
, int fSorted
)
500 SHADOW_GC_OP_PROLOGUE(pGC
);
502 if (IS_VISIBLE(pDraw
) && nspans
) {
503 DDXPointPtr ppt
= pptInit
;
504 int *pwidth
= pwidthInit
;
507 Bool boxNotEmpty
= FALSE
;
510 box
.x2
= box
.x1
+ *pwidth
;
511 box
.y2
= box
.y1
= ppt
->y
;
518 if (box
.x2
< (ppt
->x
+ *pwidth
))
519 box
.x2
= ppt
->x
+ *pwidth
;
522 else if (box
.y2
< ppt
->y
)
528 if (!pGC
->miTranslate
) {
529 TRANSLATE_BOX(box
, pDraw
);
533 if (BOX_NOT_EMPTY(box
)) {
534 if (pPriv
->preRefresh
)
535 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
539 (*pGC
->ops
->SetSpans
) (pDraw
, pGC
, pcharsrc
, pptInit
,
540 pwidthInit
, nspans
, fSorted
);
542 if (boxNotEmpty
&& pPriv
->postRefresh
)
543 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
546 (*pGC
->ops
->SetSpans
) (pDraw
, pGC
, pcharsrc
, pptInit
,
547 pwidthInit
, nspans
, fSorted
);
549 SHADOW_GC_OP_EPILOGUE(pGC
);
553 ShadowPutImage(DrawablePtr pDraw
,
556 int x
, int y
, int w
, int h
,
557 int leftPad
, int format
, char *pImage
)
560 Bool boxNotEmpty
= FALSE
;
562 SHADOW_GC_OP_PROLOGUE(pGC
);
564 if (IS_VISIBLE(pDraw
)) {
565 box
.x1
= x
+ pDraw
->x
;
567 box
.y1
= y
+ pDraw
->y
;
571 if (BOX_NOT_EMPTY(box
)) {
572 if (pPriv
->preRefresh
)
573 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
578 (*pGC
->ops
->PutImage
) (pDraw
, pGC
, depth
, x
, y
, w
, h
,
579 leftPad
, format
, pImage
);
581 if (boxNotEmpty
&& pPriv
->postRefresh
)
582 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
584 SHADOW_GC_OP_EPILOGUE(pGC
);
589 ShadowCopyArea(DrawablePtr pSrc
,
592 int srcx
, int srcy
, int width
, int height
, int dstx
, int dsty
)
596 Bool boxNotEmpty
= FALSE
;
598 SHADOW_GC_OP_PROLOGUE(pGC
);
600 if (IS_VISIBLE(pDst
)) {
601 box
.x1
= dstx
+ pDst
->x
;
602 box
.x2
= box
.x1
+ width
;
603 box
.y1
= dsty
+ pDst
->y
;
604 box
.y2
= box
.y1
+ height
;
607 if (BOX_NOT_EMPTY(box
)) {
608 if (pPriv
->preRefresh
)
609 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
614 ret
= (*pGC
->ops
->CopyArea
) (pSrc
, pDst
,
615 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
);
617 if (boxNotEmpty
&& pPriv
->postRefresh
)
618 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
620 SHADOW_GC_OP_EPILOGUE(pGC
);
626 ShadowCopyPlane(DrawablePtr pSrc
,
630 int width
, int height
,
631 int dstx
, int dsty
, unsigned long bitPlane
)
635 Bool boxNotEmpty
= FALSE
;
637 SHADOW_GC_OP_PROLOGUE(pGC
);
639 if (IS_VISIBLE(pDst
)) {
640 box
.x1
= dstx
+ pDst
->x
;
641 box
.x2
= box
.x1
+ width
;
642 box
.y1
= dsty
+ pDst
->y
;
643 box
.y2
= box
.y1
+ height
;
646 if (BOX_NOT_EMPTY(box
)) {
647 if (pPriv
->preRefresh
)
648 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
653 ret
= (*pGC
->ops
->CopyPlane
) (pSrc
, pDst
,
654 pGC
, srcx
, srcy
, width
, height
, dstx
, dsty
,
657 if (boxNotEmpty
&& pPriv
->postRefresh
)
658 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
660 SHADOW_GC_OP_EPILOGUE(pGC
);
666 ShadowPolyPoint(DrawablePtr pDraw
,
667 GCPtr pGC
, int mode
, int nptInit
, xPoint
* pptInit
)
670 Bool boxNotEmpty
= FALSE
;
672 SHADOW_GC_OP_PROLOGUE(pGC
);
674 if (IS_VISIBLE(pDraw
) && nptInit
) {
675 xPoint
*ppt
= pptInit
;
678 box
.x2
= box
.x1
= pptInit
->x
;
679 box
.y2
= box
.y1
= pptInit
->y
;
681 /* this could be slow if the points were spread out */
687 else if (box
.x2
< ppt
->x
)
691 else if (box
.y2
< ppt
->y
)
698 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
699 if (BOX_NOT_EMPTY(box
)) {
700 if (pPriv
->preRefresh
)
701 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
706 (*pGC
->ops
->PolyPoint
) (pDraw
, pGC
, mode
, nptInit
, pptInit
);
708 if (boxNotEmpty
&& pPriv
->postRefresh
)
709 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
711 SHADOW_GC_OP_EPILOGUE(pGC
);
715 ShadowPolylines(DrawablePtr pDraw
,
716 GCPtr pGC
, int mode
, int nptInit
, DDXPointPtr pptInit
)
719 Bool boxNotEmpty
= FALSE
;
721 SHADOW_GC_OP_PROLOGUE(pGC
);
723 if (IS_VISIBLE(pDraw
) && nptInit
) {
724 DDXPointPtr ppt
= pptInit
;
726 int extra
= pGC
->lineWidth
>> 1;
728 box
.x2
= box
.x1
= pptInit
->x
;
729 box
.y2
= box
.y1
= pptInit
->y
;
732 if (pGC
->joinStyle
== JoinMiter
)
733 extra
= 6 * pGC
->lineWidth
;
734 else if (pGC
->capStyle
== CapProjecting
)
735 extra
= pGC
->lineWidth
;
738 if (mode
== CoordModePrevious
) {
761 else if (box
.x2
< ppt
->x
)
765 else if (box
.y2
< ppt
->y
)
780 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
781 if (BOX_NOT_EMPTY(box
)) {
782 if (pPriv
->preRefresh
)
783 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
788 (*pGC
->ops
->Polylines
) (pDraw
, pGC
, mode
, nptInit
, pptInit
);
790 if (boxNotEmpty
&& pPriv
->postRefresh
)
791 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
793 SHADOW_GC_OP_EPILOGUE(pGC
);
797 ShadowPolySegment(DrawablePtr pDraw
,
798 GCPtr pGC
, int nsegInit
, xSegment
* pSegInit
)
801 Bool boxNotEmpty
= FALSE
;
803 SHADOW_GC_OP_PROLOGUE(pGC
);
805 if (IS_VISIBLE(pDraw
) && nsegInit
) {
806 int extra
= pGC
->lineWidth
;
807 xSegment
*pSeg
= pSegInit
;
810 if (pGC
->capStyle
!= CapProjecting
)
813 if (pSeg
->x2
> pSeg
->x1
) {
822 if (pSeg
->y2
> pSeg
->y1
) {
833 if (pSeg
->x2
> pSeg
->x1
) {
834 if (pSeg
->x1
< box
.x1
)
836 if (pSeg
->x2
> box
.x2
)
840 if (pSeg
->x2
< box
.x1
)
842 if (pSeg
->x1
> box
.x2
)
845 if (pSeg
->y2
> pSeg
->y1
) {
846 if (pSeg
->y1
< box
.y1
)
848 if (pSeg
->y2
> box
.y2
)
852 if (pSeg
->y2
< box
.y1
)
854 if (pSeg
->y1
> box
.y2
)
869 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
870 if (BOX_NOT_EMPTY(box
)) {
871 if (pPriv
->preRefresh
)
872 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
877 (*pGC
->ops
->PolySegment
) (pDraw
, pGC
, nsegInit
, pSegInit
);
879 if (boxNotEmpty
&& pPriv
->postRefresh
)
880 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
882 SHADOW_GC_OP_EPILOGUE(pGC
);
886 ShadowPolyRectangle(DrawablePtr pDraw
,
887 GCPtr pGC
, int nRectsInit
, xRectangle
*pRectsInit
)
890 BoxPtr pBoxInit
= NULL
;
891 Bool boxNotEmpty
= FALSE
;
894 SHADOW_GC_OP_PROLOGUE(pGC
);
896 if (IS_VISIBLE(pDraw
) && nRectsInit
) {
897 xRectangle
*pRects
= pRectsInit
;
898 int nRects
= nRectsInit
;
901 int extra
= pGC
->lineWidth
>> 1;
904 box
.x2
= box
.x1
+ pRects
->width
;
906 box
.y2
= box
.y1
+ pRects
->height
;
910 if (box
.x1
> pRects
->x
)
912 if (box
.x2
< (pRects
->x
+ pRects
->width
))
913 box
.x2
= pRects
->x
+ pRects
->width
;
914 if (box
.y1
> pRects
->y
)
916 if (box
.y2
< (pRects
->y
+ pRects
->height
))
917 box
.y2
= pRects
->y
+ pRects
->height
;
930 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
931 if (BOX_NOT_EMPTY(box
)) {
932 if (pPriv
->preRefresh
)
933 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
939 int offset1
, offset2
, offset3
;
941 offset2
= pGC
->lineWidth
;
944 offset1
= offset2
>> 1;
945 offset3
= offset2
- offset1
;
947 pBoxInit
= (BoxPtr
) malloc(nRects
* 4 * sizeof(BoxRec
));
951 pbox
->x1
= pRects
->x
- offset1
;
952 pbox
->y1
= pRects
->y
- offset1
;
953 pbox
->x2
= pbox
->x1
+ pRects
->width
+ offset2
;
954 pbox
->y2
= pbox
->y1
+ offset2
;
955 TRIM_AND_TRANSLATE_BOX((*pbox
), pDraw
, pGC
);
956 if (BOX_NOT_EMPTY((*pbox
))) {
961 pbox
->x1
= pRects
->x
- offset1
;
962 pbox
->y1
= pRects
->y
+ offset3
;
963 pbox
->x2
= pbox
->x1
+ offset2
;
964 pbox
->y2
= pbox
->y1
+ pRects
->height
- offset2
;
965 TRIM_AND_TRANSLATE_BOX((*pbox
), pDraw
, pGC
);
966 if (BOX_NOT_EMPTY((*pbox
))) {
971 pbox
->x1
= pRects
->x
+ pRects
->width
- offset1
;
972 pbox
->y1
= pRects
->y
+ offset3
;
973 pbox
->x2
= pbox
->x1
+ offset2
;
974 pbox
->y2
= pbox
->y1
+ pRects
->height
- offset2
;
975 TRIM_AND_TRANSLATE_BOX((*pbox
), pDraw
, pGC
);
976 if (BOX_NOT_EMPTY((*pbox
))) {
981 pbox
->x1
= pRects
->x
- offset1
;
982 pbox
->y1
= pRects
->y
+ pRects
->height
- offset1
;
983 pbox
->x2
= pbox
->x1
+ pRects
->width
+ offset2
;
984 pbox
->y2
= pbox
->y1
+ offset2
;
985 TRIM_AND_TRANSLATE_BOX((*pbox
), pDraw
, pGC
);
986 if (BOX_NOT_EMPTY((*pbox
))) {
995 if (pPriv
->preRefresh
)
996 (*pPriv
->preRefresh
) (pPriv
->pScrn
, num
, pBoxInit
);
1004 (*pGC
->ops
->PolyRectangle
) (pDraw
, pGC
, nRectsInit
, pRectsInit
);
1006 if (boxNotEmpty
&& pPriv
->postRefresh
) {
1007 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1010 if (pPriv
->postRefresh
)
1011 (*pPriv
->postRefresh
) (pPriv
->pScrn
, num
, pBoxInit
);
1015 SHADOW_GC_OP_EPILOGUE(pGC
);
1020 ShadowPolyArc(DrawablePtr pDraw
, GCPtr pGC
, int narcsInit
, xArc
* parcsInit
)
1023 Bool boxNotEmpty
= FALSE
;
1025 SHADOW_GC_OP_PROLOGUE(pGC
);
1027 if (IS_VISIBLE(pDraw
) && narcsInit
) {
1028 int narcs
= narcsInit
;
1029 xArc
*parcs
= parcsInit
;
1030 int extra
= pGC
->lineWidth
>> 1;
1033 box
.x2
= box
.x1
+ parcs
->width
;
1035 box
.y2
= box
.y1
+ parcs
->height
;
1037 /* should I break these up instead ? */
1041 if (box
.x1
> parcs
->x
)
1043 if (box
.x2
< (parcs
->x
+ parcs
->width
))
1044 box
.x2
= parcs
->x
+ parcs
->width
;
1045 if (box
.y1
> parcs
->y
)
1047 if (box
.y2
< (parcs
->y
+ parcs
->height
))
1048 box
.y2
= parcs
->y
+ parcs
->height
;
1061 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
1062 if (BOX_NOT_EMPTY(box
)) {
1063 if (pPriv
->preRefresh
)
1064 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1069 (*pGC
->ops
->PolyArc
) (pDraw
, pGC
, narcsInit
, parcsInit
);
1071 if (boxNotEmpty
&& pPriv
->postRefresh
)
1072 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1074 SHADOW_GC_OP_EPILOGUE(pGC
);
1079 ShadowFillPolygon(DrawablePtr pDraw
,
1081 int shape
, int mode
, int count
, DDXPointPtr pptInit
)
1083 SHADOW_GC_OP_PROLOGUE(pGC
);
1085 if (IS_VISIBLE(pDraw
) && (count
> 2)) {
1086 DDXPointPtr ppt
= pptInit
;
1089 Bool boxNotEmpty
= FALSE
;
1091 box
.x2
= box
.x1
= ppt
->x
;
1092 box
.y2
= box
.y1
= ppt
->y
;
1094 if (mode
!= CoordModeOrigin
) {
1104 else if (box
.x2
< x
)
1108 else if (box
.y2
< y
)
1115 if (box
.x1
> ppt
->x
)
1117 else if (box
.x2
< ppt
->x
)
1119 if (box
.y1
> ppt
->y
)
1121 else if (box
.y2
< ppt
->y
)
1129 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
1130 if (BOX_NOT_EMPTY(box
)) {
1131 if (pPriv
->preRefresh
)
1132 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1136 (*pGC
->ops
->FillPolygon
) (pDraw
, pGC
, shape
, mode
, count
, pptInit
);
1138 if (boxNotEmpty
&& pPriv
->postRefresh
)
1139 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1142 (*pGC
->ops
->FillPolygon
) (pDraw
, pGC
, shape
, mode
, count
, pptInit
);
1144 SHADOW_GC_OP_EPILOGUE(pGC
);
1148 ShadowPolyFillRect(DrawablePtr pDraw
,
1149 GCPtr pGC
, int nRectsInit
, xRectangle
*pRectsInit
)
1151 SHADOW_GC_OP_PROLOGUE(pGC
);
1153 if (IS_VISIBLE(pDraw
) && nRectsInit
) {
1155 Bool boxNotEmpty
= FALSE
;
1156 xRectangle
*pRects
= pRectsInit
;
1157 int nRects
= nRectsInit
;
1160 box
.x2
= box
.x1
+ pRects
->width
;
1162 box
.y2
= box
.y1
+ pRects
->height
;
1166 if (box
.x1
> pRects
->x
)
1168 if (box
.x2
< (pRects
->x
+ pRects
->width
))
1169 box
.x2
= pRects
->x
+ pRects
->width
;
1170 if (box
.y1
> pRects
->y
)
1172 if (box
.y2
< (pRects
->y
+ pRects
->height
))
1173 box
.y2
= pRects
->y
+ pRects
->height
;
1176 /* cfb messes with the pRectsInit so we have to do our
1177 calculations first */
1179 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
1180 if (BOX_NOT_EMPTY(box
)) {
1181 if (pPriv
->preRefresh
)
1182 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1186 (*pGC
->ops
->PolyFillRect
) (pDraw
, pGC
, nRectsInit
, pRectsInit
);
1188 if (boxNotEmpty
&& pPriv
->postRefresh
)
1189 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1192 (*pGC
->ops
->PolyFillRect
) (pDraw
, pGC
, nRectsInit
, pRectsInit
);
1194 SHADOW_GC_OP_EPILOGUE(pGC
);
1198 ShadowPolyFillArc(DrawablePtr pDraw
, GCPtr pGC
, int narcsInit
, xArc
* parcsInit
)
1201 Bool boxNotEmpty
= FALSE
;
1203 SHADOW_GC_OP_PROLOGUE(pGC
);
1205 if (IS_VISIBLE(pDraw
) && narcsInit
) {
1206 xArc
*parcs
= parcsInit
;
1207 int narcs
= narcsInit
;
1210 box
.x2
= box
.x1
+ parcs
->width
;
1212 box
.y2
= box
.y1
+ parcs
->height
;
1214 /* should I break these up instead ? */
1218 if (box
.x1
> parcs
->x
)
1220 if (box
.x2
< (parcs
->x
+ parcs
->width
))
1221 box
.x2
= parcs
->x
+ parcs
->width
;
1222 if (box
.y1
> parcs
->y
)
1224 if (box
.y2
< (parcs
->y
+ parcs
->height
))
1225 box
.y2
= parcs
->y
+ parcs
->height
;
1228 TRIM_AND_TRANSLATE_BOX(box
, pDraw
, pGC
);
1229 if (BOX_NOT_EMPTY(box
)) {
1230 if (pPriv
->preRefresh
)
1231 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1236 (*pGC
->ops
->PolyFillArc
) (pDraw
, pGC
, narcsInit
, parcsInit
);
1238 if (boxNotEmpty
&& pPriv
->postRefresh
)
1239 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1241 SHADOW_GC_OP_EPILOGUE(pGC
);
1245 ShadowTextExtent(FontPtr pFont
, int count
, char *chars
,
1246 FontEncoding fontEncoding
, BoxPtr box
)
1250 CharInfoPtr charinfo
[255]; /* encoding only has 1 byte for count */
1252 GetGlyphs(pFont
, (unsigned long) count
, (unsigned char *) chars
,
1253 fontEncoding
, &n
, charinfo
);
1255 for (i
= 0; i
< n
; i
++) {
1256 w
+= charinfo
[i
]->metrics
.characterWidth
;
1259 w
+= charinfo
[i
- 1]->metrics
.rightSideBearing
;
1264 if (charinfo
[0]->metrics
.leftSideBearing
< 0) {
1265 box
->x1
= charinfo
[0]->metrics
.leftSideBearing
;
1269 box
->y1
= -FONTMAXBOUNDS(pFont
, ascent
);
1270 box
->y2
= FONTMAXBOUNDS(pFont
, descent
);
1274 ShadowFontToBox(BoxPtr BB
, DrawablePtr pDrawable
, GCPtr pGC
, int x
, int y
,
1275 int count
, char *chars
, int wide
)
1280 if (pFont
->info
.constantWidth
) {
1281 int ascent
, descent
, left
, right
= 0;
1283 ascent
= max(pFont
->info
.fontAscent
, pFont
->info
.maxbounds
.ascent
);
1284 descent
= max(pFont
->info
.fontDescent
, pFont
->info
.maxbounds
.descent
);
1285 left
= pFont
->info
.maxbounds
.leftSideBearing
;
1287 right
= (count
- 1) * pFont
->info
.maxbounds
.characterWidth
;
1289 right
+= pFont
->info
.maxbounds
.rightSideBearing
;
1291 max(pDrawable
->x
+ x
- left
,
1292 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->x1
);
1294 max(pDrawable
->y
+ y
- ascent
,
1295 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->y1
);
1297 min(pDrawable
->x
+ x
+ right
,
1298 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->x2
);
1300 min(pDrawable
->y
+ y
+ descent
,
1301 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->y2
);
1304 ShadowTextExtent(pFont
, count
, chars
, wide
? (FONTLASTROW(pFont
) == 0)
1305 ? Linear16Bit
: TwoD16Bit
: Linear8Bit
, BB
);
1307 max(pDrawable
->x
+ x
+ BB
->x1
,
1308 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->x1
);
1310 max(pDrawable
->y
+ y
+ BB
->y1
,
1311 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->y1
);
1313 min(pDrawable
->x
+ x
+ BB
->x2
,
1314 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->x2
);
1316 min(pDrawable
->y
+ y
+ BB
->y2
,
1317 RegionExtents(&((WindowPtr
) pDrawable
)->winSize
)->y2
);
1322 ShadowPolyText8(DrawablePtr pDraw
,
1323 GCPtr pGC
, int x
, int y
, int count
, char *chars
)
1327 Bool boxNotEmpty
= FALSE
;
1329 SHADOW_GC_OP_PROLOGUE(pGC
);
1331 if (IS_VISIBLE(pDraw
)) {
1332 ShadowFontToBox(&box
, pDraw
, pGC
, x
, y
, count
, chars
, 0);
1335 if (BOX_NOT_EMPTY(box
)) {
1336 if (pPriv
->preRefresh
)
1337 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1342 width
= (*pGC
->ops
->PolyText8
) (pDraw
, pGC
, x
, y
, count
, chars
);
1344 if (boxNotEmpty
&& pPriv
->postRefresh
)
1345 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1347 SHADOW_GC_OP_EPILOGUE(pGC
);
1353 ShadowPolyText16(DrawablePtr pDraw
,
1354 GCPtr pGC
, int x
, int y
, int count
, unsigned short *chars
)
1358 Bool boxNotEmpty
= FALSE
;
1360 SHADOW_GC_OP_PROLOGUE(pGC
);
1362 if (IS_VISIBLE(pDraw
)) {
1363 ShadowFontToBox(&box
, pDraw
, pGC
, x
, y
, count
, (char *) chars
, 1);
1366 if (BOX_NOT_EMPTY(box
)) {
1367 if (pPriv
->preRefresh
)
1368 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1373 width
= (*pGC
->ops
->PolyText16
) (pDraw
, pGC
, x
, y
, count
, chars
);
1375 if (boxNotEmpty
&& pPriv
->postRefresh
)
1376 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1378 SHADOW_GC_OP_EPILOGUE(pGC
);
1384 ShadowImageText8(DrawablePtr pDraw
,
1385 GCPtr pGC
, int x
, int y
, int count
, char *chars
)
1388 Bool boxNotEmpty
= FALSE
;
1390 SHADOW_GC_OP_PROLOGUE(pGC
);
1392 if (IS_VISIBLE(pDraw
) && count
) {
1393 int top
, bot
, Min
, Max
;
1395 top
= max(FONTMAXBOUNDS(pGC
->font
, ascent
), FONTASCENT(pGC
->font
));
1396 bot
= max(FONTMAXBOUNDS(pGC
->font
, descent
), FONTDESCENT(pGC
->font
));
1398 Min
= count
* FONTMINBOUNDS(pGC
->font
, characterWidth
);
1401 Max
= count
* FONTMAXBOUNDS(pGC
->font
, characterWidth
);
1406 box
.x1
= pDraw
->x
+ x
+ Min
+ FONTMINBOUNDS(pGC
->font
, leftSideBearing
);
1407 box
.x2
= pDraw
->x
+ x
+ Max
+
1408 FONTMAXBOUNDS(pGC
->font
, rightSideBearing
);
1410 box
.y1
= pDraw
->y
+ y
- top
;
1411 box
.y2
= pDraw
->y
+ y
+ bot
;
1414 if (BOX_NOT_EMPTY(box
)) {
1415 if (pPriv
->preRefresh
)
1416 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1421 (*pGC
->ops
->ImageText8
) (pDraw
, pGC
, x
, y
, count
, chars
);
1423 if (boxNotEmpty
&& pPriv
->postRefresh
)
1424 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1426 SHADOW_GC_OP_EPILOGUE(pGC
);
1430 ShadowImageText16(DrawablePtr pDraw
,
1431 GCPtr pGC
, int x
, int y
, int count
, unsigned short *chars
)
1434 Bool boxNotEmpty
= FALSE
;
1436 SHADOW_GC_OP_PROLOGUE(pGC
);
1438 if (IS_VISIBLE(pDraw
) && count
) {
1439 int top
, bot
, Min
, Max
;
1441 top
= max(FONTMAXBOUNDS(pGC
->font
, ascent
), FONTASCENT(pGC
->font
));
1442 bot
= max(FONTMAXBOUNDS(pGC
->font
, descent
), FONTDESCENT(pGC
->font
));
1444 Min
= count
* FONTMINBOUNDS(pGC
->font
, characterWidth
);
1447 Max
= count
* FONTMAXBOUNDS(pGC
->font
, characterWidth
);
1452 box
.x1
= pDraw
->x
+ x
+ Min
+ FONTMINBOUNDS(pGC
->font
, leftSideBearing
);
1453 box
.x2
= pDraw
->x
+ x
+ Max
+
1454 FONTMAXBOUNDS(pGC
->font
, rightSideBearing
);
1456 box
.y1
= pDraw
->y
+ y
- top
;
1457 box
.y2
= pDraw
->y
+ y
+ bot
;
1460 if (BOX_NOT_EMPTY(box
)) {
1461 if (pPriv
->preRefresh
)
1462 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1467 (*pGC
->ops
->ImageText16
) (pDraw
, pGC
, x
, y
, count
, chars
);
1469 if (boxNotEmpty
&& pPriv
->postRefresh
)
1470 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1472 SHADOW_GC_OP_EPILOGUE(pGC
);
1476 ShadowImageGlyphBlt(DrawablePtr pDraw
,
1479 unsigned int nglyphInit
,
1480 CharInfoPtr
* ppciInit
, pointer pglyphBase
)
1483 Bool boxNotEmpty
= FALSE
;
1485 SHADOW_GC_OP_PROLOGUE(pGC
);
1487 if (IS_VISIBLE(pDraw
) && nglyphInit
) {
1488 CharInfoPtr
*ppci
= ppciInit
;
1489 unsigned int nglyph
= nglyphInit
;
1490 int top
, bot
, width
= 0;
1492 top
= max(FONTMAXBOUNDS(pGC
->font
, ascent
), FONTASCENT(pGC
->font
));
1493 bot
= max(FONTMAXBOUNDS(pGC
->font
, descent
), FONTDESCENT(pGC
->font
));
1495 box
.x1
= ppci
[0]->metrics
.leftSideBearing
;
1498 box
.x2
= ppci
[nglyph
- 1]->metrics
.rightSideBearing
-
1499 ppci
[nglyph
- 1]->metrics
.characterWidth
;
1503 box
.x2
+= pDraw
->x
+ x
;
1504 box
.x1
+= pDraw
->x
+ x
;
1507 width
+= (*ppci
)->metrics
.characterWidth
;
1516 box
.y1
= pDraw
->y
+ y
- top
;
1517 box
.y2
= pDraw
->y
+ y
+ bot
;
1520 if (BOX_NOT_EMPTY(box
)) {
1521 if (pPriv
->preRefresh
)
1522 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1527 (*pGC
->ops
->ImageGlyphBlt
) (pDraw
, pGC
, x
, y
, nglyphInit
,
1528 ppciInit
, pglyphBase
);
1530 if (boxNotEmpty
&& pPriv
->postRefresh
)
1531 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1533 SHADOW_GC_OP_EPILOGUE(pGC
);
1537 ShadowPolyGlyphBlt(DrawablePtr pDraw
,
1540 unsigned int nglyphInit
,
1541 CharInfoPtr
* ppciInit
, pointer pglyphBase
)
1544 Bool boxNotEmpty
= FALSE
;
1546 SHADOW_GC_OP_PROLOGUE(pGC
);
1548 if (IS_VISIBLE(pDraw
) && nglyphInit
) {
1549 CharInfoPtr
*ppci
= ppciInit
;
1550 unsigned int nglyph
= nglyphInit
;
1553 box
.x1
= pDraw
->x
+ x
+ ppci
[0]->metrics
.leftSideBearing
;
1554 box
.x2
= pDraw
->x
+ x
+ ppci
[nglyph
- 1]->metrics
.rightSideBearing
;
1560 width
+= (*ppci
)->metrics
.characterWidth
;
1570 box
.y1
= pDraw
->y
+ y
- FONTMAXBOUNDS(pGC
->font
, ascent
);
1571 box
.y2
= pDraw
->y
+ y
+ FONTMAXBOUNDS(pGC
->font
, descent
);
1574 if (BOX_NOT_EMPTY(box
)) {
1575 if (pPriv
->preRefresh
)
1576 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1581 (*pGC
->ops
->PolyGlyphBlt
) (pDraw
, pGC
, x
, y
, nglyphInit
,
1582 ppciInit
, pglyphBase
);
1584 if (boxNotEmpty
&& pPriv
->postRefresh
)
1585 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1587 SHADOW_GC_OP_EPILOGUE(pGC
);
1591 ShadowPushPixels(GCPtr pGC
,
1593 DrawablePtr pDraw
, int dx
, int dy
, int xOrg
, int yOrg
)
1596 Bool boxNotEmpty
= FALSE
;
1598 SHADOW_GC_OP_PROLOGUE(pGC
);
1600 if (IS_VISIBLE(pDraw
)) {
1604 if (!pGC
->miTranslate
) {
1609 box
.x2
= box
.x1
+ dx
;
1610 box
.y2
= box
.y1
+ dy
;
1613 if (BOX_NOT_EMPTY(box
)) {
1614 if (pPriv
->preRefresh
)
1615 (*pPriv
->preRefresh
) (pPriv
->pScrn
, 1, &box
);
1620 (*pGC
->ops
->PushPixels
) (pGC
, pBitMap
, pDraw
, dx
, dy
, xOrg
, yOrg
);
1622 if (boxNotEmpty
&& pPriv
->postRefresh
)
1623 (*pPriv
->postRefresh
) (pPriv
->pScrn
, 1, &box
);
1625 SHADOW_GC_OP_EPILOGUE(pGC
);
1628 GCOps ShadowGCOps
= {
1629 ShadowFillSpans
, ShadowSetSpans
,
1630 ShadowPutImage
, ShadowCopyArea
,
1631 ShadowCopyPlane
, ShadowPolyPoint
,
1632 ShadowPolylines
, ShadowPolySegment
,
1633 ShadowPolyRectangle
, ShadowPolyArc
,
1634 ShadowFillPolygon
, ShadowPolyFillRect
,
1635 ShadowPolyFillArc
, ShadowPolyText8
,
1636 ShadowPolyText16
, ShadowImageText8
,
1637 ShadowImageText16
, ShadowImageGlyphBlt
,
1638 ShadowPolyGlyphBlt
, ShadowPushPixels
,