Mercurial > emacs
changeset 91030:8be09e8e2c97
(w32font_draw): Do clipping here.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Thu, 13 Sep 2007 13:37:26 +0000 |
parents | 532c5466a06d |
children | 524f82fbf3ef |
files | src/w32font.c |
diffstat | 1 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/w32font.c Thu Sep 13 13:36:54 2007 +0000 +++ b/src/w32font.c Thu Sep 13 13:37:26 2007 +0000 @@ -492,9 +492,32 @@ int from, to, x, y, with_background; { UINT options = 0; + HRGN orig_clip; + + /* Save clip region for later restoration. */ + GetClipRgn(s->hdc, orig_clip); + + if (s->num_clips > 0) + { + HRGN new_clip = CreateRectRgnIndirect (s->clip); + + if (s->num_clips > 1) + { + HRGN clip2 = CreateRectRgnIndirect (s->clip + 1); + + CombineRgn (new_clip, new_clip, clip2, RGN_OR); + DeleteObject (clip2); + } + + SelectClipRgn (s->hdc, new_clip); + DeleteObject (new_clip); + } if (with_background) { + SetBkColor (s->hdc, s->gc->background); + SetBkMode (s->hdc, OPAQUE); +#if 0 HBRUSH brush; RECT rect; @@ -505,11 +528,18 @@ rect.bottom = y + ((struct font *) (s->font_info->font))->descent; FillRect (s->hdc, &rect, brush); DeleteObject (brush); +#endif } else SetBkMode (s->hdc, TRANSPARENT); ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL); + + /* Restore clip region. */ + if (s->num_clips > 0) + { + SelectClipRgn (s->hdc, orig_clip); + } } /* w32 implementation of free_entity for font backend.