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
28 #include <X11/Intrinsic.h>
31 #include <X11/Xresource.h>
32 #include <X11/Xutil.h>
49 #include "wine/debug.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(graphics
);
53 #define ABS(x) ((x)<0?(-(x)):(x))
55 /* ROP code to GC function conversion */
56 const int X11DRV_XROPfunction
[16] =
58 GXclear
, /* R2_BLACK */
59 GXnor
, /* R2_NOTMERGEPEN */
60 GXandInverted
, /* R2_MASKNOTPEN */
61 GXcopyInverted
, /* R2_NOTCOPYPEN */
62 GXandReverse
, /* R2_MASKPENNOT */
63 GXinvert
, /* R2_NOT */
64 GXxor
, /* R2_XORPEN */
65 GXnand
, /* R2_NOTMASKPEN */
66 GXand
, /* R2_MASKPEN */
67 GXequiv
, /* R2_NOTXORPEN */
69 GXorInverted
, /* R2_MERGENOTPEN */
70 GXcopy
, /* R2_COPYPEN */
71 GXorReverse
, /* R2_MERGEPENNOT */
72 GXor
, /* R2_MERGEPEN */
77 /***********************************************************************
78 * X11DRV_SetupGCForPatBlt
80 * Setup the GC for a PatBlt operation using current brush.
81 * If fMapColors is TRUE, X pixels are mapped to Windows colors.
82 * Return FALSE if brush is BS_NULL, TRUE otherwise.
84 BOOL
X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE
*physDev
, GC gc
, BOOL fMapColors
)
91 if (physDev
->brush
.style
== BS_NULL
) return FALSE
;
92 if (physDev
->brush
.pixel
== -1)
94 /* Special case used for monochrome pattern brushes.
95 * We need to swap foreground and background because
96 * Windows does it the wrong way...
98 val
.foreground
= physDev
->backgroundPixel
;
99 val
.background
= physDev
->textPixel
;
103 val
.foreground
= physDev
->brush
.pixel
;
104 val
.background
= physDev
->backgroundPixel
;
106 if (fMapColors
&& X11DRV_PALETTE_XPixelToPalette
)
108 val
.foreground
= X11DRV_PALETTE_XPixelToPalette
[val
.foreground
];
109 val
.background
= X11DRV_PALETTE_XPixelToPalette
[val
.background
];
112 val
.function
= X11DRV_XROPfunction
[GetROP2(physDev
->hdc
)-1];
114 ** Let's replace GXinvert by GXxor with (black xor white)
115 ** This solves the selection color and leak problems in excel
116 ** FIXME : Let's do that only if we work with X-pixels, not with Win-pixels
118 if (val
.function
== GXinvert
)
120 val
.foreground
= (WhitePixel( gdi_display
, DefaultScreen(gdi_display
) ) ^
121 BlackPixel( gdi_display
, DefaultScreen(gdi_display
) ));
122 val
.function
= GXxor
;
124 val
.fill_style
= physDev
->brush
.fillStyle
;
125 switch(val
.fill_style
)
128 case FillOpaqueStippled
:
129 if (GetBkMode(physDev
->hdc
)==OPAQUE
) val
.fill_style
= FillOpaqueStippled
;
130 val
.stipple
= physDev
->brush
.pixmap
;
135 if (fMapColors
&& X11DRV_PALETTE_XPixelToPalette
)
140 pixmap
= XCreatePixmap( gdi_display
, root_window
, 8, 8, screen_depth
);
141 image
= XGetImage( gdi_display
, physDev
->brush
.pixmap
, 0, 0, 8, 8,
142 AllPlanes
, ZPixmap
);
143 for (y
= 0; y
< 8; y
++)
144 for (x
= 0; x
< 8; x
++)
145 XPutPixel( image
, x
, y
,
146 X11DRV_PALETTE_XPixelToPalette
[XGetPixel( image
, x
, y
)] );
147 XPutImage( gdi_display
, pixmap
, gc
, image
, 0, 0, 0, 0, 8, 8 );
148 XDestroyImage( image
);
152 else val
.tile
= physDev
->brush
.pixmap
;
160 GetBrushOrgEx( physDev
->hdc
, &pt
);
161 val
.ts_x_origin
= physDev
->org
.x
+ pt
.x
;
162 val
.ts_y_origin
= physDev
->org
.y
+ pt
.y
;
163 val
.fill_rule
= (GetPolyFillMode(physDev
->hdc
) == WINDING
) ? WindingRule
: EvenOddRule
;
165 XChangeGC( gdi_display
, gc
,
166 GCFunction
| GCForeground
| GCBackground
| GCFillStyle
|
167 GCFillRule
| GCTileStipXOrigin
| GCTileStipYOrigin
| mask
,
169 if (pixmap
) XFreePixmap( gdi_display
, pixmap
);
175 /***********************************************************************
176 * X11DRV_SetupGCForBrush
178 * Setup physDev->gc for drawing operations using current brush.
179 * Return FALSE if brush is BS_NULL, TRUE otherwise.
181 BOOL
X11DRV_SetupGCForBrush( X11DRV_PDEVICE
*physDev
)
183 return X11DRV_SetupGCForPatBlt( physDev
, physDev
->gc
, FALSE
);
187 /***********************************************************************
188 * X11DRV_SetupGCForPen
190 * Setup physDev->gc for drawing operations using current pen.
191 * Return FALSE if pen is PS_NULL, TRUE otherwise.
193 BOOL
X11DRV_SetupGCForPen( X11DRV_PDEVICE
*physDev
)
196 UINT rop2
= GetROP2(physDev
->hdc
);
198 if (physDev
->pen
.style
== PS_NULL
) return FALSE
;
203 val
.foreground
= BlackPixel( gdi_display
, DefaultScreen(gdi_display
) );
204 val
.function
= GXcopy
;
207 val
.foreground
= WhitePixel( gdi_display
, DefaultScreen(gdi_display
) );
208 val
.function
= GXcopy
;
211 val
.foreground
= physDev
->pen
.pixel
;
212 /* It is very unlikely someone wants to XOR with 0 */
213 /* This fixes the rubber-drawings in paintbrush */
214 if (val
.foreground
== 0)
215 val
.foreground
= (WhitePixel( gdi_display
, DefaultScreen(gdi_display
) ) ^
216 BlackPixel( gdi_display
, DefaultScreen(gdi_display
) ));
217 val
.function
= GXxor
;
220 val
.foreground
= physDev
->pen
.pixel
;
221 val
.function
= X11DRV_XROPfunction
[rop2
-1];
223 val
.background
= physDev
->backgroundPixel
;
224 val
.fill_style
= FillSolid
;
225 if ((physDev
->pen
.width
<= 1) &&
226 (physDev
->pen
.style
!= PS_SOLID
) &&
227 (physDev
->pen
.style
!= PS_INSIDEFRAME
))
229 TSXSetDashes( gdi_display
, physDev
->gc
, 0, physDev
->pen
.dashes
, physDev
->pen
.dash_len
);
230 val
.line_style
= (GetBkMode(physDev
->hdc
) == OPAQUE
) ? LineDoubleDash
: LineOnOffDash
;
232 else val
.line_style
= LineSolid
;
233 val
.line_width
= physDev
->pen
.width
;
234 if (val
.line_width
<= 1) {
235 val
.cap_style
= CapNotLast
;
237 switch (physDev
->pen
.endcap
)
239 case PS_ENDCAP_SQUARE
:
240 val
.cap_style
= CapProjecting
;
243 val
.cap_style
= CapButt
;
245 case PS_ENDCAP_ROUND
:
247 val
.cap_style
= CapRound
;
250 switch (physDev
->pen
.linejoin
)
253 val
.join_style
= JoinBevel
;
256 val
.join_style
= JoinMiter
;
260 val
.join_style
= JoinRound
;
262 TSXChangeGC( gdi_display
, physDev
->gc
,
263 GCFunction
| GCForeground
| GCBackground
| GCLineWidth
|
264 GCLineStyle
| GCCapStyle
| GCJoinStyle
| GCFillStyle
, &val
);
269 /***********************************************************************
270 * X11DRV_SetupGCForText
272 * Setup physDev->gc for text drawing operations.
273 * Return FALSE if the font is null, TRUE otherwise.
275 BOOL
X11DRV_SetupGCForText( X11DRV_PDEVICE
*physDev
)
277 XFontStruct
* xfs
= XFONT_GetFontStruct( physDev
->font
);
283 val
.function
= GXcopy
; /* Text is always GXcopy */
284 val
.foreground
= physDev
->textPixel
;
285 val
.background
= physDev
->backgroundPixel
;
286 val
.fill_style
= FillSolid
;
289 TSXChangeGC( gdi_display
, physDev
->gc
,
290 GCFunction
| GCForeground
| GCBackground
| GCFillStyle
|
294 WARN("Physical font failure\n" );
298 /***********************************************************************
302 X11DRV_LineTo( X11DRV_PDEVICE
*physDev
, INT x
, INT y
)
306 if (X11DRV_SetupGCForPen( physDev
)) {
307 /* Update the pixmap from the DIB section */
308 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
310 GetCurrentPositionEx( physDev
->hdc
, &pt
[0] );
313 LPtoDP( physDev
->hdc
, pt
, 2 );
315 TSXDrawLine(gdi_display
, physDev
->drawable
, physDev
->gc
,
316 physDev
->org
.x
+ pt
[0].x
, physDev
->org
.y
+ pt
[0].y
,
317 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
;
340 INT width
, oldwidth
, oldendcap
;
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 oldendcap
= physDev
->pen
.endcap
;
366 if (!width
) width
= 1;
367 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
369 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
371 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
372 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
373 rc
.left
+= width
/ 2;
374 rc
.right
-= (width
- 1) / 2;
376 rc
.bottom
-= (width
- 1) / 2;
378 if(width
== 0) width
= 1; /* more accurate */
379 physDev
->pen
.width
= width
;
380 physDev
->pen
.endcap
= PS_ENDCAP_SQUARE
;
382 xcenter
= (rc
.right
+ rc
.left
) / 2;
383 ycenter
= (rc
.bottom
+ rc
.top
) / 2;
384 start_angle
= atan2( (double)(ycenter
-start
.y
)*(rc
.right
-rc
.left
),
385 (double)(start
.x
-xcenter
)*(rc
.bottom
-rc
.top
) );
386 end_angle
= atan2( (double)(ycenter
-end
.y
)*(rc
.right
-rc
.left
),
387 (double)(end
.x
-xcenter
)*(rc
.bottom
-rc
.top
) );
388 if ((start
.x
==end
.x
)&&(start
.y
==end
.y
))
389 { /* A lazy program delivers xstart=xend=ystart=yend=0) */
393 else /* notorious cases */
394 if ((start_angle
== PI
)&&( end_angle
<0))
397 if ((end_angle
== PI
)&&( start_angle
<0))
399 istart_angle
= (INT
)(start_angle
* 180 * 64 / PI
+ 0.5);
400 idiff_angle
= (INT
)((end_angle
- start_angle
) * 180 * 64 / PI
+ 0.5);
401 if (idiff_angle
<= 0) idiff_angle
+= 360 * 64;
403 /* Update the pixmap from the DIB section */
404 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
406 /* Fill arc with brush if Chord() or Pie() */
408 if ((lines
> 0) && X11DRV_SetupGCForBrush( physDev
)) {
409 TSXSetArcMode( gdi_display
, physDev
->gc
, (lines
==1) ? ArcChord
: ArcPieSlice
);
410 TSXFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
411 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
412 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, istart_angle
, idiff_angle
);
416 /* Draw arc and lines */
418 if (X11DRV_SetupGCForPen( physDev
)){
419 TSXDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
420 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
421 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, istart_angle
, idiff_angle
);
423 /* use the truncated values */
424 start_angle
=(double)istart_angle
*PI
/64./180.;
425 end_angle
=(double)(istart_angle
+idiff_angle
)*PI
/64./180.;
426 /* calculate the endpoints and round correctly */
427 points
[0].x
= (int) floor(physDev
->org
.x
+ (rc
.right
+rc
.left
)/2.0 +
428 cos(start_angle
) * (rc
.right
-rc
.left
-width
*2+2) / 2. + 0.5);
429 points
[0].y
= (int) floor(physDev
->org
.y
+ (rc
.top
+rc
.bottom
)/2.0 -
430 sin(start_angle
) * (rc
.bottom
-rc
.top
-width
*2+2) / 2. + 0.5);
431 points
[1].x
= (int) floor(physDev
->org
.x
+ (rc
.right
+rc
.left
)/2.0 +
432 cos(end_angle
) * (rc
.right
-rc
.left
-width
*2+2) / 2. + 0.5);
433 points
[1].y
= (int) floor(physDev
->org
.y
+ (rc
.top
+rc
.bottom
)/2.0 -
434 sin(end_angle
) * (rc
.bottom
-rc
.top
-width
*2+2) / 2. + 0.5);
436 /* OK, this stuff is optimized for Xfree86
437 * which is probably the server most used by
438 * wine users. Other X servers will not
439 * display correctly. (eXceed for instance)
440 * so if you feel you must make changes, make sure that
441 * you either use Xfree86 or separate your changes
442 * from these (compile switch or whatever)
446 points
[3] = points
[1];
447 points
[1].x
= physDev
->org
.x
+ xcenter
;
448 points
[1].y
= physDev
->org
.y
+ ycenter
;
449 points
[2] = points
[1];
450 dx1
=points
[1].x
-points
[0].x
;
451 dy1
=points
[1].y
-points
[0].y
;
452 if(((rc
.top
-rc
.bottom
) | -2) == -2)
453 if(dy1
>0) points
[1].y
--;
455 if (((-dx1
)*64)<=ABS(dy1
)*37) points
[0].x
--;
456 if(((-dx1
*9))<(dy1
*16)) points
[0].y
--;
457 if( dy1
<0 && ((dx1
*9)) < (dy1
*16)) points
[0].y
--;
459 if(dy1
< 0) points
[0].y
--;
460 if(((rc
.right
-rc
.left
) | -2) == -2) points
[1].x
--;
462 dx1
=points
[3].x
-points
[2].x
;
463 dy1
=points
[3].y
-points
[2].y
;
464 if(((rc
.top
-rc
.bottom
) | -2 ) == -2)
465 if(dy1
< 0) points
[2].y
--;
467 if( dy1
>0) points
[3].y
--;
468 if(((rc
.right
-rc
.left
) | -2) == -2 ) points
[2].x
--;
471 if( dx1
* 64 < dy1
* -37 ) points
[3].x
--;
475 TSXDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
476 points
, lines
+1, CoordModeOrigin
);
481 /* Update the DIBSection of the pixmap */
482 X11DRV_UnlockDIBSection(physDev
, update
);
484 physDev
->pen
.width
= oldwidth
;
485 physDev
->pen
.endcap
= oldendcap
;
490 /***********************************************************************
494 X11DRV_Arc( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
495 INT xstart
, INT ystart
, INT xend
, INT yend
)
497 return X11DRV_DrawArc( physDev
, left
, top
, right
, bottom
,
498 xstart
, ystart
, xend
, yend
, 0 );
502 /***********************************************************************
506 X11DRV_Pie( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
507 INT xstart
, INT ystart
, INT xend
, INT yend
)
509 return X11DRV_DrawArc( physDev
, left
, top
, right
, bottom
,
510 xstart
, ystart
, xend
, yend
, 2 );
513 /***********************************************************************
517 X11DRV_Chord( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
,
518 INT xstart
, INT ystart
, INT xend
, INT yend
)
520 return X11DRV_DrawArc( physDev
, left
, top
, right
, bottom
,
521 xstart
, ystart
, xend
, yend
, 1 );
525 /***********************************************************************
529 X11DRV_Ellipse( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
)
535 SetRect(&rc
, left
, top
, right
, bottom
);
536 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
538 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
)) return TRUE
;
540 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
541 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
543 oldwidth
= width
= physDev
->pen
.width
;
544 if (!width
) width
= 1;
545 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
547 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
549 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
550 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
551 rc
.left
+= width
/ 2;
552 rc
.right
-= (width
- 1) / 2;
554 rc
.bottom
-= (width
- 1) / 2;
556 if(width
== 0) width
= 1; /* more accurate */
557 physDev
->pen
.width
= width
;
559 /* Update the pixmap from the DIB section */
560 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
562 if (X11DRV_SetupGCForBrush( physDev
))
564 TSXFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
565 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
566 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, 0, 360*64 );
569 if (X11DRV_SetupGCForPen( physDev
))
571 TSXDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
572 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
573 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1, 0, 360*64 );
577 /* Update the DIBSection from the pixmap */
578 X11DRV_UnlockDIBSection(physDev
, update
);
580 physDev
->pen
.width
= oldwidth
;
585 /***********************************************************************
589 X11DRV_Rectangle(X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
, INT bottom
)
591 INT width
, oldwidth
, oldjoinstyle
;
595 TRACE("(%d %d %d %d)\n", left
, top
, right
, bottom
);
597 SetRect(&rc
, left
, top
, right
, bottom
);
598 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
600 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
)) return TRUE
;
602 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
603 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
605 oldwidth
= width
= physDev
->pen
.width
;
606 if (!width
) width
= 1;
607 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
609 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
611 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
612 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
613 rc
.left
+= width
/ 2;
614 rc
.right
-= (width
- 1) / 2;
616 rc
.bottom
-= (width
- 1) / 2;
618 if(width
== 1) width
= 0;
619 physDev
->pen
.width
= width
;
620 oldjoinstyle
= physDev
->pen
.linejoin
;
621 if(physDev
->pen
.type
!= PS_GEOMETRIC
)
622 physDev
->pen
.linejoin
= PS_JOIN_MITER
;
624 /* Update the pixmap from the DIB section */
625 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
627 if ((rc
.right
> rc
.left
+ width
) && (rc
.bottom
> rc
.top
+ width
))
629 if (X11DRV_SetupGCForBrush( physDev
))
631 TSXFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
632 physDev
->org
.x
+ rc
.left
+ (width
+ 1) / 2,
633 physDev
->org
.y
+ rc
.top
+ (width
+ 1) / 2,
634 rc
.right
-rc
.left
-width
-1, rc
.bottom
-rc
.top
-width
-1);
638 if (X11DRV_SetupGCForPen( physDev
))
640 TSXDrawRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
641 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
642 rc
.right
-rc
.left
-1, rc
.bottom
-rc
.top
-1 );
646 /* Update the DIBSection from the pixmap */
647 X11DRV_UnlockDIBSection(physDev
, update
);
649 physDev
->pen
.width
= oldwidth
;
650 physDev
->pen
.linejoin
= oldjoinstyle
;
654 /***********************************************************************
658 X11DRV_RoundRect( X11DRV_PDEVICE
*physDev
, INT left
, INT top
, INT right
,
659 INT bottom
, INT ell_width
, INT ell_height
)
661 INT width
, oldwidth
, oldendcap
;
666 TRACE("(%d %d %d %d %d %d\n",
667 left
, top
, right
, bottom
, ell_width
, ell_height
);
669 SetRect(&rc
, left
, top
, right
, bottom
);
670 LPtoDP(physDev
->hdc
, (POINT
*)&rc
, 2);
672 if ((rc
.left
== rc
.right
) || (rc
.top
== rc
.bottom
))
675 /* Make sure ell_width and ell_height are >= 1 otherwise XDrawArc gets
676 called with width/height < 0 */
677 pts
[0].x
= pts
[0].y
= 0;
678 pts
[1].x
= ell_width
;
679 pts
[1].y
= ell_height
;
680 LPtoDP(physDev
->hdc
, pts
, 2);
681 ell_width
= max(abs( pts
[1].x
- pts
[0].x
), 1);
682 ell_height
= max(abs( pts
[1].y
- pts
[0].y
), 1);
684 /* Fix the coordinates */
686 if (rc
.right
< rc
.left
) { INT tmp
= rc
.right
; rc
.right
= rc
.left
; rc
.left
= tmp
; }
687 if (rc
.bottom
< rc
.top
) { INT tmp
= rc
.bottom
; rc
.bottom
= rc
.top
; rc
.top
= tmp
; }
689 oldwidth
= width
= physDev
->pen
.width
;
690 oldendcap
= physDev
->pen
.endcap
;
691 if (!width
) width
= 1;
692 if(physDev
->pen
.style
== PS_NULL
) width
= 0;
694 if ((physDev
->pen
.style
== PS_INSIDEFRAME
))
696 if (2*width
> (rc
.right
-rc
.left
)) width
=(rc
.right
-rc
.left
+ 1)/2;
697 if (2*width
> (rc
.bottom
-rc
.top
)) width
=(rc
.bottom
-rc
.top
+ 1)/2;
698 rc
.left
+= width
/ 2;
699 rc
.right
-= (width
- 1) / 2;
701 rc
.bottom
-= (width
- 1) / 2;
703 if(width
== 0) width
= 1;
704 physDev
->pen
.width
= width
;
705 physDev
->pen
.endcap
= PS_ENDCAP_SQUARE
;
707 /* Update the pixmap from the DIB section */
708 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
711 if (X11DRV_SetupGCForBrush( physDev
))
713 if (ell_width
> (rc
.right
-rc
.left
) )
714 if (ell_height
> (rc
.bottom
-rc
.top
) )
715 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
716 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
717 rc
.right
- rc
.left
- 1, rc
.bottom
- rc
.top
- 1,
720 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
721 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
722 rc
.right
- rc
.left
- 1, ell_height
, 0, 180 * 64 );
723 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
724 physDev
->org
.x
+ rc
.left
,
725 physDev
->org
.y
+ rc
.bottom
- ell_height
- 1,
726 rc
.right
- rc
.left
- 1, ell_height
, 180 * 64,
729 else if (ell_height
> (rc
.bottom
-rc
.top
) ){
730 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
731 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
732 ell_width
, rc
.bottom
- rc
.top
- 1, 90 * 64, 180 * 64 );
733 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
734 physDev
->org
.x
+ rc
.right
- ell_width
- 1, physDev
->org
.y
+ rc
.top
,
735 ell_width
, rc
.bottom
- rc
.top
- 1, 270 * 64, 180 * 64 );
737 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
738 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
739 ell_width
, ell_height
, 90 * 64, 90 * 64 );
740 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
741 physDev
->org
.x
+ rc
.left
,
742 physDev
->org
.y
+ rc
.bottom
- ell_height
- 1,
743 ell_width
, ell_height
, 180 * 64, 90 * 64 );
744 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
745 physDev
->org
.x
+ rc
.right
- ell_width
- 1,
746 physDev
->org
.y
+ rc
.bottom
- ell_height
- 1,
747 ell_width
, ell_height
, 270 * 64, 90 * 64 );
748 XFillArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
749 physDev
->org
.x
+ rc
.right
- ell_width
- 1,
750 physDev
->org
.y
+ rc
.top
,
751 ell_width
, ell_height
, 0, 90 * 64 );
753 if (ell_width
< rc
.right
- rc
.left
)
755 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
756 physDev
->org
.x
+ rc
.left
+ (ell_width
+ 1) / 2,
757 physDev
->org
.y
+ rc
.top
+ 1,
758 rc
.right
- rc
.left
- ell_width
- 1,
759 (ell_height
+ 1) / 2 - 1);
760 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
761 physDev
->org
.x
+ rc
.left
+ (ell_width
+ 1) / 2,
762 physDev
->org
.y
+ rc
.bottom
- (ell_height
) / 2 - 1,
763 rc
.right
- rc
.left
- ell_width
- 1,
766 if (ell_height
< rc
.bottom
- rc
.top
)
768 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
769 physDev
->org
.x
+ rc
.left
+ 1,
770 physDev
->org
.y
+ rc
.top
+ (ell_height
+ 1) / 2,
771 rc
.right
- rc
.left
- 2,
772 rc
.bottom
- rc
.top
- ell_height
- 1);
776 /* FIXME: this could be done with on X call
777 * more efficient and probably more correct
778 * on any X server: XDrawArcs will draw
779 * straight horizontal and vertical lines
780 * if width or height are zero.
782 * BTW this stuff is optimized for an Xfree86 server
783 * read the comments inside the X11DRV_DrawArc function
785 if (X11DRV_SetupGCForPen( physDev
))
787 if (ell_width
> (rc
.right
-rc
.left
) )
788 if (ell_height
> (rc
.bottom
-rc
.top
) )
789 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
790 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
791 rc
.right
- rc
.left
- 1, rc
.bottom
- rc
.top
- 1, 0 , 360 * 64 );
793 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
794 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
795 rc
.right
- rc
.left
- 1, ell_height
- 1, 0 , 180 * 64 );
796 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
797 physDev
->org
.x
+ rc
.left
,
798 physDev
->org
.y
+ rc
.bottom
- ell_height
,
799 rc
.right
- rc
.left
- 1, ell_height
- 1, 180 * 64 , 180 * 64 );
801 else if (ell_height
> (rc
.bottom
-rc
.top
) ){
802 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
803 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
804 ell_width
- 1 , rc
.bottom
- rc
.top
- 1, 90 * 64 , 180 * 64 );
805 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
806 physDev
->org
.x
+ rc
.right
- ell_width
,
807 physDev
->org
.y
+ rc
.top
,
808 ell_width
- 1 , rc
.bottom
- rc
.top
- 1, 270 * 64 , 180 * 64 );
810 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
811 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.top
,
812 ell_width
- 1, ell_height
- 1, 90 * 64, 90 * 64 );
813 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
814 physDev
->org
.x
+ rc
.left
, physDev
->org
.y
+ rc
.bottom
- ell_height
,
815 ell_width
- 1, ell_height
- 1, 180 * 64, 90 * 64 );
816 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
817 physDev
->org
.x
+ rc
.right
- ell_width
,
818 physDev
->org
.y
+ rc
.bottom
- ell_height
,
819 ell_width
- 1, ell_height
- 1, 270 * 64, 90 * 64 );
820 XDrawArc( gdi_display
, physDev
->drawable
, physDev
->gc
,
821 physDev
->org
.x
+ rc
.right
- ell_width
, physDev
->org
.y
+ rc
.top
,
822 ell_width
- 1, ell_height
- 1, 0, 90 * 64 );
824 if (ell_width
< rc
.right
- rc
.left
)
826 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
827 physDev
->org
.x
+ rc
.left
+ ell_width
/ 2,
828 physDev
->org
.y
+ rc
.top
,
829 physDev
->org
.x
+ rc
.right
- (ell_width
+1) / 2,
830 physDev
->org
.y
+ rc
.top
);
831 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
832 physDev
->org
.x
+ rc
.left
+ ell_width
/ 2 ,
833 physDev
->org
.y
+ rc
.bottom
- 1,
834 physDev
->org
.x
+ rc
.right
- (ell_width
+1)/ 2,
835 physDev
->org
.y
+ rc
.bottom
- 1);
837 if (ell_height
< rc
.bottom
- rc
.top
)
839 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
840 physDev
->org
.x
+ rc
.right
- 1,
841 physDev
->org
.y
+ rc
.top
+ ell_height
/ 2,
842 physDev
->org
.x
+ rc
.right
- 1,
843 physDev
->org
.y
+ rc
.bottom
- (ell_height
+1) / 2);
844 XDrawLine( gdi_display
, physDev
->drawable
, physDev
->gc
,
845 physDev
->org
.x
+ rc
.left
,
846 physDev
->org
.y
+ rc
.top
+ ell_height
/ 2,
847 physDev
->org
.x
+ rc
.left
,
848 physDev
->org
.y
+ rc
.bottom
- (ell_height
+1) / 2);
853 /* Update the DIBSection from the pixmap */
854 X11DRV_UnlockDIBSection(physDev
, update
);
856 physDev
->pen
.width
= oldwidth
;
857 physDev
->pen
.endcap
= oldendcap
;
862 /***********************************************************************
866 X11DRV_SetPixel( X11DRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
)
873 LPtoDP( physDev
->hdc
, &pt
, 1 );
874 pixel
= X11DRV_PALETTE_ToPhysical( physDev
, color
);
876 /* Update the pixmap from the DIB section */
877 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
879 /* inefficient but simple... */
881 XSetForeground( gdi_display
, physDev
->gc
, pixel
);
882 XSetFunction( gdi_display
, physDev
->gc
, GXcopy
);
883 XDrawPoint( gdi_display
, physDev
->drawable
, physDev
->gc
,
884 physDev
->org
.x
+ pt
.x
, physDev
->org
.y
+ pt
.y
);
887 /* Update the DIBSection from the pixmap */
888 X11DRV_UnlockDIBSection(physDev
, TRUE
);
890 return X11DRV_PALETTE_ToLogical(pixel
);
894 /***********************************************************************
898 X11DRV_GetPixel( X11DRV_PDEVICE
*physDev
, INT x
, INT y
)
900 static Pixmap pixmap
= 0;
904 DC
*dc
= physDev
->dc
;
908 LPtoDP( physDev
->hdc
, &pt
, 1 );
910 /* Update the pixmap from the DIB section */
911 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
914 if (dc
->flags
& DC_MEMORY
)
916 image
= XGetImage( gdi_display
, physDev
->drawable
,
917 physDev
->org
.x
+ pt
.x
, physDev
->org
.y
+ pt
.y
,
918 1, 1, AllPlanes
, ZPixmap
);
922 /* If we are reading from the screen, use a temporary copy */
923 /* to avoid a BadMatch error */
924 if (!pixmap
) pixmap
= XCreatePixmap( gdi_display
, root_window
,
925 1, 1, dc
->bitsPerPixel
);
926 XCopyArea( gdi_display
, physDev
->drawable
, pixmap
, BITMAP_colorGC
,
927 physDev
->org
.x
+ pt
.x
, physDev
->org
.y
+ pt
.y
, 1, 1, 0, 0 );
928 image
= XGetImage( gdi_display
, pixmap
, 0, 0, 1, 1, AllPlanes
, ZPixmap
);
930 pixel
= XGetPixel( image
, 0, 0 );
931 XDestroyImage( image
);
934 /* Update the DIBSection from the pixmap */
935 X11DRV_UnlockDIBSection(physDev
, FALSE
);
937 return X11DRV_PALETTE_ToLogical(pixel
);
941 /***********************************************************************
945 X11DRV_PaintRgn( X11DRV_PDEVICE
*physDev
, HRGN hrgn
)
947 if (X11DRV_SetupGCForBrush( physDev
))
951 RGNDATA
*data
= X11DRV_GetRegionData( hrgn
, physDev
->hdc
);
953 if (!data
) return FALSE
;
954 rect
= (XRectangle
*)data
->Buffer
;
955 for (i
= 0; i
< data
->rdh
.nCount
; i
++)
957 rect
[i
].x
+= physDev
->org
.x
;
958 rect
[i
].y
+= physDev
->org
.y
;
961 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
963 XFillRectangles( gdi_display
, physDev
->drawable
, physDev
->gc
, rect
, data
->rdh
.nCount
);
965 X11DRV_UnlockDIBSection(physDev
, TRUE
);
966 HeapFree( GetProcessHeap(), 0, data
);
971 /**********************************************************************
975 X11DRV_Polyline( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
)
981 if((oldwidth
= physDev
->pen
.width
) == 0) physDev
->pen
.width
= 1;
983 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * count
)))
985 WARN("No memory to convert POINTs to XPoints!\n");
988 for (i
= 0; i
< count
; i
++)
991 LPtoDP(physDev
->hdc
, &tmp
, 1);
992 points
[i
].x
= physDev
->org
.x
+ tmp
.x
;
993 points
[i
].y
= physDev
->org
.y
+ tmp
.y
;
996 if (X11DRV_SetupGCForPen ( physDev
))
998 /* Update the pixmap from the DIB section */
999 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1001 TSXDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1002 points
, count
, CoordModeOrigin
);
1004 /* Update the DIBSection from the pixmap */
1005 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1008 HeapFree( GetProcessHeap(), 0, points
);
1009 physDev
->pen
.width
= oldwidth
;
1014 /**********************************************************************
1018 X11DRV_Polygon( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, INT count
)
1022 BOOL update
= FALSE
;
1024 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * (count
+1) )))
1026 WARN("No memory to convert POINTs to XPoints!\n");
1029 for (i
= 0; i
< count
; i
++)
1032 LPtoDP(physDev
->hdc
, &tmp
, 1);
1033 points
[i
].x
= physDev
->org
.x
+ tmp
.x
;
1034 points
[i
].y
= physDev
->org
.y
+ tmp
.y
;
1036 points
[count
] = points
[0];
1038 /* Update the pixmap from the DIB section */
1039 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1041 if (X11DRV_SetupGCForBrush( physDev
))
1043 TSXFillPolygon( gdi_display
, physDev
->drawable
, physDev
->gc
,
1044 points
, count
+1, Complex
, CoordModeOrigin
);
1047 if (X11DRV_SetupGCForPen ( physDev
))
1049 TSXDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1050 points
, count
+1, CoordModeOrigin
);
1054 /* Update the DIBSection from the pixmap */
1055 X11DRV_UnlockDIBSection(physDev
, update
);
1057 HeapFree( GetProcessHeap(), 0, points
);
1062 /**********************************************************************
1063 * X11DRV_PolyPolygon
1066 X11DRV_PolyPolygon( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, const INT
* counts
, UINT polygons
)
1070 /* FIXME: The points should be converted to device coords before */
1071 /* creating the region. */
1073 hrgn
= CreatePolyPolygonRgn( pt
, counts
, polygons
, GetPolyFillMode( physDev
->hdc
) );
1074 X11DRV_PaintRgn( physDev
, hrgn
);
1075 DeleteObject( hrgn
);
1077 /* Draw the outline of the polygons */
1079 if (X11DRV_SetupGCForPen ( physDev
))
1084 /* Update the pixmap from the DIB section */
1085 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1087 for (i
= 0; i
< polygons
; i
++) if (counts
[i
] > max
) max
= counts
[i
];
1088 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * (max
+1) )))
1090 WARN("No memory to convert POINTs to XPoints!\n");
1093 for (i
= 0; i
< polygons
; i
++)
1095 for (j
= 0; j
< counts
[i
]; j
++)
1098 LPtoDP(physDev
->hdc
, &tmp
, 1);
1099 points
[j
].x
= physDev
->org
.x
+ tmp
.x
;
1100 points
[j
].y
= physDev
->org
.y
+ tmp
.y
;
1103 points
[j
] = points
[0];
1104 TSXDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1105 points
, j
+ 1, CoordModeOrigin
);
1108 /* Update the DIBSection of the dc's bitmap */
1109 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1111 HeapFree( GetProcessHeap(), 0, points
);
1117 /**********************************************************************
1118 * X11DRV_PolyPolyline
1121 X11DRV_PolyPolyline( X11DRV_PDEVICE
*physDev
, const POINT
* pt
, const DWORD
* counts
, DWORD polylines
)
1123 if (X11DRV_SetupGCForPen ( physDev
))
1128 /* Update the pixmap from the DIB section */
1129 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1131 for (i
= 0; i
< polylines
; i
++) if (counts
[i
] > max
) max
= counts
[i
];
1132 if (!(points
= HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint
) * max
)))
1134 WARN("No memory to convert POINTs to XPoints!\n");
1137 for (i
= 0; i
< polylines
; i
++)
1139 for (j
= 0; j
< counts
[i
]; j
++)
1142 LPtoDP(physDev
->hdc
, &tmp
, 1);
1143 points
[j
].x
= physDev
->org
.x
+ tmp
.x
;
1144 points
[j
].y
= physDev
->org
.y
+ tmp
.y
;
1147 TSXDrawLines( gdi_display
, physDev
->drawable
, physDev
->gc
,
1148 points
, j
, CoordModeOrigin
);
1151 /* Update the DIBSection of the dc's bitmap */
1152 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1154 HeapFree( GetProcessHeap(), 0, points
);
1160 /**********************************************************************
1161 * X11DRV_InternalFloodFill
1163 * Internal helper function for flood fill.
1164 * (xorg,yorg) is the origin of the X image relative to the drawable.
1165 * (x,y) is relative to the origin of the X image.
1167 static void X11DRV_InternalFloodFill(XImage
*image
, X11DRV_PDEVICE
*physDev
,
1170 Pixel pixel
, WORD fillType
)
1174 #define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \
1175 (XGetPixel(image,x,y) != pixel) : \
1176 (XGetPixel(image,x,y) == pixel))
1178 if (!TO_FLOOD(x
,y
)) return;
1180 /* Find left and right boundaries */
1183 while ((left
> 0) && TO_FLOOD( left
-1, y
)) left
--;
1184 while ((right
< image
->width
) && TO_FLOOD( right
, y
)) right
++;
1185 XFillRectangle( gdi_display
, physDev
->drawable
, physDev
->gc
,
1186 xOrg
+ left
, yOrg
+ y
, right
-left
, 1 );
1188 /* Set the pixels of this line so we don't fill it again */
1190 for (x
= left
; x
< right
; x
++)
1192 if (fillType
== FLOODFILLBORDER
) XPutPixel( image
, x
, y
, pixel
);
1193 else XPutPixel( image
, x
, y
, ~pixel
);
1196 /* Fill the line above */
1203 while ((x
< right
) && !TO_FLOOD(x
,y
)) x
++;
1204 if (x
>= right
) break;
1205 while ((x
< right
) && TO_FLOOD(x
,y
)) x
++;
1206 X11DRV_InternalFloodFill(image
, physDev
, x
-1, y
,
1207 xOrg
, yOrg
, pixel
, fillType
);
1211 /* Fill the line below */
1213 if ((y
+= 2) < image
->height
)
1218 while ((x
< right
) && !TO_FLOOD(x
,y
)) x
++;
1219 if (x
>= right
) break;
1220 while ((x
< right
) && TO_FLOOD(x
,y
)) x
++;
1221 X11DRV_InternalFloodFill(image
, physDev
, x
-1, y
,
1222 xOrg
, yOrg
, pixel
, fillType
);
1229 /**********************************************************************
1230 * X11DRV_ExtFloodFill
1233 X11DRV_ExtFloodFill( X11DRV_PDEVICE
*physDev
, INT x
, INT y
, COLORREF color
,
1238 DC
*dc
= physDev
->dc
;
1240 TRACE("X11DRV_ExtFloodFill %d,%d %06lx %d\n", x
, y
, color
, fillType
);
1242 if (!PtVisible( physDev
->hdc
, x
, y
)) return FALSE
;
1243 if (GetRgnBox( dc
->hGCClipRgn
, &rect
) == ERROR
) return FALSE
;
1245 if (!(image
= TSXGetImage( gdi_display
, physDev
->drawable
,
1246 physDev
->org
.x
+ rect
.left
,
1247 physDev
->org
.y
+ rect
.top
,
1248 rect
.right
- rect
.left
,
1249 rect
.bottom
- rect
.top
,
1250 AllPlanes
, ZPixmap
))) return FALSE
;
1252 if (X11DRV_SetupGCForBrush( physDev
))
1257 LPtoDP(physDev
->hdc
, &pt
, 1);
1258 /* Update the pixmap from the DIB section */
1259 X11DRV_LockDIBSection(physDev
, DIB_Status_GdiMod
, FALSE
);
1261 /* ROP mode is always GXcopy for flood-fill */
1263 XSetFunction( gdi_display
, physDev
->gc
, GXcopy
);
1264 X11DRV_InternalFloodFill(image
, physDev
,
1265 physDev
->org
.x
+ pt
.x
- rect
.left
,
1266 physDev
->org
.y
+ pt
.y
- rect
.top
,
1267 rect
.left
, rect
.top
,
1268 X11DRV_PALETTE_ToPhysical( physDev
, color
),
1270 wine_tsx11_unlock();
1271 /* Update the DIBSection of the dc's bitmap */
1272 X11DRV_UnlockDIBSection(physDev
, TRUE
);
1276 XDestroyImage( image
);
1277 wine_tsx11_unlock();
1281 /**********************************************************************
1285 X11DRV_SetBkColor( X11DRV_PDEVICE
*physDev
, COLORREF color
)
1287 physDev
->backgroundPixel
= X11DRV_PALETTE_ToPhysical( physDev
, color
);
1291 /**********************************************************************
1292 * X11DRV_SetTextColor
1295 X11DRV_SetTextColor( X11DRV_PDEVICE
*physDev
, COLORREF color
)
1297 physDev
->textPixel
= X11DRV_PALETTE_ToPhysical( physDev
, color
);
1301 /***********************************************************************
1302 * GetDCOrgEx (X11DRV.@)
1304 BOOL
X11DRV_GetDCOrgEx( X11DRV_PDEVICE
*physDev
, LPPOINT lpp
)
1306 lpp
->x
= physDev
->org
.x
+ physDev
->drawable_org
.x
;
1307 lpp
->y
= physDev
->org
.y
+ physDev
->drawable_org
.y
;
1312 /***********************************************************************
1313 * SetDCOrg (X11DRV.@)
1315 DWORD
X11DRV_SetDCOrg( X11DRV_PDEVICE
*physDev
, INT x
, INT y
)
1317 DWORD ret
= MAKELONG( physDev
->org
.x
+ physDev
->drawable_org
.x
,
1318 physDev
->org
.y
+ physDev
->drawable_org
.y
);
1319 physDev
->org
.x
= x
- physDev
->drawable_org
.x
;
1320 physDev
->org
.y
= y
- physDev
->drawable_org
.y
;