aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-01-05 06:05:05 +0000
committerPo Lu2022-01-05 06:07:32 +0000
commitf090c25113995eeac5c2f84ee78a63ed2fb91638 (patch)
tree6fdf7a0db4016e3d3aced17fbec5e55dbfda3627 /src
parentd763c12796ae13d5acd3c48c180981538d4318a8 (diff)
downloademacs-f090c25113995eeac5c2f84ee78a63ed2fb91638.tar.gz
emacs-f090c25113995eeac5c2f84ee78a63ed2fb91638.zip
Remove some unnecessary graphics state saves on Haiku
* src/haikufont.c (haikufont_draw): * src/haikuterm.c (haiku_draw_box_rect): (haiku_draw_relief_rect): (haiku_draw_underwave): (haiku_draw_text_decoration): (haiku_draw_plain_background): (haiku_draw_glyph_string_foreground): (haiku_draw_glyphless_glyph_string_foreground): (haiku_draw_stretch_glyph_string): (haiku_draw_composite_glyph_string_foreground): (haiku_draw_image_glyph_string): Remove unnecessary calls to BView_StartClip and BView_EndClip.
Diffstat (limited to 'src')
-rw-r--r--src/haikufont.c2
-rw-r--r--src/haikuterm.c33
2 files changed, 4 insertions, 31 deletions
diff --git a/src/haikufont.c b/src/haikufont.c
index 1e5c1cb352a..e1a09f407c5 100644
--- a/src/haikufont.c
+++ b/src/haikufont.c
@@ -956,7 +956,6 @@ haikufont_draw (struct glyph_string *s, int from, int to,
956 prepare_face_for_display (s->f, face); 956 prepare_face_for_display (s->f, face);
957 957
958 BView_draw_lock (view); 958 BView_draw_lock (view);
959 BView_StartClip (view);
960 if (with_background) 959 if (with_background)
961 { 960 {
962 int height = FONT_HEIGHT (s->font), ascent = FONT_BASE (s->font); 961 int height = FONT_HEIGHT (s->font), ascent = FONT_BASE (s->font);
@@ -1022,7 +1021,6 @@ haikufont_draw (struct glyph_string *s, int from, int to,
1022 BView_DrawString (view, b, b_len); 1021 BView_DrawString (view, b, b_len);
1023 xfree (b); 1022 xfree (b);
1024 } 1023 }
1025 BView_EndClip (view);
1026 BView_draw_unlock (view); 1024 BView_draw_unlock (view);
1027 unblock_input (); 1025 unblock_input ();
1028 return 1; 1026 return 1;
diff --git a/src/haikuterm.c b/src/haikuterm.c
index 5447683a6ed..65c91bbd381 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -413,6 +413,7 @@ haiku_draw_box_rect (struct glyph_string *s,
413 struct face *face = s->face; 413 struct face *face = s->face;
414 414
415 BView_StartClip (view); 415 BView_StartClip (view);
416 haiku_clip_to_string (s);
416 BView_SetHighColor (view, face->box_color); 417 BView_SetHighColor (view, face->box_color);
417 if (clip_rect) 418 if (clip_rect)
418 BView_ClipToRect (view, clip_rect->x, clip_rect->y, clip_rect->width, 419 BView_ClipToRect (view, clip_rect->x, clip_rect->y, clip_rect->width,
@@ -468,7 +469,7 @@ haiku_draw_relief_rect (struct glyph_string *s,
468 469
469 void *view = FRAME_HAIKU_VIEW (s->f); 470 void *view = FRAME_HAIKU_VIEW (s->f);
470 BView_StartClip (view); 471 BView_StartClip (view);
471 472 haiku_clip_to_string (s);
472 BView_SetHighColor (view, raised_p ? color_white : color_black); 473 BView_SetHighColor (view, raised_p ? color_white : color_black);
473 if (clip_rect) 474 if (clip_rect)
474 BView_ClipToRect (view, clip_rect->x, clip_rect->y, clip_rect->width, 475 BView_ClipToRect (view, clip_rect->x, clip_rect->y, clip_rect->width,
@@ -550,6 +551,7 @@ haiku_draw_underwave (struct glyph_string *s, int width, int x)
550 void *view = FRAME_HAIKU_VIEW (s->f); 551 void *view = FRAME_HAIKU_VIEW (s->f);
551 552
552 BView_StartClip (view); 553 BView_StartClip (view);
554 haiku_clip_to_string (s);
553 BView_ClipToRect (view, x, y, width, wave_height); 555 BView_ClipToRect (view, x, y, width, wave_height);
554 ax = x - ((int) (x) % dx) + (float) 0.5; 556 ax = x - ((int) (x) % dx) + (float) 0.5;
555 bx = ax + dx; 557 bx = ax + dx;
@@ -581,6 +583,7 @@ haiku_draw_text_decoration (struct glyph_string *s, struct face *face,
581 void *view = FRAME_HAIKU_VIEW (s->f); 583 void *view = FRAME_HAIKU_VIEW (s->f);
582 BView_draw_lock (view); 584 BView_draw_lock (view);
583 BView_StartClip (view); 585 BView_StartClip (view);
586 haiku_clip_to_string (s);
584 587
585 if (face->underline) 588 if (face->underline)
586 { 589 {
@@ -805,7 +808,6 @@ haiku_draw_plain_background (struct glyph_string *s, struct face *face,
805 int box_line_hwidth, int box_line_vwidth) 808 int box_line_hwidth, int box_line_vwidth)
806{ 809{
807 void *view = FRAME_HAIKU_VIEW (s->f); 810 void *view = FRAME_HAIKU_VIEW (s->f);
808 BView_StartClip (view);
809 if (s->hl == DRAW_CURSOR) 811 if (s->hl == DRAW_CURSOR)
810 BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel); 812 BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
811 else 813 else
@@ -817,7 +819,6 @@ haiku_draw_plain_background (struct glyph_string *s, struct face *face,
817 s->y + box_line_hwidth, 819 s->y + box_line_hwidth,
818 s->background_width, 820 s->background_width,
819 s->height - 2 * box_line_hwidth); 821 s->height - 2 * box_line_hwidth);
820 BView_EndClip (view);
821} 822}
822 823
823static void 824static void
@@ -893,7 +894,6 @@ haiku_draw_glyph_string_foreground (struct glyph_string *s)
893 894
894 if (s->font_not_found_p) 895 if (s->font_not_found_p)
895 { 896 {
896 BView_StartClip (view);
897 if (s->hl == DRAW_CURSOR) 897 if (s->hl == DRAW_CURSOR)
898 BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg); 898 BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
899 else 899 else
@@ -905,7 +905,6 @@ haiku_draw_glyph_string_foreground (struct glyph_string *s)
905 s->height); 905 s->height);
906 x += g->pixel_width; 906 x += g->pixel_width;
907 } 907 }
908 BView_EndClip (view);
909 } 908 }
910 else 909 else
911 { 910 {
@@ -996,13 +995,11 @@ haiku_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
996 s->ybase + glyph->slice.glyphless.lower_yoff, 995 s->ybase + glyph->slice.glyphless.lower_yoff,
997 false); 996 false);
998 } 997 }
999 BView_StartClip (FRAME_HAIKU_VIEW (s->f));
1000 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) 998 if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE)
1001 BView_FillRectangle (FRAME_HAIKU_VIEW (s->f), 999 BView_FillRectangle (FRAME_HAIKU_VIEW (s->f),
1002 x, s->ybase - glyph->ascent, 1000 x, s->ybase - glyph->ascent,
1003 glyph->pixel_width - 1, 1001 glyph->pixel_width - 1,
1004 glyph->ascent + glyph->descent - 1); 1002 glyph->ascent + glyph->descent - 1);
1005 BView_EndClip (FRAME_HAIKU_VIEW (s->f));
1006 x += glyph->pixel_width; 1003 x += glyph->pixel_width;
1007 } 1004 }
1008} 1005}
@@ -1044,10 +1041,8 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
1044 x -= width; 1041 x -= width;
1045 1042
1046 void *view = FRAME_HAIKU_VIEW (s->f); 1043 void *view = FRAME_HAIKU_VIEW (s->f);
1047 BView_StartClip (view);
1048 BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel); 1044 BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
1049 BView_FillRectangle (view, x, s->y, width, s->height); 1045 BView_FillRectangle (view, x, s->y, width, s->height);
1050 BView_EndClip (view);
1051 1046
1052 if (width < background_width) 1047 if (width < background_width)
1053 { 1048 {
@@ -1069,10 +1064,8 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
1069 else 1064 else
1070 bkg = face->background; 1065 bkg = face->background;
1071 1066
1072 BView_StartClip (view);
1073 BView_SetHighColor (view, bkg); 1067 BView_SetHighColor (view, bkg);
1074 BView_FillRectangle (view, x, y, w, h); 1068 BView_FillRectangle (view, x, y, w, h);
1075 BView_EndClip (view);
1076 } 1069 }
1077 } 1070 }
1078 } 1071 }
@@ -1093,7 +1086,6 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
1093 if (background_width > 0) 1086 if (background_width > 0)
1094 { 1087 {
1095 void *view = FRAME_HAIKU_VIEW (s->f); 1088 void *view = FRAME_HAIKU_VIEW (s->f);
1096 BView_StartClip (view);
1097 uint32_t bkg; 1089 uint32_t bkg;
1098 if (s->hl == DRAW_MOUSE_FACE) 1090 if (s->hl == DRAW_MOUSE_FACE)
1099 haiku_mouse_face_colors (s, NULL, &bkg); 1091 haiku_mouse_face_colors (s, NULL, &bkg);
@@ -1104,7 +1096,6 @@ haiku_draw_stretch_glyph_string (struct glyph_string *s)
1104 1096
1105 BView_SetHighColor (view, bkg); 1097 BView_SetHighColor (view, bkg);
1106 BView_FillRectangle (view, x, s->y, background_width, s->height); 1098 BView_FillRectangle (view, x, s->y, background_width, s->height);
1107 BView_EndClip (view);
1108 } 1099 }
1109 } 1100 }
1110 s->background_filled_p = 1; 1101 s->background_filled_p = 1;
@@ -1183,13 +1174,11 @@ haiku_draw_composite_glyph_string_foreground (struct glyph_string *s)
1183 1174
1184 if (s->font_not_found_p && !s->cmp_from) 1175 if (s->font_not_found_p && !s->cmp_from)
1185 { 1176 {
1186 BView_StartClip (view);
1187 if (s->hl == DRAW_CURSOR) 1177 if (s->hl == DRAW_CURSOR)
1188 BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg); 1178 BView_SetHighColor (view, FRAME_OUTPUT_DATA (s->f)->cursor_fg);
1189 else 1179 else
1190 BView_SetHighColor (view, s->face->foreground); 1180 BView_SetHighColor (view, s->face->foreground);
1191 BView_StrokeRectangle (view, s->x, s->y, s->width - 1, s->height - 1); 1181 BView_StrokeRectangle (view, s->x, s->y, s->width - 1, s->height - 1);
1192 BView_EndClip (view);
1193 } 1182 }
1194 else if (!s->first_glyph->u.cmp.automatic) 1183 else if (!s->first_glyph->u.cmp.automatic)
1195 { 1184 {
@@ -1379,12 +1368,8 @@ haiku_draw_image_glyph_string (struct glyph_string *s)
1379 1368
1380 s->stippled_p = face->stipple != 0; 1369 s->stippled_p = face->stipple != 0;
1381 1370
1382 BView_draw_lock (view);
1383 BView_StartClip (view);
1384 BView_SetHighColor (view, face->background); 1371 BView_SetHighColor (view, face->background);
1385 BView_FillRectangle (view, x, y, width, height); 1372 BView_FillRectangle (view, x, y, width, height);
1386 BView_EndClip (view);
1387 BView_draw_unlock (view);
1388 1373
1389 if (bitmap) 1374 if (bitmap)
1390 { 1375 {
@@ -1416,10 +1401,6 @@ haiku_draw_image_glyph_string (struct glyph_string *s)
1416 1401
1417 if (gui_intersect_rectangles (&cr, &ir, &r)) 1402 if (gui_intersect_rectangles (&cr, &ir, &r))
1418 { 1403 {
1419 BView_draw_lock (view);
1420 BView_StartClip (view);
1421
1422 haiku_clip_to_string (s);
1423 if (s->img->have_be_transforms_p) 1404 if (s->img->have_be_transforms_p)
1424 { 1405 {
1425 bitmap = BBitmap_transform_bitmap (bitmap, 1406 bitmap = BBitmap_transform_bitmap (bitmap,
@@ -1448,19 +1429,13 @@ haiku_draw_image_glyph_string (struct glyph_string *s)
1448 1429
1449 if (s->img->have_be_transforms_p) 1430 if (s->img->have_be_transforms_p)
1450 BBitmap_free (bitmap); 1431 BBitmap_free (bitmap);
1451 BView_EndClip (view);
1452 BView_draw_unlock (view);
1453 } 1432 }
1454 1433
1455 if (s->hl == DRAW_CURSOR) 1434 if (s->hl == DRAW_CURSOR)
1456 { 1435 {
1457 BView_draw_lock (view);
1458 BView_StartClip (view);
1459 BView_SetPenSize (view, 1); 1436 BView_SetPenSize (view, 1);
1460 BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel); 1437 BView_SetHighColor (view, FRAME_CURSOR_COLOR (s->f).pixel);
1461 BView_StrokeRectangle (view, r.x, r.y, r.width, r.height); 1438 BView_StrokeRectangle (view, r.x, r.y, r.width, r.height);
1462 BView_EndClip (view);
1463 BView_draw_unlock (view);
1464 } 1439 }
1465 } 1440 }
1466 1441