comparison src/w32font.c @ 91030:8be09e8e2c97

(w32font_draw): Do clipping here.
author Jason Rumney <jasonr@gnu.org>
date Thu, 13 Sep 2007 13:37:26 +0000
parents 269d87dc10d9
children fe9053c62d68
comparison
equal deleted inserted replaced
91029:532c5466a06d 91030:8be09e8e2c97
490 w32font_draw (s, from, to, x, y, with_background) 490 w32font_draw (s, from, to, x, y, with_background)
491 struct glyph_string *s; 491 struct glyph_string *s;
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
501 brush = CreateSolidBrush (s->gc->background); 524 brush = CreateSolidBrush (s->gc->background);
502 rect.left = x; 525 rect.left = x;
503 rect.top = y - ((struct font *) (s->font_info->font))->ascent; 526 rect.top = y - ((struct font *) (s->font_info->font))->ascent;
504 rect.right = x + s->width; 527 rect.right = x + s->width;
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.
516 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). 546 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value).
517 Free FONT_EXTRA_INDEX field of FONT_ENTITY. 547 Free FONT_EXTRA_INDEX field of FONT_ENTITY.