diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-16 14:42:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-16 14:42:49 (GMT) |
commit | 9f6d41c61faba304dce324aa4d5629db643f4191 (patch) | |
tree | 1aa1865c80a6604d88e2d65cf537440eb3518f7d /unix/tkUnixRFont.c | |
parent | 57e25a04aef40def9f523ec04b6fd04a60d2147b (diff) | |
parent | 8f22ecfac96ac10f3c1aa3df10a10071ed591d9b (diff) | |
download | tk-9f6d41c61faba304dce324aa4d5629db643f4191.zip tk-9f6d41c61faba304dce324aa4d5629db643f4191.tar.gz tk-9f6d41c61faba304dce324aa4d5629db643f4191.tar.bz2 |
merge trunk
Diffstat (limited to 'unix/tkUnixRFont.c')
-rw-r--r-- | unix/tkUnixRFont.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index bad52d9..4203ff9 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -35,6 +35,16 @@ typedef struct { XftDraw *ftDraw; XftColor color; } UnixFtFont; + +/* + * Used to describe the current clipping box. Can't be passed normally because + * the information isn't retrievable from the GC. + */ + +typedef struct ThreadSpecificData { + Region clipRegion; /* The clipping region, or None. */ +} ThreadSpecificData; +static Tcl_ThreadDataKey dataKey; /* * Package initialization: @@ -754,6 +764,8 @@ Tk_DrawChars( int clen, nspec, xStart = x; XftGlyphFontSpec specs[NUM_SPEC]; XGlyphInfo metrics; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (fontPtr->ftDraw == 0) { #if DEBUG_FONTSEL @@ -780,6 +792,9 @@ Tk_DrawChars( fontPtr->color.color.alpha = 0xffff; fontPtr->color.pixel = values.foreground; } + if (tsdPtr->clipRegion != None) { + XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); + } nspec = 0; while (numBytes > 0 && x <= maxCoord && y <= maxCoord) { XftFont *ftFont; @@ -819,6 +834,9 @@ Tk_DrawChars( } doUnderlineStrikeout: + if (tsdPtr->clipRegion != None) { + XftDrawSetClip(fontPtr->ftDraw, None); + } if (fontPtr->font.fa.underline != 0) { XFillRectangle(display, drawable, gc, xStart, y + fontPtr->font.underlinePos, (unsigned) (x - xStart), @@ -876,6 +894,8 @@ TkDrawAngledChars( XGCValues values; XColor xcolor; int xStart = x, yStart = y; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); #ifdef XFT_HAS_FIXED_ROTATED_PLACEMENT int clen, nglyph; FT_UInt glyphs[NUM_SPEC]; @@ -909,6 +929,9 @@ TkDrawAngledChars( fontPtr->color.color.alpha = 0xffff; fontPtr->color.pixel = values.foreground; } + if (tsdPtr->clipRegion != None) { + XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); + } nglyph = 0; currentFtFont = NULL; @@ -995,6 +1018,9 @@ TkDrawAngledChars( fontPtr->color.color.alpha = 0xffff; fontPtr->color.pixel = values.foreground; } + if (tsdPtr->clipRegion != None) { + XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); + } nspec = 0; while (numBytes > 0 && x <= maxCoord && x >= minCoord && y <= maxCoord && y >= minCoord) { @@ -1037,6 +1063,9 @@ TkDrawAngledChars( #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ doUnderlineStrikeout: + if (tsdPtr->clipRegion != None) { + XftDrawSetClip(fontPtr->ftDraw, None); + } if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) { XPoint points[5]; double width = (x - xStart) * cosA + (yStart - y) * sinA; @@ -1093,6 +1122,16 @@ TkDrawAngledChars( } } +void +TkUnixSetXftClipRegion( + TkRegion clipRegion) /* The clipping region to install. */ +{ + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + tsdPtr->clipRegion = (Region) clipRegion; +} + /* * Local Variables: * c-basic-offset: 4 |