Mercurial > emacs
comparison src/xfns.c @ 40606:d590ec395dcd
(four_corners_best): Reindent.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 01 Nov 2001 10:38:27 +0000 |
parents | e564ab2ef09f |
children | 134b236ad704 |
comparison
equal
deleted
inserted
replaced
40605:9c8c502c1713 | 40606:d590ec395dcd |
---|---|
5776 static unsigned long | 5776 static unsigned long |
5777 four_corners_best (ximg, width, height) | 5777 four_corners_best (ximg, width, height) |
5778 XImage *ximg; | 5778 XImage *ximg; |
5779 unsigned long width, height; | 5779 unsigned long width, height; |
5780 { | 5780 { |
5781 unsigned long corners[4], best; | 5781 unsigned long corners[4], best; |
5782 int i, best_count; | 5782 int i, best_count; |
5783 | 5783 |
5784 /* Get the colors at the corners of ximg. */ | 5784 /* Get the colors at the corners of ximg. */ |
5785 corners[0] = XGetPixel (ximg, 0, 0); | 5785 corners[0] = XGetPixel (ximg, 0, 0); |
5786 corners[1] = XGetPixel (ximg, width - 1, 0); | 5786 corners[1] = XGetPixel (ximg, width - 1, 0); |
5787 corners[2] = XGetPixel (ximg, width - 1, height - 1); | 5787 corners[2] = XGetPixel (ximg, width - 1, height - 1); |
5788 corners[3] = XGetPixel (ximg, 0, height - 1); | 5788 corners[3] = XGetPixel (ximg, 0, height - 1); |
5789 | 5789 |
5790 /* Choose the most frequently found color as background. */ | 5790 /* Choose the most frequently found color as background. */ |
5791 for (i = best_count = 0; i < 4; ++i) | 5791 for (i = best_count = 0; i < 4; ++i) |
5792 { | 5792 { |
5793 int j, n; | 5793 int j, n; |
5794 | 5794 |
5795 for (j = n = 0; j < 4; ++j) | 5795 for (j = n = 0; j < 4; ++j) |
5796 if (corners[i] == corners[j]) | 5796 if (corners[i] == corners[j]) |
5797 ++n; | 5797 ++n; |
5798 | 5798 |
5799 if (n > best_count) | 5799 if (n > best_count) |
5800 best = corners[i], best_count = n; | 5800 best = corners[i], best_count = n; |
5801 } | 5801 } |
5802 | 5802 |
5803 return best; | 5803 return best; |
5804 } | 5804 } |
5805 | 5805 |
5806 /* Return the `background' field of IMG. If IMG doesn't have one yet, | 5806 /* Return the `background' field of IMG. If IMG doesn't have one yet, |
5807 it is guessed heuristically. If non-zero, XIMG is an existing XImage | 5807 it is guessed heuristically. If non-zero, XIMG is an existing XImage |
5808 object to use for the heuristic. */ | 5808 object to use for the heuristic. */ |