diff options
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2008-08-30 04:55:17 +0000 |
---|---|---|
committer | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2008-08-30 04:55:17 +0000 |
commit | c374819b6b39d93549ba424b5b34a14e947193b5 (patch) | |
tree | 4e9c54a2697e882c0680dff40a10cc9f1679de7e | |
parent | cbd5b3d95ecd6ef2e955911c913856824aaa7639 (diff) | |
download | emacs-c374819b6b39d93549ba424b5b34a14e947193b5.tar.gz |
[USE_CG_DRAWING] (mac_draw_cg_image): Fix coordinate flipping.
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/macterm.c | 18 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9bab3609af6..3ff360b1c2c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-08-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c [USE_CG_DRAWING] (mac_draw_cg_image): + Fix coordinate flipping. + 2008-08-29 Eli Zaretskii <eliz@gnu.org> * fileio.c (Fexpand_file_name): Copy argument `name' into local diff --git a/src/macterm.c b/src/macterm.c index dee084065a1..0ec3c75e638 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -559,27 +559,25 @@ mac_draw_cg_image (image, f, gc, src_x, src_y, width, height, int dest_x, dest_y, overlay_p; { CGContextRef context; - CGFloat port_height = FRAME_PIXEL_HEIGHT (f); - CGRect dest_rect = mac_rect_make (f, dest_x, dest_y, width, height); + CGRect dest_rect, bounds; context = mac_begin_cg_clip (f, gc); + dest_rect = mac_rect_make (f, dest_x, dest_y, width, height); + bounds = mac_rect_make (f, dest_x - src_x, dest_y - src_y, + CGImageGetWidth (image), CGImageGetHeight (image)); if (!overlay_p) { CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); CGContextFillRect (context, dest_rect); } CGContextClipToRect (context, dest_rect); + CGContextTranslateCTM (context, + CGRectGetMinX (bounds), CGRectGetMaxY (bounds)); CGContextScaleCTM (context, 1, -1); - CGContextTranslateCTM (context, 0, -port_height); if (CGImageIsMask (image)) CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, gc); - CGContextDrawImage (context, - mac_rect_make (f, dest_x - src_x, - port_height - (dest_y - src_y - + CGImageGetHeight (image)), - CGImageGetWidth (image), - CGImageGetHeight (image)), - image); + bounds.origin = CGPointZero; + CGContextDrawImage (context, bounds, image); mac_end_cg_clip (f); } |