summaryrefslogtreecommitdiff
blob: 95c92cb1e1f3555f5d5d589a3c1f1cb51949aa57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
--- mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp.old	Mon May 20 18:23:23 2002
+++ mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp	Mon May 20 18:24:23 2002
@@ -3126,10 +3126,31 @@
 
     GdkRegion *rgn = nsnull;
     clipRegion->GetNativeRegion((void *&)rgn);
-    GdkRegionPrivate  *priv = (GdkRegionPrivate *)rgn;
 
-    XftDrawSetClip(draw, priv->xregion);
-  }
+// getting xregion for gdk2 so we can set the XftDrawSetClip region
+    GdkRectangle *rectangles = nsnull;
+    int         n_rect = 0;
+    int		i;
+    
+    gdk_region_get_rectangles (rgn, &rectangles, &n_rect);
+
+    Region     xregion = XCreateRegion();
+    
+    for (i=0; i<n_rect; i++) {
+	XRectangle 	xrect;
+
+	xrect.x            =       CLAMP (rectangles[i].x, G_MINSHORT, G_MAXSHORT);
+	xrect.y            =       CLAMP (rectangles[i].y, G_MINSHORT, G_MAXSHORT);
+	xrect.width        =       CLAMP (rectangles[i].width, G_MINSHORT, G_MAXSHORT);
+	xrect.height       =       CLAMP (rectangles[i].height, G_MINSHORT, G_MAXSHORT);
+      
+	XUnionRectWithRegion (&xrect, xregion, xregion);
+    }
+
+    XftDrawSetClip(draw, xregion);
+    XDestroyRegion (xregion);
+  
+   }
 
   XftDrawString16(draw, &color, mXftFont, aX, aY + mBaselineAdjust, 
                   (FcChar16 *)aString, aLength);
@@ -3169,9 +3190,30 @@
 
     GdkRegion *rgn = nsnull;
     clipRegion->GetNativeRegion((void *&)rgn);
-    GdkRegionPrivate  *priv = (GdkRegionPrivate *)rgn;
 
-    XftDrawSetClip(draw, priv->xregion);
+// getting xregion for gdk2 so we can set the XftDrawSetClip region
+    GdkRectangle *rectangles = nsnull;
+    int         n_rect = 0;
+    int		i;
+    
+    gdk_region_get_rectangles (rgn, &rectangles, &n_rect);
+
+    Region     xregion = XCreateRegion();
+    
+    for (i=0; i<n_rect; i++) {
+	XRectangle 	xrect;
+
+	xrect.x            =       CLAMP (rectangles[i].x, G_MINSHORT, G_MAXSHORT);
+	xrect.y            =       CLAMP (rectangles[i].y, G_MINSHORT, G_MAXSHORT);
+	xrect.width        =       CLAMP (rectangles[i].width, G_MINSHORT, G_MAXSHORT);
+	xrect.height       =       CLAMP (rectangles[i].height, G_MINSHORT, G_MAXSHORT);
+      
+	XUnionRectWithRegion (&xrect, xregion, xregion);
+    }
+
+    XftDrawSetClip(draw, xregion);
+    XDestroyRegion (xregion);
+    
   }
 
   XftDrawString8(draw, &color, mXftFont, aX, aY + mBaselineAdjust,