aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2008-12-04 15:21:53 +0000
committerJason Rumney2008-12-04 15:21:53 +0000
commitf70eb806e6098baa63c843d56372de9ea30e42f2 (patch)
tree0228d8f9c034cf54ea054e526de53c6f5954f2f1 /src
parent1cc54663d76a62215a9844dfdd2a09846a498942 (diff)
downloademacs-f70eb806e6098baa63c843d56372de9ea30e42f2.tar.gz
emacs-f70eb806e6098baa63c843d56372de9ea30e42f2.zip
(w32font_draw): Initialize orig_clip before getting it, and delete it
when finished.
Diffstat (limited to 'src')
-rw-r--r--src/w32font.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/w32font.c b/src/w32font.c
index c9494b4f29c..9609605306f 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -530,18 +530,23 @@ w32font_draw (s, from, to, x, y, with_background)
530 int from, to, x, y, with_background; 530 int from, to, x, y, with_background;
531{ 531{
532 UINT options; 532 UINT options;
533 HRGN orig_clip; 533 HRGN orig_clip = NULL;
534 struct w32font_info *w32font = (struct w32font_info *) s->font; 534 struct w32font_info *w32font = (struct w32font_info *) s->font;
535 535
536 options = w32font->glyph_idx; 536 options = w32font->glyph_idx;
537 537
538 /* Save clip region for later restoration. */
539 GetClipRgn(s->hdc, orig_clip);
540
541 if (s->num_clips > 0) 538 if (s->num_clips > 0)
542 { 539 {
543 HRGN new_clip = CreateRectRgnIndirect (s->clip); 540 HRGN new_clip = CreateRectRgnIndirect (s->clip);
544 541
542 /* Save clip region for later restoration. */
543 orig_clip = CreateRectRgn (0, 0, 0, 0);
544 if (!GetClipRgn(s->hdc, orig_clip))
545 {
546 DeleteObject (orig_clip);
547 orig_clip = NULL;
548 }
549
545 if (s->num_clips > 1) 550 if (s->num_clips > 1)
546 { 551 {
547 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1); 552 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1);
@@ -585,9 +590,10 @@ w32font_draw (s, from, to, x, y, with_background)
585 590
586 /* Restore clip region. */ 591 /* Restore clip region. */
587 if (s->num_clips > 0) 592 if (s->num_clips > 0)
588 { 593 SelectClipRgn (s->hdc, orig_clip);
589 SelectClipRgn (s->hdc, orig_clip); 594
590 } 595 if (orig_clip)
596 DeleteObject (orig_clip);
591} 597}
592 598
593/* w32 implementation of free_entity for font backend. 599/* w32 implementation of free_entity for font backend.