diff options
| author | YAMAMOTO Mitsuharu | 2008-08-30 08:08:11 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2008-08-30 08:08:11 +0000 |
| commit | b16c969bca8bbc4c504f9d55a0cd8f639fb6ca9b (patch) | |
| tree | af54a32514b79e2f1ae028e0dc3e1536ab31cd19 | |
| parent | c374819b6b39d93549ba424b5b34a14e947193b5 (diff) | |
| download | emacs-b16c969bca8bbc4c504f9d55a0cd8f639fb6ca9b.tar.gz emacs-b16c969bca8bbc4c504f9d55a0cd8f639fb6ca9b.zip | |
[USE_ATSUI] (mac_draw_image_string_atsui) [MAC_OS_X]: Fix coordinate flipping.
[USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg): Likewise.
| -rw-r--r-- | src/ChangeLog | 2 | ||||
| -rw-r--r-- | src/macterm.c | 16 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3ff360b1c2c..9282748191a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | * macterm.c [USE_CG_DRAWING] (mac_draw_cg_image): | 3 | * macterm.c [USE_CG_DRAWING] (mac_draw_cg_image): |
| 4 | Fix coordinate flipping. | 4 | Fix coordinate flipping. |
| 5 | [USE_ATSUI] (mac_draw_image_string_atsui) [MAC_OS_X]: Likewise. | ||
| 6 | [USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg): Likewise. | ||
| 5 | 7 | ||
| 6 | 2008-08-29 Eli Zaretskii <eliz@gnu.org> | 8 | 2008-08-29 Eli Zaretskii <eliz@gnu.org> |
| 7 | 9 | ||
diff --git a/src/macterm.c b/src/macterm.c index 0ec3c75e638..a9964ae28ab 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -1012,7 +1012,6 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width, | |||
| 1012 | else | 1012 | else |
| 1013 | { | 1013 | { |
| 1014 | static CGContextRef context; | 1014 | static CGContextRef context; |
| 1015 | CGFloat port_height = FRAME_PIXEL_HEIGHT (f); | ||
| 1016 | static const ATSUAttributeTag tags[] = {kATSUCGContextTag}; | 1015 | static const ATSUAttributeTag tags[] = {kATSUCGContextTag}; |
| 1017 | static const ByteCount sizes[] = {sizeof (CGContextRef)}; | 1016 | static const ByteCount sizes[] = {sizeof (CGContextRef)}; |
| 1018 | static const ATSUAttributeValuePtr values[] = {&context}; | 1017 | static const ATSUAttributeValuePtr values[] = {&context}; |
| @@ -1026,7 +1025,7 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width, | |||
| 1026 | QDBeginCGContext (port, &context); | 1025 | QDBeginCGContext (port, &context); |
| 1027 | if (gc->n_clip_rects || bg_width) | 1026 | if (gc->n_clip_rects || bg_width) |
| 1028 | { | 1027 | { |
| 1029 | CGContextTranslateCTM (context, 0, port_height); | 1028 | CGContextTranslateCTM (context, 0, FRAME_PIXEL_HEIGHT (f)); |
| 1030 | CGContextScaleCTM (context, 1, -1); | 1029 | CGContextScaleCTM (context, 1, -1); |
| 1031 | if (gc->n_clip_rects) | 1030 | if (gc->n_clip_rects) |
| 1032 | CGContextClipToRects (context, gc->clip_rects, | 1031 | CGContextClipToRects (context, gc->clip_rects, |
| @@ -1042,7 +1041,6 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width, | |||
| 1042 | FONT_HEIGHT (GC_FONT (gc)))); | 1041 | FONT_HEIGHT (GC_FONT (gc)))); |
| 1043 | } | 1042 | } |
| 1044 | CGContextScaleCTM (context, 1, -1); | 1043 | CGContextScaleCTM (context, 1, -1); |
| 1045 | CGContextTranslateCTM (context, 0, -port_height); | ||
| 1046 | #if !USE_CG_DRAWING | 1044 | #if !USE_CG_DRAWING |
| 1047 | } | 1045 | } |
| 1048 | #endif | 1046 | #endif |
| @@ -1054,11 +1052,11 @@ mac_draw_image_string_atsui (f, gc, x, y, buf, nchars, bg_width, | |||
| 1054 | { | 1052 | { |
| 1055 | ATSUDrawText (text_layout, | 1053 | ATSUDrawText (text_layout, |
| 1056 | kATSUFromTextBeginning, kATSUToTextEnd, | 1054 | kATSUFromTextBeginning, kATSUToTextEnd, |
| 1057 | Long2Fix (x), Long2Fix (port_height - y)); | 1055 | Long2Fix (x), Long2Fix (-y)); |
| 1058 | if (overstrike_p) | 1056 | if (overstrike_p) |
| 1059 | ATSUDrawText (text_layout, | 1057 | ATSUDrawText (text_layout, |
| 1060 | kATSUFromTextBeginning, kATSUToTextEnd, | 1058 | kATSUFromTextBeginning, kATSUToTextEnd, |
| 1061 | Long2Fix (x + 1), Long2Fix (port_height - y)); | 1059 | Long2Fix (x + 1), Long2Fix (-y)); |
| 1062 | } | 1060 | } |
| 1063 | #if USE_CG_DRAWING | 1061 | #if USE_CG_DRAWING |
| 1064 | mac_end_cg_clip (f); | 1062 | mac_end_cg_clip (f); |
| @@ -1383,7 +1381,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1383 | XChar2b *buf; | 1381 | XChar2b *buf; |
| 1384 | int nchars, bg_width, overstrike_p; | 1382 | int nchars, bg_width, overstrike_p; |
| 1385 | { | 1383 | { |
| 1386 | CGFloat port_height, gx, gy; | 1384 | CGFloat gx, gy; |
| 1387 | int i; | 1385 | int i; |
| 1388 | CGContextRef context; | 1386 | CGContextRef context; |
| 1389 | CGGlyph *glyphs; | 1387 | CGGlyph *glyphs; |
| @@ -1392,9 +1390,8 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1392 | if (!mac_use_core_graphics || GC_FONT (gc)->cg_font == NULL) | 1390 | if (!mac_use_core_graphics || GC_FONT (gc)->cg_font == NULL) |
| 1393 | return 0; | 1391 | return 0; |
| 1394 | 1392 | ||
| 1395 | port_height = FRAME_PIXEL_HEIGHT (f); | ||
| 1396 | gx = x; | 1393 | gx = x; |
| 1397 | gy = port_height - y; | 1394 | gy = -y; |
| 1398 | glyphs = (CGGlyph *)buf; | 1395 | glyphs = (CGGlyph *)buf; |
| 1399 | advances = alloca (sizeof (CGSize) * nchars); | 1396 | advances = alloca (sizeof (CGSize) * nchars); |
| 1400 | if (advances == NULL) | 1397 | if (advances == NULL) |
| @@ -1415,7 +1412,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1415 | QDBeginCGContext (GetWindowPort (FRAME_MAC_WINDOW (f)), &context); | 1412 | QDBeginCGContext (GetWindowPort (FRAME_MAC_WINDOW (f)), &context); |
| 1416 | if (gc->n_clip_rects || bg_width) | 1413 | if (gc->n_clip_rects || bg_width) |
| 1417 | { | 1414 | { |
| 1418 | CGContextTranslateCTM (context, 0, port_height); | 1415 | CGContextTranslateCTM (context, 0, FRAME_PIXEL_HEIGHT (f)); |
| 1419 | CGContextScaleCTM (context, 1, -1); | 1416 | CGContextScaleCTM (context, 1, -1); |
| 1420 | if (gc->n_clip_rects) | 1417 | if (gc->n_clip_rects) |
| 1421 | CGContextClipToRects (context, gc->clip_rects, gc->n_clip_rects); | 1418 | CGContextClipToRects (context, gc->clip_rects, gc->n_clip_rects); |
| @@ -1429,7 +1426,6 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) | |||
| 1429 | bg_width, FONT_HEIGHT (GC_FONT (gc)))); | 1426 | bg_width, FONT_HEIGHT (GC_FONT (gc)))); |
| 1430 | } | 1427 | } |
| 1431 | CGContextScaleCTM (context, 1, -1); | 1428 | CGContextScaleCTM (context, 1, -1); |
| 1432 | CGContextTranslateCTM (context, 0, -port_height); | ||
| 1433 | #if !USE_CG_DRAWING | 1429 | #if !USE_CG_DRAWING |
| 1434 | } | 1430 | } |
| 1435 | #endif | 1431 | #endif |