diff 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
line wrap: on
line diff
--- a/src/redisplay-msw.c	Mon Aug 13 11:16:09 2007 +0200
+++ b/src/redisplay-msw.c	Mon Aug 13 11:17:09 2007 +0200
@@ -577,8 +577,12 @@
   HDC hcompdc = get_frame_compdc (f);
   HGDIOBJ old=NULL;
   COLORREF bgcolor = GetBkColor (hdc);
+  const int real_x = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (p);
+  const int real_y = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (p);
+  const int surface_x = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
+  const int surface_y = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
 
-  /* first blt the mask */
+  /* first blit the mask */
   if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
     {
       RGBQUAD col;
@@ -591,27 +595,33 @@
       
       SetDIBColorTable (hcompdc, 1, 1, &col);
 
-      BitBlt (hdc, 
-	      db->xpos, db->ypos,
-	      dga->width, dga->height, 
-	      hcompdc,
-	      dga->xoffset, dga->yoffset, 
-	      SRCCOPY);                  
+      StretchBlt (hdc, 
+		  db->xpos, db->ypos,
+		  dga->width, dga->height, 
+		  hcompdc,
+		  MulDiv (dga->xoffset, real_x, surface_x),
+		  MulDiv (dga->yoffset, real_y, surface_y),
+		  MulDiv (dga->width, real_x, surface_x),
+		  MulDiv (dga->height, real_y, surface_y),
+		  SRCCOPY);                  
 
       SelectObject (hcompdc, old);
     }
   
-  /* Now blt the bitmap itself, or one of its slices. */
+  /* Now blit the bitmap itself, or one of its slices. */
   old = SelectObject (hcompdc,
 		      IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE 
 		      (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)));
 
-  BitBlt (hdc, 
-	  db->xpos, db->ypos,
-	  dga->width, dga->height,
-	  hcompdc,
-	  dga->xoffset, dga->yoffset, 
-	  IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY);
+  StretchBlt (hdc, 
+	      db->xpos, db->ypos,
+	      dga->width, dga->height,
+	      hcompdc,
+	      MulDiv (dga->xoffset, real_x, surface_x),
+	      MulDiv (dga->yoffset, real_y, surface_y),
+	      MulDiv (dga->width, real_x, surface_x),
+	      MulDiv (dga->height, real_y, surface_y),
+	      IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY);
 
   SelectObject (hcompdc, old);
 }
@@ -1137,27 +1147,6 @@
 		{
 		  switch (XIMAGE_INSTANCE_TYPE (instance))
 		    {
-		    case IMAGE_TEXT:
-		      {
-			/* #### This is way losing.  See the comment in
-			   add_glyph_rune(). */
-			Lisp_Object string =
-			  XIMAGE_INSTANCE_TEXT_STRING (instance);
-			convert_bufbyte_string_into_emchar_dynarr
-			  (XSTRING_DATA (string), XSTRING_LENGTH (string), buf);
-			
-			if (rb->cursor_type == CURSOR_ON)
-			  mswindows_output_cursor (w, dl, xpos, cursor_width,
-						   findex, Dynarr_at (buf, 0), 0);
-			else /* #### redisplay-x passes -1 as the width: why ? */
-			  mswindows_output_string (w, dl, buf, xpos,
-						   rb->object.dglyph.xoffset,
-						   start_pixpos, rb->width, findex,
-						   0, 0, 0, 0);
-			Dynarr_reset (buf);
-		      }
-		      break;
-		      
 		    case IMAGE_MONO_PIXMAP:
 		    case IMAGE_COLOR_PIXMAP:
 		      redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
@@ -1168,9 +1157,6 @@
 						 findex, 0, 1);
 		      break;
 		      
-		    case IMAGE_POINTER:
-		      abort ();
-		      
 		    case IMAGE_SUBWINDOW:
 		    case IMAGE_WIDGET:
 		      redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
@@ -1193,7 +1179,9 @@
 		    case IMAGE_NOTHING:
 		      /* nothing is as nothing does */
 		      break;
-		      
+
+		    case IMAGE_TEXT:
+		    case IMAGE_POINTER:
 		    default:
 		      abort ();
 		    }