aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-09-13 13:37:26 +0000
committerJason Rumney2007-09-13 13:37:26 +0000
commit5c2c9c79dc64e2a2074b1fe7690525e3a832fa1e (patch)
tree87c7b918ef9c714a6c87965414413dfb779f71eb /src
parent87128fd9279e72697e1f6112f733f1e668f3c94b (diff)
downloademacs-5c2c9c79dc64e2a2074b1fe7690525e3a832fa1e.tar.gz
emacs-5c2c9c79dc64e2a2074b1fe7690525e3a832fa1e.zip
(w32font_draw): Do clipping here.
Diffstat (limited to 'src')
-rw-r--r--src/w32font.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/w32font.c b/src/w32font.c
index f1c2677f96c..061b253230a 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -492,9 +492,32 @@ w32font_draw (s, from, to, x, y, with_background)
492 int from, to, x, y, with_background; 492 int from, to, x, y, with_background;
493{ 493{
494 UINT options = 0; 494 UINT options = 0;
495 HRGN orig_clip;
496
497 /* Save clip region for later restoration. */
498 GetClipRgn(s->hdc, orig_clip);
499
500 if (s->num_clips > 0)
501 {
502 HRGN new_clip = CreateRectRgnIndirect (s->clip);
503
504 if (s->num_clips > 1)
505 {
506 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1);
507
508 CombineRgn (new_clip, new_clip, clip2, RGN_OR);
509 DeleteObject (clip2);
510 }
511
512 SelectClipRgn (s->hdc, new_clip);
513 DeleteObject (new_clip);
514 }
495 515
496 if (with_background) 516 if (with_background)
497 { 517 {
518 SetBkColor (s->hdc, s->gc->background);
519 SetBkMode (s->hdc, OPAQUE);
520#if 0
498 HBRUSH brush; 521 HBRUSH brush;
499 RECT rect; 522 RECT rect;
500 523
@@ -505,11 +528,18 @@ w32font_draw (s, from, to, x, y, with_background)
505 rect.bottom = y + ((struct font *) (s->font_info->font))->descent; 528 rect.bottom = y + ((struct font *) (s->font_info->font))->descent;
506 FillRect (s->hdc, &rect, brush); 529 FillRect (s->hdc, &rect, brush);
507 DeleteObject (brush); 530 DeleteObject (brush);
531#endif
508 } 532 }
509 else 533 else
510 SetBkMode (s->hdc, TRANSPARENT); 534 SetBkMode (s->hdc, TRANSPARENT);
511 535
512 ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL); 536 ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL);
537
538 /* Restore clip region. */
539 if (s->num_clips > 0)
540 {
541 SelectClipRgn (s->hdc, orig_clip);
542 }
513} 543}
514 544
515/* w32 implementation of free_entity for font backend. 545/* w32 implementation of free_entity for font backend.