Changeset 3401

Show
Ignore:
Timestamp:
08/14/04 09:46:41 (4 years ago)
Author:
miyoshi
Message:

(mw32_draw_image_foreground): Draw an image with
offscreen rendering.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.1/src/ChangeLog.Meadow

    r3398 r3401  
     12004-08-14  MIYOSHI Masanori  <miyoshi@meadowy.org> 
     2 
     3        * mw32term.c (mw32_draw_image_foreground): Draw an image with 
     4        offscreen rendering. 
     5 
    162004-08-13  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
    27 
  • branches/2.1/src/mw32term.c

    r3387 r3401  
    39173917          if (hbmpmask) 
    39183918            { 
    3919               HDC hdc_src = CreateCompatibleDC (s->hdc); 
    3920               if (hdc_src) 
     3919              HDC hdc_fg = CreateCompatibleDC (s->hdc); 
     3920              HDC hdc_bg = CreateCompatibleDC (s->hdc); 
     3921              if (hdc_fg && hdc_bg) 
    39213922                { 
    3922                   HBITMAP hsrc = CreateCompatibleBitmap (s->hdc, 
    3923                                                          s->img->width, 
    3924                                                          s->img->height); 
    3925                   if (hsrc) 
     3923                  int w = s->img->width; 
     3924                  int h = s->img->height; 
     3925                  HBITMAP hfg = CreateCompatibleBitmap (s->hdc, w, h); 
     3926                  HBITMAP hbg = CreateCompatibleBitmap (s->hdc, w, h); 
     3927                  if (hfg && hbg) 
    39263928                    { 
    3927                       HGDIOBJ hsrc_old = SelectObject (hdc_src, hsrc); 
     3929                      HGDIOBJ hfg_old = SelectObject (hdc_fg, hfg); 
     3930                      HGDIOBJ hbg_old = SelectObject (hdc_bg, hbg); 
    39283931               
    3929                       /* Fill the background area with black mask. */ 
     3932                      /* Build up background */ 
     3933                      BitBlt (hdc_bg, 0, 0, w, h, s->hdc, x, y, SRCCOPY); 
    39303934                      holdbmp = SelectObject (hdcimg, hbmpmask); 
    3931                       BitBlt (s->hdc, x, y, s->img->width, s->img->height, 
    3932                               hdcimg, 0, 0, SRCAND); 
    3933                       /* Fill the foreground area with white mask. */ 
    3934                       BitBlt (hdc_src, 0, 0, s->img->width, s->img->height, 
    3935                               hdcimg, 0, 0, NOTSRCCOPY); 
    3936                       /* Merge image with foreground by bitwise-and. */ 
     3935                      BitBlt (hdc_bg, 0, 0, w, h, hdcimg, 0, 0, SRCAND); 
     3936                      /* Build up foreground */ 
     3937                      BitBlt (hdc_fg, 0, 0, w, h, hdcimg, 0, 0, NOTSRCCOPY); 
    39373938                      SelectObject (hdcimg, hbmp); 
    3938                       BitBlt (hdc_src, 0, 0, s->img->width, s->img->height, 
    3939                              hdcimg, 0, 0, SRCAND); 
    3940                       /* Last merge background with foreground by 
    3941                         bitwise-or. */ 
    3942                       BitBlt (s->hdc, x, y, s->img->width, s->img->height, 
    3943                              hdc_src, 0, 0, SRCPAINT); 
    3944                       SelectObject (hdc_src, hsrc_old); 
     3939                      BitBlt (hdc_fg, 0, 0, w, h, hdcimg, 0, 0, SRCAND); 
     3940                      /* Merge background and foreground */ 
     3941                      BitBlt (hdc_fg, 0, 0, w, h, hdc_bg, 0, 0, SRCPAINT); 
     3942                      /* Copy the result to HDC */ 
     3943                      BitBlt (s->hdc, x, y, w, h, hdc_fg, 0, 0, SRCCOPY); 
     3944                      SelectObject (hdc_fg, hfg_old); 
     3945                      SelectObject (hdc_bg, hbg_old); 
    39453946                    } 
    3946                   DeleteDC (hdc_src); 
    3947                   DeleteObject (hsrc); 
     3947                  if (hfg) DeleteObject (hfg); 
     3948                  if (hbg) DeleteObject (hbg); 
    39483949                } 
     3950              if (hdc_fg) DeleteDC (hdc_fg); 
     3951              if (hdc_bg) DeleteDC (hdc_bg); 
    39493952            } 
    39503953          else