(U+6215): Apply new conventions for glyph granularity.
[chise/xemacs-chise.git.1] / src / redisplay-msw.c
index 9caf8f7..5e7e9e5 100644 (file)
@@ -49,7 +49,7 @@ Boston, MA 02111-1307, USA.  */
 
 #ifdef MULE
 #include "mule-ccl.h"
-#include "mule-charset.h"
+#include "character.h"
 #endif
 
 #define MSWINDOWS_EOL_CURSOR_WIDTH     5
@@ -134,9 +134,9 @@ separate_textual_runs (unsigned char *text_storage,
 #ifdef MULE
          {
            Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
-           need_ccl_conversion = !NILP (ccl_prog);
-           if (need_ccl_conversion)
-             setup_ccl_program (&char_converter, ccl_prog);
+           if ((!NILP (ccl_prog))
+                 && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
+             need_ccl_conversion = 1;
          }
 #endif
        }
@@ -309,6 +309,7 @@ mswindows_output_blank (struct window *w, struct display_line *dl,
       struct display_glyph_area dga;
       redisplay_calculate_display_boxes (dl, rb->xpos, 
                                         /*rb->object.dglyph.xoffset*/ 0,
+                                         /*rb->object.dglyph.yoffset*/ 0,
                                         start_pixpos, rb->width,
                                         &db, &dga);
       /* blank the background in the appropriate color */
@@ -512,7 +513,7 @@ mswindows_output_string (struct window *w, struct display_line *dl,
     {
       struct display_box db;
       struct display_glyph_area dga;
-      redisplay_calculate_display_boxes (dl, xpos + xoffset, 0,
+      redisplay_calculate_display_boxes (dl, xpos + xoffset, 0, 0,
                                         clip_start, width, &db, &dga);
       /* blank the background in the appropriate color */
       mswindows_update_dc (hdc,
@@ -576,7 +577,6 @@ mswindows_output_dibitmap (struct frame *f, Lisp_Image_Instance *p,
   HDC hdc = get_frame_dc (f, 1);
   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);
@@ -585,15 +585,30 @@ mswindows_output_dibitmap (struct frame *f, Lisp_Image_Instance *p,
   /* first blit the mask */
   if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
     {
-      RGBQUAD col;
-      col.rgbBlue = GetBValue (bgcolor);
-      col.rgbRed = GetRValue (bgcolor);
-      col.rgbGreen = GetGValue (bgcolor);
-      col.rgbReserved = 0;
+      RGBQUAD bg;
+      COLORREF bgcolor;
 
       old = SelectObject (hcompdc, IMAGE_INSTANCE_MSWINDOWS_MASK (p));
       
-      SetDIBColorTable (hcompdc, 1, 1, &col);
+      if (IMAGE_INSTANCE_TYPE (p) == IMAGE_MONO_PIXMAP)
+       {
+         COLORREF fgcolor;
+         RGBQUAD fg;
+
+         fgcolor = GetTextColor (hdc);
+         fg.rgbBlue = GetBValue (fgcolor);
+         fg.rgbRed = GetRValue (fgcolor);
+         fg.rgbGreen = GetGValue (fgcolor);
+         fg.rgbReserved = 0;
+         SetDIBColorTable (hcompdc, 0, 1, &fg);
+       }
+
+      bgcolor = GetBkColor (hdc);
+      bg.rgbBlue = GetBValue (bgcolor);
+      bg.rgbRed = GetRValue (bgcolor);
+      bg.rgbGreen = GetGValue (bgcolor);
+      bg.rgbReserved = 0;
+      SetDIBColorTable (hcompdc, 1, 1, &bg);
 
       StretchBlt (hdc, 
                  db->xpos, db->ypos,
@@ -974,6 +989,7 @@ mswindows_frame_output_begin (struct frame *f)
 static void
 mswindows_frame_output_end (struct frame *f)
 {
+#ifdef DEFER_WINDOW_POS
   HDWP hdwp = FRAME_MSWINDOWS_DATA (f)->hdwp;
 
   if (hdwp != 0)
@@ -981,7 +997,7 @@ mswindows_frame_output_end (struct frame *f)
       EndDeferWindowPos (hdwp);
       FRAME_MSWINDOWS_DATA (f)->hdwp = 0;
     }
-
+#endif
   GdiFlush();
 }
 
@@ -1028,7 +1044,7 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b
                          int cursor_width, int cursor_height)
 {
   struct frame *f = XFRAME (w->frame);
-  Emchar_dynarr *buf = Dynarr_new (Emchar);
+  Emchar_dynarr *buf;
   Lisp_Object window;
 
   struct display_block *db = Dynarr_atp (dl->display_blocks, block);
@@ -1055,7 +1071,7 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b
 
   if (end < 0)
     end = Dynarr_length (rba);
-  Dynarr_reset (buf);
+  buf = Dynarr_new (Emchar);
 
   while (elt < end)
     {
@@ -1150,8 +1166,8 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b
              struct display_glyph_area dga;
 
              redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
-                                                start_pixpos, rb->width,
-                                                &dbox, &dga);
+                                                rb->object.dglyph.yoffset,
+                                                 start_pixpos, rb->width, &dbox, &dga);
 
              XSETWINDOW (window, w);
              instance = glyph_image_instance (rb->object.dglyph.glyph,
@@ -1176,7 +1192,7 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b
                      if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
                              Qlayout))
                        {
-                         redisplay_output_layout (w, instance, &dbox, &dga, findex,
+                         redisplay_output_layout (window, instance, &dbox, &dga, findex,
                                                   cursor_start, cursor_width,
                                                   cursor_height);
                          if (rb->cursor_type == CURSOR_ON)
@@ -1200,7 +1216,7 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b
                    case IMAGE_TEXT:
                    case IMAGE_POINTER:
                    default:
-                     abort ();
+                     ABORT ();
                    }
                  IMAGE_INSTANCE_OPTIMIZE_OUTPUT 
                    (XIMAGE_INSTANCE (instance)) = 0;
@@ -1209,7 +1225,7 @@ mswindows_output_display_block (struct window *w, struct display_line *dl, int b
              elt++;
            }
          else
-           abort ();
+           ABORT ();
        }
     }