aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2009-07-26 12:58:56 +0000
committerChong Yidong2009-07-26 12:58:56 +0000
commit4fbe2306e05a21f73a9a3ff90b0487c02fafa0d7 (patch)
tree73508d93fb2d64024bf35fbd72e34bda4a027061 /src
parent6ab2c7a8fb238a829d3312526ac56e4e3408b59a (diff)
downloademacs-4fbe2306e05a21f73a9a3ff90b0487c02fafa0d7.tar.gz
emacs-4fbe2306e05a21f73a9a3ff90b0487c02fafa0d7.zip
* nsfont.m (nsfont_draw): Revert 2009-07-15 change.
* nsterm.m (ns_maybe_dumpglyphs_background): Revert 2009-07-15 change. (ns_get_color): Revert 2009-07-16 change.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/nsfont.m4
-rw-r--r--src/nsterm.m78
3 files changed, 79 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f9f1e335384..164fdbccce4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12009-07-26 Chong Yidong <cyd@stupidchicken.com>
2
3 * nsfont.m (nsfont_draw): Revert 2009-07-15 change.
4
5 * nsterm.m (ns_maybe_dumpglyphs_background): Revert 2009-07-15
6 change.
7 (ns_get_color): Revert 2009-07-16 change.
8
12009-07-25 Eli Zaretskii <eliz@gnu.org> 92009-07-25 Eli Zaretskii <eliz@gnu.org>
2 10
3 * lread.c (syms_of_lread) <force_load_messages>: New variable. 11 * lread.c (syms_of_lread) <force_load_messages>: New variable.
diff --git a/src/nsfont.m b/src/nsfont.m
index 100676762a8..89b42901f42 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -1097,19 +1097,15 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1097 br.size.width -= 2*correction; 1097 br.size.width -= 2*correction;
1098 } 1098 }
1099 1099
1100#if 0
1101 if (!s->face->stipple) 1100 if (!s->face->stipple)
1102#endif
1103 [(NS_FACE_BACKGROUND (face) != 0 1101 [(NS_FACE_BACKGROUND (face) != 0
1104 ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) 1102 ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
1105 : FRAME_BACKGROUND_COLOR (s->f)) set]; 1103 : FRAME_BACKGROUND_COLOR (s->f)) set];
1106#if 0 /* This is tiling, not stippling. */
1107 else 1104 else
1108 { 1105 {
1109 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f); 1106 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f);
1110 [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set]; 1107 [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
1111 } 1108 }
1112#endif
1113 NSRectFill (br); 1109 NSRectFill (br);
1114 } 1110 }
1115 1111
diff --git a/src/nsterm.m b/src/nsterm.m
index 6249f217281..6b5da82a511 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1348,11 +1348,15 @@ ns_get_color (const char *name, NSColor **col)
1348/* -------------------------------------------------------------------------- 1348/* --------------------------------------------------------------------------
1349/* On *Step, we recognize several color formats, in addition to a catalog 1349/* On *Step, we recognize several color formats, in addition to a catalog
1350 of colors found in the file Emacs.clr. Color formats include: 1350 of colors found in the file Emacs.clr. Color formats include:
1351 - #rrggbb where rr, gg, bb specify red, green and blue in hex. */ 1351 - #rrggbb or RGBrrggbb where rr, gg, bb specify red, green and blue in hex
1352 - ARGBaarrggbb is similar, with aa being the alpha channel (FF = opaque)
1353 - HSVhhssvv and AHSVaahhssvv (or HSB/AHSB) are similar for hue, saturation,
1354 value;
1355 - CMYKccmmyykk is similar for cyan, magenta, yellow, black. */
1352{ 1356{
1353 NSColor * new = nil; 1357 NSColor * new = nil;
1354 const char *hex = NULL; 1358 const char *hex = NULL;
1355 enum { rgb } color_space; 1359 enum { rgb, argb, hsv, ahsv, cmyk, gray } color_space;
1356 NSString *nsname = [NSString stringWithUTF8String: name]; 1360 NSString *nsname = [NSString stringWithUTF8String: name];
1357 1361
1358/*fprintf (stderr, "ns_get_color: '%s'\n", name); */ 1362/*fprintf (stderr, "ns_get_color: '%s'\n", name); */
@@ -1377,11 +1381,46 @@ ns_get_color (const char *name, NSColor **col)
1377 return 0; 1381 return 0;
1378 } 1382 }
1379 1383
1384 /* FIXME: emacs seems to downcase everything before passing it here,
1385 which we can work around, except for GRAY, since gray##, where ## is
1386 decimal between 0 and 99, is also an X11 colorname. */
1380 if (name[0] == '#') /* X11 format */ 1387 if (name[0] == '#') /* X11 format */
1381 { 1388 {
1382 hex = name + 1; 1389 hex = name + 1;
1383 color_space = rgb; 1390 color_space = rgb;
1384 } 1391 }
1392 else if (!memcmp (name, "RGB", 3) || !memcmp (name, "rgb", 3))
1393 {
1394 hex = name + 3;
1395 color_space = rgb;
1396 }
1397 else if (!memcmp (name, "ARGB", 4) || !memcmp (name, "argb", 4))
1398 {
1399 hex = name + 4;
1400 color_space = argb;
1401 }
1402 else if (!memcmp (name, "HSV", 3) || !memcmp (name, "hsv", 3) ||
1403 !memcmp (name, "HSB", 3) || !memcmp (name, "hsb", 3))
1404 {
1405 hex = name + 3;
1406 color_space = hsv;
1407 }
1408 else if (!memcmp (name, "AHSV", 4) || !memcmp (name, "ahsv", 4) ||
1409 !memcmp (name, "AHSB", 4) || !memcmp (name, "ahsb", 4))
1410 {
1411 hex = name + 4;
1412 color_space = ahsv;
1413 }
1414 else if (!memcmp (name, "CMYK", 4) || !memcmp (name, "cmyk", 4))
1415 {
1416 hex = name + 4;
1417 color_space = cmyk;
1418 }
1419 else if (!memcmp (name, "GRAY", 4) /*|| !memcmp (name, "gray", 4)*/)
1420 {
1421 hex = name + 4;
1422 color_space = gray;
1423 }
1385 1424
1386 /* Direct colors (hex values) */ 1425 /* Direct colors (hex values) */
1387 if (hex) 1426 if (hex)
@@ -1411,6 +1450,34 @@ ns_get_color (const char *name, NSColor **col)
1411 blue: f4 1450 blue: f4
1412 alpha: 1.0]; 1451 alpha: 1.0];
1413 break; 1452 break;
1453 case argb:
1454 *col = [NSColor colorWithCalibratedRed: f2
1455 green: f3
1456 blue: f4
1457 alpha: f1];
1458 break;
1459 case hsv:
1460 *col = [NSColor colorWithCalibratedHue: f2
1461 saturation: f3
1462 brightness: f4
1463 alpha: 1.0];
1464 break;
1465 case ahsv:
1466 *col = [NSColor colorWithCalibratedHue: f2
1467 saturation: f3
1468 brightness: f4
1469 alpha: f1];
1470 break;
1471 case gray:
1472 *col = [NSColor colorWithCalibratedWhite: f3 alpha: f4];
1473 break;
1474 case cmyk:
1475 *col = [NSColor colorWithDeviceCyan: f1
1476 magenta: f2
1477 yellow: f3
1478 black: f4
1479 alpha: 1.0];
1480 break;
1414 } 1481 }
1415 *col = [*col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; 1482 *col = [*col colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
1416 UNBLOCK_INPUT; 1483 UNBLOCK_INPUT;
@@ -2653,7 +2720,8 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
2653 r = ns_fix_rect_ibw (r, FRAME_INTERNAL_BORDER_WIDTH (s->f), 2720 r = ns_fix_rect_ibw (r, FRAME_INTERNAL_BORDER_WIDTH (s->f),
2654 FRAME_PIXEL_WIDTH (s->f)); 2721 FRAME_PIXEL_WIDTH (s->f));
2655 2722
2656 /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) 2723 /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */
2724 if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color)
2657 { 2725 {
2658 ns_draw_box (r, abs (thickness), 2726 ns_draw_box (r, abs (thickness),
2659 ns_lookup_indexed_color (face->box_color, s->f), 2727 ns_lookup_indexed_color (face->box_color, s->f),
@@ -2692,19 +2760,15 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p)
2692 } 2760 }
2693 else 2761 else
2694 face = FACE_FROM_ID (s->f, s->first_glyph->face_id); 2762 face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
2695#if 0
2696 if (!face->stipple) 2763 if (!face->stipple)
2697#endif
2698 [(NS_FACE_BACKGROUND (face) != 0 2764 [(NS_FACE_BACKGROUND (face) != 0
2699 ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) 2765 ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
2700 : FRAME_BACKGROUND_COLOR (s->f)) set]; 2766 : FRAME_BACKGROUND_COLOR (s->f)) set];
2701#if 0 /* This is tiling, not stippling. */
2702 else 2767 else
2703 { 2768 {
2704 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f); 2769 struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (s->f);
2705 [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set]; 2770 [[dpyinfo->bitmaps[face->stipple-1].img stippleMask] set];
2706 } 2771 }
2707#endif
2708 2772
2709 if (s->hl != DRAW_CURSOR) 2773 if (s->hl != DRAW_CURSOR)
2710 { 2774 {