aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32font.c
diff options
context:
space:
mode:
authorJason Rumney <[email protected]>2007-09-13 13:37:26 +0000
committerJason Rumney <[email protected]>2007-09-13 13:37:26 +0000
commit5c2c9c79dc64e2a2074b1fe7690525e3a832fa1e (patch)
tree87c7b918ef9c714a6c87965414413dfb779f71eb /src/w32font.c
parent87128fd9279e72697e1f6112f733f1e668f3c94b (diff)
(w32font_draw): Do clipping here.
Diffstat (limited to 'src/w32font.c')
-rw-r--r--src/w32font.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/w32font.c b/src/w32font.c
index f1c2677f96..061b253230 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -492,9 +492,32 @@ w32font_draw (s, from, to, x, y, with_background)
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 @@ w32font_draw (s, from, to, x, y, with_background)
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.