{
#if USE_CG_DRAWING
CGContextRef context;
+ float gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2;
+
+ if (y1 != y2)
+ gx1 += 0.5f, gx2 += 0.5f;
+ if (x1 != x2)
+ gy1 += 0.5f, gy2 += 0.5f;
context = mac_begin_cg_clip (f, gc);
CG_SET_STROKE_COLOR (context, gc->xgcv.foreground);
CGContextBeginPath (context);
- CGContextMoveToPoint (context, x1 + 0.5f, y1 + 0.5f);
- CGContextAddLineToPoint (context, x2 + 0.5f, y2 + 0.5f);
+ CGContextMoveToPoint (context, gx1, gy1);
+ CGContextAddLineToPoint (context, gx2, gy2);
CGContextClosePath (context);
CGContextStrokePath (context);
mac_end_cg_clip (f);
#else
+ if (x1 == x2)
+ {
+ if (y1 > y2)
+ y1--;
+ else if (y2 > y1)
+ y2--;
+ }
+ else if (y1 == y2)
+ {
+ if (x1 > x2)
+ x1--;
+ else
+ x2--;
+ }
+
SetPortWindowPort (FRAME_MAC_WINDOW (f));
RGBForeColor (GC_FORE_COLOR (gc));
CGrafPtr old_port;
GDHandle old_gdh;
+ if (x1 == x2)
+ {
+ if (y1 > y2)
+ y1--;
+ else if (y2 > y1)
+ y2--;
+ }
+ else if (y1 == y2)
+ {
+ if (x1 > x2)
+ x1--;
+ else
+ x2--;
+ }
+
GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
DisposeRgn (region);
}
}
-#if defined (MAC_OSX) && USE_ATSUI
+#if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING)
for (i = 0; i < n; i++)
{
Rect *rect = rectangles + i;
static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *));
+static void
+pcm_init (pcm, count)
+ XCharStruct *pcm;
+ int count;
+{
+ bzero (pcm, sizeof (XCharStruct) * count);
+ while (--count >= 0)
+ {
+ pcm->descent = PCM_INVALID;
+ pcm++;
+ }
+}
+
+static enum pcm_status
+pcm_get_status (pcm)
+ XCharStruct *pcm;
+{
+ int height = pcm->ascent + pcm->descent;
+
+ /* Negative height means some special status. */
+ return height >= 0 ? PCM_VALID : height;
+}
+
/* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B
is not contained in the font. */
#if USE_ATSUI
if (font->mac_style)
{
- XCharStructRow **row = font->bounds.rows + char2b->byte1;
+ XCharStruct **row = font->bounds.rows + char2b->byte1;
if (*row == NULL)
{
- *row = xmalloc (sizeof (XCharStructRow));
- bzero (*row, sizeof (XCharStructRow));
+ *row = xmalloc (sizeof (XCharStruct) * 0x100);
+ pcm_init (*row, 0x100);
}
- pcm = (*row)->per_char + char2b->byte2;
- if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
+ pcm = *row + char2b->byte2;
+ if (pcm_get_status (pcm) != PCM_VALID)
{
BLOCK_INPUT;
mac_query_char_extents (font->mac_style,
(char2b->byte1 << 8) + char2b->byte2,
NULL, NULL, pcm, NULL);
UNBLOCK_INPUT;
- XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
}
}
else
for (i = 0; i < width; ++i)
mac_draw_line (f, gc,
left_x + i * left_p, top_y + i,
- right_x - i * right_p, top_y + i);
+ right_x + 1 - i * right_p, top_y + i);
/* Left. */
if (left_p)
for (i = 0; i < width; ++i)
mac_draw_line (f, gc,
- left_x + i, top_y + i, left_x + i, bottom_y - i);
+ left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
mac_reset_clip_rectangles (dpy, gc);
if (raised_p)
for (i = 0; i < width; ++i)
mac_draw_line (f, gc,
left_x + i * left_p, bottom_y - i,
- right_x - i * right_p, bottom_y - i);
+ right_x + 1 - i * right_p, bottom_y - i);
/* Right. */
if (right_p)
for (i = 0; i < width; ++i)
mac_draw_line (f, gc,
- right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1);
+ right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
mac_reset_clip_rectangles (dpy, gc);
}
if (FRAME_SIZE_HINTS (f))
xfree (FRAME_SIZE_HINTS (f));
+#if TARGET_API_MAC_CARBON
+ if (FRAME_FILE_NAME (f))
+ xfree (FRAME_FILE_NAME (f));
+#endif
+
xfree (f->output_data.mac);
f->output_data.mac = NULL;
font->min_char_or_byte2 = 0;
font->max_char_or_byte2 = 0xff;
- font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100);
- bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100);
- font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow));
- bzero (font->bounds.rows[0], sizeof (XCharStructRow));
+ font->bounds.rows = xmalloc (sizeof (XCharStruct *) * 0x100);
+ bzero (font->bounds.rows, sizeof (XCharStruct *) * 0x100);
+ font->bounds.rows[0] = xmalloc (sizeof (XCharStruct) * 0x100);
+ pcm_init (font->bounds.rows[0], 0x100);
#if USE_CG_TEXT_DRAWING
{
bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
}
#endif
- space_bounds = font->bounds.rows[0]->per_char + 0x20;
+ space_bounds = font->bounds.rows[0] + 0x20;
err = mac_query_char_extents (font->mac_style, 0x20,
&font->ascent, &font->descent,
space_bounds,
mac_unload_font (&one_mac_display_info, font);
return NULL;
}
- XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], 0x20);
- pcm = font->bounds.rows[0]->per_char;
+ pcm = font->bounds.rows[0];
for (c = 0x21; c <= 0xff; c++)
{
if (c == 0xad)
NULL
#endif
);
- XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], c);
#if USE_CG_TEXT_DRAWING
if (font->cg_glyphs && font->cg_glyphs[c] == 0)
}
break;
+#if TARGET_API_MAC_CARBON
+ case inProxyIcon:
+ if (TrackWindowProxyDrag (window_ptr, er.where)
+ != errUserWantsToDragWindow)
+ break;
+ /* fall through */
+#endif
case inDrag:
#if TARGET_API_MAC_CARBON
+ if (IsWindowPathSelectClick (window_ptr, &er))
+ {
+ WindowPathSelect (window_ptr, NULL, NULL);
+ break;
+ }
DragWindow (window_ptr, er.where, NULL);
#else /* not TARGET_API_MAC_CARBON */
DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
doc: /* *If non-nil, allow anti-aliasing.
The text will be rendered using Core Graphics text rendering which
may anti-alias the text. */);
+#if USE_CG_DRAWING
+ mac_use_core_graphics = 1;
+#else
mac_use_core_graphics = 0;
+#endif
/* Register an entry for `mac-roman' so that it can be used when
creating the terminal frame on Mac OS 9 before loading