2 * X11 graphics driver graphics functions
4 * Copyright 1993,1994 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * FIXME: only some of these functions obey the GM_ADVANCED
37 #include <X11/Intrinsic.h>
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(graphics
);
46 #define ABS(x) ((x)<0?(-(x)):(x))
48 /* ROP code to GC function conversion */
49 const int X11DRV_XROPfunction
[16] =
51 GXclear
, /* R2_BLACK */
52 GXnor
, /* R2_NOTMERGEPEN */
53 GXandInverted
, /* R2_MASKNOTPEN */
54 GXcopyInverted
, /* R2_NOTCOPYPEN */
55 GXandReverse
, /* R2_MASKPENNOT */
56 GXinvert
, /* R2_NOT */
57 GXxor
, /* R2_XORPEN */
58 GXnand
, /* R2_NOTMASKPEN */
59 GXand
, /* R2_MASKPEN */
60 GXequiv
, /* R2_NOTXORPEN */
62 GXorInverted
, /* R2_MERGENOTPEN */
63 GXcopy
, /* R2_COPYPEN */
64 GXorReverse
, /* R2_MERGEPENNOT */
65 GXor
, /* R2_MERGEPEN */
70 /***********************************************************************
71 * X11DRV_SetupGCForPatBlt
73 * Setup the GC for a PatBlt operation using current brush.
74 * If fMapColors is TRUE, X pixels are mapped to Windows colors.
75 * Return FALSE if brush is BS_NULL, TRUE otherwise.
77 BOOL
X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE
*physDev
, GC gc
, BOOL fMapColors
)
84 if (physDev
->brush
.style
== BS_NULL
) return FALSE
;
85 if (physDev
->brush
.pixel
== -1)
87 /* Special case used for monochrome pattern brushes.
88 * We need to swap foreground and background because
89 * Windows does it the wrong way...
91 val
.foreground
= physDev
->backgroundPixel
;
92 val
.background
= physDev
->textPixel
;
96 val
.foreground
= physDev
->brush
.pixel
;
97 val
.background
= physDev
->backgroundPixel
;
99 if (fMapColors
&& X11DRV_PALETTE_XPixelToPalette
)
101 val
.foreground
= X11DRV_PALETTE_XPixelToPalette
[val
.foreground
];
102 val
.background
= X11DRV_PALETTE_XPixelToPalette
[val
.background
];
105 val
.function
= X11DRV_XROPfunction
[GetROP2(physDev
->hdc
)-1];
107 ** Let's replace GXinvert by GXxor with (black xor white)
108 ** This solves the selection color and leak problems in excel
109 ** FIXME : Let's do that only if we work with X-pixels, not with Win-pixels
111 if (val
.function
== GXinvert
)
113 val
.foreground
= (WhitePixel( gdi_display
, DefaultScreen(gdi_display
) ) ^
114 BlackPixel( gdi_display
, DefaultScreen(gdi_display
) ));
115 val
.function
= GXxor
;
117 val
.fill_style
= physDev
->brush
.fillStyle
;
118 switch(val
.fill_style
)
121 case FillOpaqueStippled
:
122 if (GetBkMode(physDev
->hdc
)==OPAQUE
) val
.fill_style
= FillOpaqueStippled
;
123 val
.stipple
= physDev
->brush
.pixmap
;
128 if (fMapColors
&& X11DRV_PALETTE_XPixelToPalette
)
133 pixmap
= XCreatePixmap( gdi_display
, root_window
, 8, 8, screen_depth
);
134 image
= XGetImage( gdi_display
, physDev
->brush
.pixmap
, 0, 0, 8, 8,
135 AllPlanes
, ZPixmap
);
136 for (y
= 0; y
< 8; y
++)
137 for (x
= 0; x
< 8; x
++)
138 XPutPixel( image
, x
, y
,
139 X11DRV_PALETTE_XPixelToPalette
[XGetPixel( image
, x
, y
)] );
140 XPutImage( gdi_display
, pixmap
, gc
, image
, 0, 0, 0, 0, 8, 8 );
141 XDestroyImage( image
);
145 else val
.tile
= physDev
->brush
.pixmap
;
153 GetBrushOrgEx( physDev
->hdc
, &pt
);
154 val
.ts_x_origin
= physDev
->org
.x
+ pt
.x
;
155 val
.ts_y_origin
= physDev
->org
.y
+ pt
.y
;
156 val
.fill_rule
= (GetPolyFillMode(physDev
->hdc
) == WINDING
) ? WindingRule
: EvenOddRule
;
158 XChangeGC( gdi_display
, gc
,
159 GCFunction
| GCForeground
| GCBackground
| GCFillStyle
|
160 GCFillRule
| GCTileStipXOrigin
| GCTileStipYOrigin
| mask
,
162 if (pixmap
) XFreePixmap( gdi_display
, pixmap
);
168 /***********************************************************************
169 * X11DRV_SetupGCForBrush
171 * Setup physDev->gc for drawing operations using current brush.
172 * Return FALSE if brush is BS_NULL, TRUE otherwise.
174 BOOL
X11DRV_SetupGCForBrush( X11DRV_PDEVICE
*physDev
)
176 return X11DRV_SetupGCForPatBlt( physDev
, physDev
->gc
, FALSE
);
180 /***********************************************************************
181 * X11DRV_SetupGCForPen
183 * Setup physDev->gc for drawing operations using current pen.
184 * Return FALSE if pen is PS_NULL, TRUE otherwise.
186 BOOL
X11DRV_SetupGCForPen( X11DRV_PDEVICE
*physDev
)
189 UINT rop2
= GetROP2(physDev
->hdc
);
191 if (physDev
->pen
.style
== PS_NULL
) return FALSE
;
196 val
.foreground
= BlackPixel( gdi_display
, DefaultScreen(gdi_display
) );
197 val
.function
= GXcopy
;
200 val
.foreground
= WhitePixel( gdi_display
, DefaultScreen(gdi_display
) );
201 val
.function
= GXcopy
;
204 val
.foreground
= physDev
->pen
.pixel
;
205 /* It is very unlikely someone wants to XOR with 0 */
206 /* This fixes the rubber-drawings in paintbrush */
207 if (val
.foreground
== 0)
208 val
.foreground
= (WhitePixel( gdi_display
, DefaultScreen(gdi_display
) ) ^
209 BlackPixel( gdi_display
, DefaultScreen(gdi_display
) ));
210 val
.function
= GXxor
;
213 val
.foreground
= physDev
->pen
.pixel
;
214 val
.function
= X11DRV_XROPfunction
[rop2
-1];
216 val
.background
= physDev
->backgroundPixel
;
217 val
.fill_style
= FillSolid
;
218 val
.line_width
= physDev
->pen
.width
;
219 if (val
.line_width
<= 1) {
220 val
.cap_style
= CapNotLast
;
222 switch (physDev
->pen
.endcap
)
224 case PS_ENDCAP_SQUARE
:
225 val
.cap_style
= CapProjecting
;
228 val
.cap_style
= CapButt
;
230 case PS_ENDCAP_ROUND
:
232 val
.cap_style
= CapRound
;
235 switch (physDev
->pen
.linejoin
)
238 val
.join_style
= JoinBevel
;
241 val
.join_style
= JoinMiter
;
245 val
.join_style
= JoinRound
;
248 if ((physDev
->pen
.width
<= 1) &&
249 (physDev
->pen
.style
!= PS_SOLID
) &&
250 (physDev
->pen
.style
!= PS_INSIDEFRAME
))
252 XSetDashes( gdi_display
, physDev
->gc
, 0, physDev
->pen
.dashes
, physDev
->pen
.dash_len
);
253 val
.line_style
= (GetBkMode(physDev
->hdc
) == OPAQUE
) ? LineDoubleDash
: LineOnOffDash
;
255 else val
.line_style
= LineSolid
;
257 XChangeGC( gdi_display
, physDev
->gc
,
258 GCFunction
| GCForeground
| GCBackground
| GCLineWidth
|
259 GCLineStyle
| GCCapStyle
| GCJoinStyle
| GCFillStyle
, &val
);
265 /***********************************************************************
266 * X11DRV_SetupGCForText
268 * Setup physDev->gc for text drawing operations.
269 * Return FALSE if the font is null, TRUE otherwise.
271 BOOL
X11DRV_SetupGCForText( X11DRV_PDEVICE
*physDev
)
273 XFontStruct
* xfs
= XFONT_GetFontStruct( physDev
->font
);
279 val
.function
= GXcopy
; /* Text is always GXcopy */
280 val
.foreground
= physDev
->textPixel
;
281 val
.background
= physDev
->backgroundPixel
;
282 val
.fill_style
= FillSolid
;
286 XChangeGC( gdi_display
, physDev
->gc
,
287 GCFunction
| GCForeground
| GCBackground
| GCFillStyle
|
292 WARN("Physical font failure\n" );
296 /***********************************************************************
300 X11DRV_LineTo( X11DRV_PDEVICE
*physDev
, INT x
, INT y
)
304 if (X11DRV_SetupGCForPen( physDev
)) {
305 /* Update the pixmap from the DIB section */
306 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
308 GetCurrentPositionEx( physDev
->hdc
, &pt
[0] );
311 LPtoDP( physDev
->hdc
, pt
, 2 );
314 XDrawLine(gdi_display
, physDev
->drawable
, physDev
->gc
,
315 physDev
->org
.x
+ pt
[0].x
, physDev
->org
.y
+ pt
[0].y
,
316 physDev
->org
.x
+ pt
[1].x
, physDev
->org
.y
+ pt
[1].y
);
319 /* Update the DIBSection from the pixmap */
320 X11DRV_UnlockDIBSection(physDev
, TRUE
);
327 /***********************************************************************
330 * Helper functions for Arc(), Chord() and Pie().
331 * 'lines' is the number of lines to draw: 0 for Arc, 1 for Chord, 2 for Pie.
335 X11DRV_DrawArc( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
336 INT bottom
, INT xstart
, INT ystart
,
337 INT xend
, INT yend
, INT lines
)
339 INT xcenter
, ycenter
, istart_angle
, idiff_angle
;
341 double start_angle
, end_angle
;
347 SetRect(&rc
, left
, top
, right
, bottom
);
352 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
353 LPtoDP(physDev
->hdc
, &start
, 1);
354 LPtoDP(physDev
->hdc
, &end
, 1);
356 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
357 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
358 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
)
359 ||(lines
&& ((rc
.right
-rc
.left
==1)||(rc
.bottom
-rc
.top
==1)))) return TRUE
;
361 if (GetArcDirection( physDev
->hdc
) == AD_CLOCKWISE
)
362 { POINT tmp
= start
; start
= end
; end
= tmp
; }
364 oldwidth
= width
= physDev
->pen
.width
;
365 if (!width
) width
= 1;
366 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
368 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
370 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
371 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
372 rc
.left
+= width
/ 2;
373 rc
.right
-= (width
- 1) / 2;
375 rc
.bottom
-= (width
- 1) / 2;
377 if(width
== 0) width
= 1; /* more accurate */
378 physDev
->pen
.width
= width
;
380 xcenter
= (rc
.right
+ rc
.left
) / 2;
381 ycenter
= (rc
.bottom
+ rc
.top
) / 2;
382 start_angle
= atan2( (double)(ycenter
-start
.y
)*(rc
.right
-rc
.left
),
383 (double)(start
.x
-xcenter
)*(rc
.bottom
-rc
.top
) );
384 end_angle
= atan2( (double)(ycenter
-end
.y
)*(rc
.right
-rc
.left
),
385 (double)(end
.x
-xcenter
)*(rc
.bottom
-rc
.top
) );
386 if ((start
.x
==end
.x
)&&(start
.y
==end
.y
))
387 { /* A lazy program delivers xstart=xend=ystart=yend=0) */
391 else /* notorious cases */
392 if ((start_angle
== PI
)&&( end_angle
<0))
395 if ((end_angle
== PI
)&&( start_angle
<0))
397 istart_angle
= (INT
)(start_angle
* 180 * 64 / PI
+ 0.5);
398 idiff_angle
= (INT
)((end_angle
- start_angle
) * 180 * 64 / PI
+ 0.5);
399 if (idiff_angle
<= 0) idiff_angle
+= 360 * 64;
401 /* Update the pixmap from the DIB section */
402 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
404 /* Fill arc with brush if Chord() or Pie() */
406 if ((lines
> 0) && X11DRV_SetupGCForBrush( physDev
)) {
408 XSetArcMode( gdi_display
, physDev
->gc
, (lines
==1) ? ArcChord
: ArcPieSlice
);
409 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
410 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
411 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, istart_angle
, idiff_angle
);
416 /* Draw arc and lines */
418 if (X11DRV_SetupGCForPen( physDev
))
421 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
422 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
423 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, istart_angle
, idiff_angle
);
425 /* use the truncated values */
426 start_angle
=(double)istart_angle
*PI
/64./180.;
427 end_angle
=(double)(istart_angle
+idiff_angle
)*PI
/64./180.;
428 /* calculate the endpoints and round correctly */
429 points
[0].x
= (int) floor(physDev
->org
.x
+ (rc
.right
+rc
.left
)/2.0 +
430 cos(start_angle
) * (rc
.right
-rc
.left
-width
*2+2) / 2. + 0.5);
431 points
[0].y
= (int) floor(physDev
->org
.y
+ (rc
.top
+rc
.bottom
)/2.0 -
432 sin(start_angle
) * (rc
.bottom
-rc
.top
-width
*2+2) / 2. + 0.5);
433 points
[1].x
= (int) floor(physDev
->org
.x
+ (rc
.right
+rc
.left
)/2.0 +
434 cos(end_angle
) * (rc
.right
-rc
.left
-width
*2+2) / 2. + 0.5);
435 points
[1].y
= (int) floor(physDev
->org
.y
+ (rc
.top
+rc
.bottom
)/2.0 -
436 sin(end_angle
) * (rc
.bottom
-rc
.top
-width
*2+2) / 2. + 0.5);
438 /* OK, this stuff is optimized for Xfree86
439 * which is probably the server most used by
440 * wine users. Other X servers will not
441 * display correctly. (eXceed for instance)
442 * so if you feel you must make changes, make sure that
443 * you either use Xfree86 or separate your changes
444 * from these (compile switch or whatever)
448 points
[3] = points
[1];
449 points
[1].x
= physDev
->org
.x
+ xcenter
;
450 points
[1].y
= physDev
->org
.y
+ ycenter
;
451 points
[2] = points
[1];
452 dx1
=points
[1].x
-points
[0].x
;
453 dy1
=points
[1].y
-points
[0].y
;
454 if(((rc
.top
-rc
.bottom
) | -2) == -2)
455 if(dy1
>0) points
[1].y
--;
457 if (((-dx1
)*64)<=ABS(dy1
)*37) points
[0].x
--;
458 if(((-dx1
*9))<(dy1
*16)) points
[0].y
--;
459 if( dy1
<0 && ((dx1
*9)) < (dy1
*16)) points
[0].y
--;
461 if(dy1
< 0) points
[0].y
--;
462 if(((rc
.right
-rc
.left
) | -2) == -2) points
[1].x
--;
464 dx1
=points
[3].x
-points
[2].x
;
465 dy1
=points
[3].y
-points
[2].y
;
466 if(((rc
.top
-rc
.bottom
) | -2 ) == -2)
467 if(dy1
< 0) points
[2].y
--;
469 if( dy1
>0) points
[3].y
--;
470 if(((rc
.right
-rc
.left
) | -2) == -2 ) points
[2].x
--;
473 if( dx1
* 64 < dy1
* -37 ) points
[3].x
--;
477 XDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
478 points
, lines
+1, CoordModeOrigin
);
484 /* Update the DIBSection of the pixmap */
485 X11DRV_UnlockDIBSection(physDev
, update
);
487 physDev
->pen
.width
= oldwidth
;
492 /***********************************************************************
496 X11DRV_Arc( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
497 INT xstart
, INT ystart
, INT xend
, INT yend
)
499 return X11DRV_DrawArc( physDev
, left
, top
, right
, bottom
,
500 xstart
, ystart
, xend
, yend
, 0 );
504 /***********************************************************************
508 X11DRV_Pie( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
509 INT xstart
, INT ystart
, INT xend
, INT yend
)
511 return X11DRV_DrawArc( physDev
, left
, top
, right
, bottom
,
512 xstart
, ystart
, xend
, yend
, 2 );
515 /***********************************************************************
519 X11DRV_Chord( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
520 INT xstart
, INT ystart
, INT xend
, INT yend
)
522 return X11DRV_DrawArc( physDev
, left
, top
, right
, bottom
,
523 xstart
, ystart
, xend
, yend
, 1 );
527 /***********************************************************************
531 X11DRV_Ellipse( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
)
537 SetRect(&rc
, left
, top
, right
, bottom
);
538 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
540 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
)) return TRUE
;
542 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
543 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
545 oldwidth
= width
= physDev
->pen
.width
;
546 if (!width
) width
= 1;
547 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
549 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
551 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
552 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
553 rc
.left
+= width
/ 2;
554 rc
.right
-= (width
- 1) / 2;
556 rc
.bottom
-= (width
- 1) / 2;
558 if(width
== 0) width
= 1; /* more accurate */
559 physDev
->pen
.width
= width
;
561 /* Update the pixmap from the DIB section */
562 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
564 if (X11DRV_SetupGCForBrush( physDev
))
567 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
568 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
569 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, 0, 360*64 );
573 if (X11DRV_SetupGCForPen( physDev
))
576 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
577 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
578 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, 0, 360*64 );
583 /* Update the DIBSection from the pixmap */
584 X11DRV_UnlockDIBSection(physDev
, update
);
586 physDev
->pen
.width
= oldwidth
;
591 /***********************************************************************
595 X11DRV_Rectangle(X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
)
597 INT width
, oldwidth
, oldjoinstyle
;
601 TRACE("(%d %d %d %d)\n", left
, top
, right
, bottom
);
603 SetRect(&rc
, left
, top
, right
, bottom
);
604 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
606 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
)) return TRUE
;
608 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
609 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
611 oldwidth
= width
= physDev
->pen
.width
;
612 if (!width
) width
= 1;
613 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
615 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
617 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
618 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
619 rc
.left
+= width
/ 2;
620 rc
.right
-= (width
- 1) / 2;
622 rc
.bottom
-= (width
- 1) / 2;
624 if(width
== 1) width
= 0;
625 physDev
->pen
.width
= width
;
626 oldjoinstyle
= physDev
->pen
.linejoin
;
627 if(physDev
->pen
.type
!= PS_GEOMETRIC
)
628 physDev
->pen
.linejoin
= PS_JOIN_MITER
;
630 /* Update the pixmap from the DIB section */
631 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
633 if ((rc
.right
> rc
.left
+ width
) && (rc
.bottom
> rc
.top
+ width
))
635 if (X11DRV_SetupGCForBrush( physDev
))
638 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
639 physDev
->org
.x
+ rc
.left
+ (width
+ 1) / 2,
640 physDev
->org
.y
+ rc
.top
+ (width
+ 1) / 2,
641 rc
.right
-rc
.left
-width
-1, rc
.bottom
-rc
.top
-width
-1);
646 if (X11DRV_SetupGCForPen( physDev
))
649 XDrawRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
650 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
651 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1 );
656 /* Update the DIBSection from the pixmap */
657 X11DRV_UnlockDIBSection(physDev
, update
);
659 physDev
->pen
.width
= oldwidth
;
660 physDev
->pen
.linejoin
= oldjoinstyle
;
664 /***********************************************************************
668 X11DRV_RoundRect( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
669 INT bottom
, INT ell_width
, INT ell_height
)
671 INT width
, oldwidth
, oldendcap
;
676 TRACE("(%d %d %d %d %d %d\n",
677 left
, top
, right
, bottom
, ell_width
, ell_height
);
679 SetRect(&rc
, left
, top
, right
, bottom
);
680 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
682 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
))
685 /* Make sure ell_width and ell_height are >= 1 otherwise XDrawArc gets
686 called with width/height < 0 */
687 pts
[0].x
= pts
[0].y
= 0;
688 pts
[1].x
= ell_width
;
689 pts
[1].y
= ell_height
;
690 LPtoDP(physDev
->hdc
, pts
, 2);
691 ell_width
= max(abs( pts
[1].x
- pts
[0].x
), 1);
692 ell_height
= max(abs( pts
[1].y
- pts
[0].y
), 1);
694 /* Fix the coordinates */
696 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
697 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
699 oldwidth
= width
= physDev
->pen
.width
;
700 oldendcap
= physDev
->pen
.endcap
;
701 if (!width
) width
= 1;
702 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
704 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
706 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
707 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
708 rc
.left
+= width
/ 2;
709 rc
.right
-= (width
- 1) / 2;
711 rc
.bottom
-= (width
- 1) / 2;
713 if(width
== 0) width
= 1;
714 physDev
->pen
.width
= width
;
715 physDev
->pen
.endcap
= PS_ENDCAP_SQUARE
;
717 /* Update the pixmap from the DIB section */
718 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
721 if (X11DRV_SetupGCForBrush( physDev
))
723 if (ell_width
> (rc
.right
-rc
.left
) )
724 if (ell_height
> (rc
.bottom
-rc
.top
) )
725 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
726 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
727 rc
.right
- rc
.left
- 1, rc
.bottom
- rc
.top
- 1,
730 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
731 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
732 rc
.right
- rc
.left
- 1, ell_height
, 0, 180 * 64 );
733 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
734 physDev
->org
.x
+ rc
.left
,
735 physDev
->org
.y
+ rc
.bottom
- ell_height
- 1,
736 rc
.right
- rc
.left
- 1, ell_height
, 180 * 64,
739 else if (ell_height
> (rc
.bottom
-rc
.top
) ){
740 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
741 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
742 ell_width
, rc
.bottom
- rc
.top
- 1, 90 * 64, 180 * 64 );
743 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
744 physDev
->org
.x
+ rc
.right
- ell_width
- 1, physDev
->org
.y
+ rc
.top
,
745 ell_width
, rc
.bottom
- rc
.top
- 1, 270 * 64, 180 * 64 );
747 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
748 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
749 ell_width
, ell_height
, 90 * 64, 90 * 64 );
750 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
751 physDev
->org
.x
+ rc
.left
,
752 physDev
->org
.y
+ rc
.bottom
- ell_height
- 1,
753 ell_width
, ell_height
, 180 * 64, 90 * 64 );
754 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
755 physDev
->org
.x
+ rc
.right
- ell_width
- 1,
756 physDev
->org
.y
+ rc
.bottom
- ell_height
- 1,
757 ell_width
, ell_height
, 270 * 64, 90 * 64 );
758 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
759 physDev
->org
.x
+ rc
.right
- ell_width
- 1,
760 physDev
->org
.y
+ rc
.top
,
761 ell_width
, ell_height
, 0, 90 * 64 );
763 if (ell_width
< rc
.right
- rc
.left
)
765 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
766 physDev
->org
.x
+ rc
.left
+ (ell_width
+ 1) / 2,
767 physDev
->org
.y
+ rc
.top
+ 1,
768 rc
.right
- rc
.left
- ell_width
- 1,
769 (ell_height
+ 1) / 2 - 1);
770 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
771 physDev
->org
.x
+ rc
.left
+ (ell_width
+ 1) / 2,
772 physDev
->org
.y
+ rc
.bottom
- (ell_height
) / 2 - 1,
773 rc
.right
- rc
.left
- ell_width
- 1,
776 if (ell_height
< rc
.bottom
- rc
.top
)
778 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
779 physDev
->org
.x
+ rc
.left
+ 1,
780 physDev
->org
.y
+ rc
.top
+ (ell_height
+ 1) / 2,
781 rc
.right
- rc
.left
- 2,
782 rc
.bottom
- rc
.top
- ell_height
- 1);
786 /* FIXME: this could be done with on X call
787 * more efficient and probably more correct
788 * on any X server: XDrawArcs will draw
789 * straight horizontal and vertical lines
790 * if width or height are zero.
792 * BTW this stuff is optimized for an Xfree86 server
793 * read the comments inside the X11DRV_DrawArc function
795 if (X11DRV_SetupGCForPen( physDev
))
797 if (ell_width
> (rc
.right
-rc
.left
) )
798 if (ell_height
> (rc
.bottom
-rc
.top
) )
799 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
800 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
801 rc
.right
- rc
.left
- 1, rc
.bottom
- rc
.top
- 1, 0 , 360 * 64 );
803 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
804 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
805 rc
.right
- rc
.left
- 1, ell_height
- 1, 0 , 180 * 64 );
806 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
807 physDev
->org
.x
+ rc
.left
,
808 physDev
->org
.y
+ rc
.bottom
- ell_height
,
809 rc
.right
- rc
.left
- 1, ell_height
- 1, 180 * 64 , 180 * 64 );
811 else if (ell_height
> (rc
.bottom
-rc
.top
) ){
812 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
813 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
814 ell_width
- 1 , rc
.bottom
- rc
.top
- 1, 90 * 64 , 180 * 64 );
815 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
816 physDev
->org
.x
+ rc
.right
- ell_width
,
817 physDev
->org
.y
+ rc
.top
,
818 ell_width
- 1 , rc
.bottom
- rc
.top
- 1, 270 * 64 , 180 * 64 );
820 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
821 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
822 ell_width
- 1, ell_height
- 1, 90 * 64, 90 * 64 );
823 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
824 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.bottom
- ell_height
,
825 ell_width
- 1, ell_height
- 1, 180 * 64, 90 * 64 );
826 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
827 physDev
->org
.x
+ rc
.right
- ell_width
,
828 physDev
->org
.y
+ rc
.bottom
- ell_height
,
829 ell_width
- 1, ell_height
- 1, 270 * 64, 90 * 64 );
830 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
831 physDev
->org
.x
+ rc
.right
- ell_width
, physDev
->org
.y
+ rc
.top
,
832 ell_width
- 1, ell_height
- 1, 0, 90 * 64 );
834 if (ell_width
< rc
.right
- rc
.left
)
836 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
837 physDev
->org
.x
+ rc
.left
+ ell_width
/ 2,
838 physDev
->org
.y
+ rc
.top
,
839 physDev
->org
.x
+ rc
.right
- (ell_width
+1) / 2,
840 physDev
->org
.y
+ rc
.top
);
841 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
842 physDev
->org
.x
+ rc
.left
+ ell_width
/ 2 ,
843 physDev
->org
.y
+ rc
.bottom
- 1,
844 physDev
->org
.x
+ rc
.right
- (ell_width
+1)/ 2,
845 physDev
->org
.y
+ rc
.bottom
- 1);
847 if (ell_height
< rc
.bottom
- rc
.top
)
849 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
850 physDev
->org
.x
+ rc
.right
- 1,
851 physDev
->org
.y
+ rc
.top
+ ell_height
/ 2,
852 physDev
->org
.x
+ rc
.right
- 1,
853 physDev
->org
.y
+ rc
.bottom
- (ell_height
+1) / 2);
854 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
855 physDev
->org
.x
+ rc
.left
,
856 physDev
->org
.y
+ rc
.top
+ ell_height
/ 2,
857 physDev
->org
.x
+ rc
.left
,
858 physDev
->org
.y
+ rc
.bottom
- (ell_height
+1) / 2);
863 /* Update the DIBSection from the pixmap */
864 X11DRV_UnlockDIBSection(physDev
, update
);
866 physDev
->pen
.width
= oldwidth
;
867 physDev
->pen
.endcap
= oldendcap
;
872 /***********************************************************************
876 X11DRV_SetPixel( X11DRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
)
883 LPtoDP( physDev
->hdc
, &pt
, 1 );
884 pixel
= X11DRV_PALETTE_ToPhysical( physDev
, color
);
886 /* Update the pixmap from the DIB section */
887 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
889 /* inefficient but simple... */
891 XSetForeground( gdi_display
, physDev
->gc
, pixel
);
892 XSetFunction( gdi_display
, physDev
->gc
, GXcopy
);
893 XDrawPoint( gdi_display
, physDev
->drawable
, physDev
->gc
,
894 physDev
->org
.x
+ pt
.x
, physDev
->org
.y
+ pt
.y
);
897 /* Update the DIBSection from the pixmap */
898 X11DRV_UnlockDIBSection(physDev
, TRUE
);
900 return X11DRV_PALETTE_ToLogical(pixel
);
904 /***********************************************************************
908 X11DRV_GetPixel( X11DRV_PDEVICE
*physDev
, INT x
, INT y
)
910 static Pixmap pixmap
= 0;
914 BOOL memdc
= (GetObjectType(physDev
->hdc
) == OBJ_MEMDC
);
915 DC
*dc
= physDev
->dc
;
919 LPtoDP( physDev
->hdc
, &pt
, 1 );
921 /* Update the pixmap from the DIB section */
922 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
927 image
= XGetImage( gdi_display
, physDev
->drawable
,
928 physDev
->org
.x
+ pt
.x
, physDev
->org
.y
+ pt
.y
,
929 1, 1, AllPlanes
, ZPixmap
);
933 /* If we are reading from the screen, use a temporary copy */
934 /* to avoid a BadMatch error */
935 if (!pixmap
) pixmap
= XCreatePixmap( gdi_display
, root_window
,
936 1, 1, dc
->bitsPerPixel
);
937 XCopyArea( gdi_display
, physDev
->drawable
, pixmap
, BITMAP_colorGC
,
938 physDev
->org
.x
+ pt
.x
, physDev
->org
.y
+ pt
.y
, 1, 1, 0, 0 );
939 image
= XGetImage( gdi_display
, pixmap
, 0, 0, 1, 1, AllPlanes
, ZPixmap
);
941 pixel
= XGetPixel( image
, 0, 0 );
942 XDestroyImage( image
);
945 /* Update the DIBSection from the pixmap */
946 X11DRV_UnlockDIBSection(physDev
, FALSE
);
948 return X11DRV_PALETTE_ToLogical(pixel
);
952 /***********************************************************************
956 X11DRV_PaintRgn( X11DRV_PDEVICE
*physDev
, HRGN hrgn
)
958 if (X11DRV_SetupGCForBrush( physDev
))
962 RGNDATA
*data
= X11DRV_GetRegionData( hrgn
, physDev
->hdc
);
964 if (!data
) return FALSE
;
965 rect
= (XRectangle
*)data
->Buffer
;
966 for (i
= 0; i
< data
->rdh
.nCount
; i
++)
968 rect
[i
].x
+= physDev
->org
.x
;
969 rect
[i
].y
+= physDev
->org
.y
;
972 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
974 XFillRectangles( gdi_display
, physDev
->drawable
, physDev
->gc
, rect
, data
->rdh
.nCount
);
976 X11DRV_UnlockDIBSection(physDev
, TRUE
);
977 HeapFree( GetProcessHeap(), 0, data
);
982 /**********************************************************************
986 X11DRV_Polyline( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
)
992 if((oldwidth
= physDev
->pen
.width
) == 0) physDev
->pen
.width
= 1;
994 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * count
)))
996 WARN("No memory to convert POINTs to XPoints!\n");
999 for (i
= 0; i
< count
; i
++)
1002 LPtoDP(physDev
->hdc
, &tmp
, 1);
1003 points
[i
].x
= physDev
->org
.x
+ tmp
.x
;
1004 points
[i
].y
= physDev
->org
.y
+ tmp
.y
;
1007 if (X11DRV_SetupGCForPen ( physDev
))
1009 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1011 XDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1012 points
, count
, CoordModeOrigin
);
1013 wine_tsx11_unlock();
1014 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1017 HeapFree( GetProcessHeap(), 0, points
);
1018 physDev
->pen
.width
= oldwidth
;
1023 /**********************************************************************
1027 X11DRV_Polygon( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
)
1031 BOOL update
= FALSE
;
1033 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * (count
+1) )))
1035 WARN("No memory to convert POINTs to XPoints!\n");
1038 for (i
= 0; i
< count
; i
++)
1041 LPtoDP(physDev
->hdc
, &tmp
, 1);
1042 points
[i
].x
= physDev
->org
.x
+ tmp
.x
;
1043 points
[i
].y
= physDev
->org
.y
+ tmp
.y
;
1045 points
[count
] = points
[0];
1047 /* Update the pixmap from the DIB section */
1048 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1050 if (X11DRV_SetupGCForBrush( physDev
))
1053 XFillPolygon( gdi_display
, physDev
->drawable
, physDev
->gc
,
1054 points
, count
+1, Complex
, CoordModeOrigin
);
1055 wine_tsx11_unlock();
1058 if (X11DRV_SetupGCForPen ( physDev
))
1061 XDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1062 points
, count
+1, CoordModeOrigin
);
1063 wine_tsx11_unlock();
1067 /* Update the DIBSection from the pixmap */
1068 X11DRV_UnlockDIBSection(physDev
, update
);
1070 HeapFree( GetProcessHeap(), 0, points
);
1075 /**********************************************************************
1076 * X11DRV_PolyPolygon
1079 X11DRV_PolyPolygon( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, const INT
* counts
, UINT polygons
)
1083 /* FIXME: The points should be converted to device coords before */
1084 /* creating the region. */
1086 hrgn
= CreatePolyPolygonRgn( pt
, counts
, polygons
, GetPolyFillMode( physDev
->hdc
) );
1087 X11DRV_PaintRgn( physDev
, hrgn
);
1088 DeleteObject( hrgn
);
1090 /* Draw the outline of the polygons */
1092 if (X11DRV_SetupGCForPen ( physDev
))
1097 /* Update the pixmap from the DIB section */
1098 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1100 for (i
= 0; i
< polygons
; i
++) if (counts
[i
] > max
) max
= counts
[i
];
1101 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * (max
+1) )))
1103 WARN("No memory to convert POINTs to XPoints!\n");
1106 for (i
= 0; i
< polygons
; i
++)
1108 for (j
= 0; j
< counts
[i
]; j
++)
1111 LPtoDP(physDev
->hdc
, &tmp
, 1);
1112 points
[j
].x
= physDev
->org
.x
+ tmp
.x
;
1113 points
[j
].y
= physDev
->org
.y
+ tmp
.y
;
1116 points
[j
] = points
[0];
1118 XDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1119 points
, j
+ 1, CoordModeOrigin
);
1120 wine_tsx11_unlock();
1123 /* Update the DIBSection of the dc's bitmap */
1124 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1126 HeapFree( GetProcessHeap(), 0, points
);
1132 /**********************************************************************
1133 * X11DRV_PolyPolyline
1136 X11DRV_PolyPolyline( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, const DWORD
* counts
, DWORD polylines
)
1138 if (X11DRV_SetupGCForPen ( physDev
))
1143 /* Update the pixmap from the DIB section */
1144 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1146 for (i
= 0; i
< polylines
; i
++) if (counts
[i
] > max
) max
= counts
[i
];
1147 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * max
)))
1149 WARN("No memory to convert POINTs to XPoints!\n");
1152 for (i
= 0; i
< polylines
; i
++)
1154 for (j
= 0; j
< counts
[i
]; j
++)
1157 LPtoDP(physDev
->hdc
, &tmp
, 1);
1158 points
[j
].x
= physDev
->org
.x
+ tmp
.x
;
1159 points
[j
].y
= physDev
->org
.y
+ tmp
.y
;
1163 XDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1164 points
, j
, CoordModeOrigin
);
1165 wine_tsx11_unlock();
1168 /* Update the DIBSection of the dc's bitmap */
1169 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1171 HeapFree( GetProcessHeap(), 0, points
);
1177 /**********************************************************************
1178 * X11DRV_InternalFloodFill
1180 * Internal helper function for flood fill.
1181 * (xorg,yorg) is the origin of the X image relative to the drawable.
1182 * (x,y) is relative to the origin of the X image.
1184 static void X11DRV_InternalFloodFill(XImage
*image
, X11DRV_PDEVICE
*physDev
,
1187 Pixel pixel
, WORD fillType
)
1191 #define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \
1192 (XGetPixel(image,x,y) != pixel) : \
1193 (XGetPixel(image,x,y) == pixel))
1195 if (!TO_FLOOD(x
,y
)) return;
1197 /* Find left and right boundaries */
1200 while ((left
> 0) && TO_FLOOD( left
-1, y
)) left
--;
1201 while ((right
< image
->width
) && TO_FLOOD( right
, y
)) right
++;
1202 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
1203 xOrg
+ left
, yOrg
+ y
, right
-left
, 1 );
1205 /* Set the pixels of this line so we don't fill it again */
1207 for (x
= left
; x
< right
; x
++)
1209 if (fillType
== FLOODFILLBORDER
) XPutPixel( image
, x
, y
, pixel
);
1210 else XPutPixel( image
, x
, y
, ~pixel
);
1213 /* Fill the line above */
1220 while ((x
< right
) && !TO_FLOOD(x
,y
)) x
++;
1221 if (x
>= right
) break;
1222 while ((x
< right
) && TO_FLOOD(x
,y
)) x
++;
1223 X11DRV_InternalFloodFill(image
, physDev
, x
-1, y
,
1224 xOrg
, yOrg
, pixel
, fillType
);
1228 /* Fill the line below */
1230 if ((y
+= 2) < image
->height
)
1235 while ((x
< right
) && !TO_FLOOD(x
,y
)) x
++;
1236 if (x
>= right
) break;
1237 while ((x
< right
) && TO_FLOOD(x
,y
)) x
++;
1238 X11DRV_InternalFloodFill(image
, physDev
, x
-1, y
,
1239 xOrg
, yOrg
, pixel
, fillType
);
1246 /**********************************************************************
1247 * X11DRV_ExtFloodFill
1250 X11DRV_ExtFloodFill( X11DRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
,
1255 DC
*dc
= physDev
->dc
;
1257 TRACE("X11DRV_ExtFloodFill %d,%d %06lx %d\n", x
, y
, color
, fillType
);
1259 if (!PtVisible( physDev
->hdc
, x
, y
)) return FALSE
;
1260 if (GetRgnBox( dc
->hGCClipRgn
, &rect
) == ERROR
) return FALSE
;
1263 image
= XGetImage( gdi_display
, physDev
->drawable
,
1264 physDev
->org
.x
+ rect
.left
, physDev
->org
.y
+ rect
.top
,
1265 rect
.right
- rect
.left
, rect
.bottom
- rect
.top
,
1266 AllPlanes
, ZPixmap
);
1267 wine_tsx11_unlock();
1268 if (!image
) return FALSE
;
1270 if (X11DRV_SetupGCForBrush( physDev
))
1275 LPtoDP(physDev
->hdc
, &pt
, 1);
1276 /* Update the pixmap from the DIB section */
1277 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1279 /* ROP mode is always GXcopy for flood-fill */
1281 XSetFunction( gdi_display
, physDev
->gc
, GXcopy
);
1282 X11DRV_InternalFloodFill(image
, physDev
,
1283 physDev
->org
.x
+ pt
.x
- rect
.left
,
1284 physDev
->org
.y
+ pt
.y
- rect
.top
,
1285 rect
.left
, rect
.top
,
1286 X11DRV_PALETTE_ToPhysical( physDev
, color
),
1288 wine_tsx11_unlock();
1289 /* Update the DIBSection of the dc's bitmap */
1290 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1294 XDestroyImage( image
);
1295 wine_tsx11_unlock();
1299 /**********************************************************************
1303 X11DRV_SetBkColor( X11DRV_PDEVICE
*physDev
, COLORREF color
)
1305 physDev
->backgroundPixel
= X11DRV_PALETTE_ToPhysical( physDev
, color
);
1309 /**********************************************************************
1310 * X11DRV_SetTextColor
1313 X11DRV_SetTextColor( X11DRV_PDEVICE
*physDev
, COLORREF color
)
1315 physDev
->textPixel
= X11DRV_PALETTE_ToPhysical( physDev
, color
);
1319 /***********************************************************************
1320 * GetDCOrgEx (X11DRV.@)
1322 BOOL
X11DRV_GetDCOrgEx( X11DRV_PDEVICE
*physDev
, LPPOINT lpp
)
1324 lpp
->x
= physDev
->org
.x
+ physDev
->drawable_org
.x
;
1325 lpp
->y
= physDev
->org
.y
+ physDev
->drawable_org
.y
;
1330 /***********************************************************************
1331 * SetDCOrg (X11DRV.@)
1333 DWORD
X11DRV_SetDCOrg( X11DRV_PDEVICE
*physDev
, INT x
, INT y
)
1335 DWORD ret
= MAKELONG( physDev
->org
.x
+ physDev
->drawable_org
.x
,
1336 physDev
->org
.y
+ physDev
->drawable_org
.y
);
1337 physDev
->org
.x
= x
- physDev
->drawable_org
.x
;
1338 physDev
->org
.y
= y
- physDev
->drawable_org
.y
;