comparison src/redisplay-msw.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 2f8bb876ab1d
children 501cfd01ee6d
comparison
equal deleted inserted replaced
405:0e08f63c74d2 406:b8cc9ab3f761
575 { 575 {
576 HDC hdc = get_frame_dc (f, 1); 576 HDC hdc = get_frame_dc (f, 1);
577 HDC hcompdc = get_frame_compdc (f); 577 HDC hcompdc = get_frame_compdc (f);
578 HGDIOBJ old=NULL; 578 HGDIOBJ old=NULL;
579 COLORREF bgcolor = GetBkColor (hdc); 579 COLORREF bgcolor = GetBkColor (hdc);
580 580 const int real_x = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (p);
581 /* first blt the mask */ 581 const int real_y = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (p);
582 const int surface_x = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
583 const int surface_y = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
584
585 /* first blit the mask */
582 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) 586 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
583 { 587 {
584 RGBQUAD col; 588 RGBQUAD col;
585 col.rgbBlue = GetBValue (bgcolor); 589 col.rgbBlue = GetBValue (bgcolor);
586 col.rgbRed = GetRValue (bgcolor); 590 col.rgbRed = GetRValue (bgcolor);
589 593
590 old = SelectObject (hcompdc, IMAGE_INSTANCE_MSWINDOWS_MASK (p)); 594 old = SelectObject (hcompdc, IMAGE_INSTANCE_MSWINDOWS_MASK (p));
591 595
592 SetDIBColorTable (hcompdc, 1, 1, &col); 596 SetDIBColorTable (hcompdc, 1, 1, &col);
593 597
594 BitBlt (hdc, 598 StretchBlt (hdc,
595 db->xpos, db->ypos, 599 db->xpos, db->ypos,
596 dga->width, dga->height, 600 dga->width, dga->height,
597 hcompdc, 601 hcompdc,
598 dga->xoffset, dga->yoffset, 602 MulDiv (dga->xoffset, real_x, surface_x),
599 SRCCOPY); 603 MulDiv (dga->yoffset, real_y, surface_y),
604 MulDiv (dga->width, real_x, surface_x),
605 MulDiv (dga->height, real_y, surface_y),
606 SRCCOPY);
600 607
601 SelectObject (hcompdc, old); 608 SelectObject (hcompdc, old);
602 } 609 }
603 610
604 /* Now blt the bitmap itself, or one of its slices. */ 611 /* Now blit the bitmap itself, or one of its slices. */
605 old = SelectObject (hcompdc, 612 old = SelectObject (hcompdc,
606 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE 613 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE
607 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p))); 614 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)));
608 615
609 BitBlt (hdc, 616 StretchBlt (hdc,
610 db->xpos, db->ypos, 617 db->xpos, db->ypos,
611 dga->width, dga->height, 618 dga->width, dga->height,
612 hcompdc, 619 hcompdc,
613 dga->xoffset, dga->yoffset, 620 MulDiv (dga->xoffset, real_x, surface_x),
614 IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY); 621 MulDiv (dga->yoffset, real_y, surface_y),
622 MulDiv (dga->width, real_x, surface_x),
623 MulDiv (dga->height, real_y, surface_y),
624 IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY);
615 625
616 SelectObject (hcompdc, old); 626 SelectObject (hcompdc, old);
617 } 627 }
618 628
619 /* X gc's have this nice property that setting the bg pixmap will 629 /* X gc's have this nice property that setting the bg pixmap will
1135 1145
1136 if (IMAGE_INSTANCEP (instance)) 1146 if (IMAGE_INSTANCEP (instance))
1137 { 1147 {
1138 switch (XIMAGE_INSTANCE_TYPE (instance)) 1148 switch (XIMAGE_INSTANCE_TYPE (instance))
1139 { 1149 {
1140 case IMAGE_TEXT:
1141 {
1142 /* #### This is way losing. See the comment in
1143 add_glyph_rune(). */
1144 Lisp_Object string =
1145 XIMAGE_INSTANCE_TEXT_STRING (instance);
1146 convert_bufbyte_string_into_emchar_dynarr
1147 (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
1148
1149 if (rb->cursor_type == CURSOR_ON)
1150 mswindows_output_cursor (w, dl, xpos, cursor_width,
1151 findex, Dynarr_at (buf, 0), 0);
1152 else /* #### redisplay-x passes -1 as the width: why ? */
1153 mswindows_output_string (w, dl, buf, xpos,
1154 rb->object.dglyph.xoffset,
1155 start_pixpos, rb->width, findex,
1156 0, 0, 0, 0);
1157 Dynarr_reset (buf);
1158 }
1159 break;
1160
1161 case IMAGE_MONO_PIXMAP: 1150 case IMAGE_MONO_PIXMAP:
1162 case IMAGE_COLOR_PIXMAP: 1151 case IMAGE_COLOR_PIXMAP:
1163 redisplay_output_pixmap (w, instance, &dbox, &dga, findex, 1152 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
1164 cursor_start, cursor_width, 1153 cursor_start, cursor_width,
1165 cursor_height, 0); 1154 cursor_height, 0);
1166 if (rb->cursor_type == CURSOR_ON) 1155 if (rb->cursor_type == CURSOR_ON)
1167 mswindows_output_cursor (w, dl, xpos, cursor_width, 1156 mswindows_output_cursor (w, dl, xpos, cursor_width,
1168 findex, 0, 1); 1157 findex, 0, 1);
1169 break; 1158 break;
1170
1171 case IMAGE_POINTER:
1172 abort ();
1173 1159
1174 case IMAGE_SUBWINDOW: 1160 case IMAGE_SUBWINDOW:
1175 case IMAGE_WIDGET: 1161 case IMAGE_WIDGET:
1176 redisplay_output_subwindow (w, instance, &dbox, &dga, findex, 1162 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
1177 cursor_start, cursor_width, 1163 cursor_start, cursor_width,
1191 break; 1177 break;
1192 1178
1193 case IMAGE_NOTHING: 1179 case IMAGE_NOTHING:
1194 /* nothing is as nothing does */ 1180 /* nothing is as nothing does */
1195 break; 1181 break;
1196 1182
1183 case IMAGE_TEXT:
1184 case IMAGE_POINTER:
1197 default: 1185 default:
1198 abort (); 1186 abort ();
1199 } 1187 }
1200 IMAGE_INSTANCE_OPTIMIZE_OUTPUT 1188 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
1201 (XIMAGE_INSTANCE (instance)) = 0; 1189 (XIMAGE_INSTANCE (instance)) = 0;