s/MIN/min/, s/MAX/max/ (#2968)

This commit is contained in:
Adam Jackson 2009-06-03 13:37:32 -04:00
parent 7f027d9dc0
commit e1e8c7ddd7
6 changed files with 24 additions and 40 deletions

View File

@ -3935,10 +3935,6 @@ static int indexForScanlinePad[ 65 ] = {
3 /* 64 bits per scanline pad unit */ 3 /* 64 bits per scanline pad unit */
}; };
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* /*
grow the array of screenRecs if necessary. grow the array of screenRecs if necessary.
call the device-supplied initialization procedure call the device-supplied initialization procedure

View File

@ -31,9 +31,6 @@
# include "picturestr.h" # include "picturestr.h"
#endif #endif
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
static Bool ShadowCloseScreen (int i, ScreenPtr pScreen); static Bool ShadowCloseScreen (int i, ScreenPtr pScreen);
static void ShadowCopyWindow( static void ShadowCopyWindow(
WindowPtr pWin, WindowPtr pWin,
@ -1364,44 +1361,44 @@ ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y,
if (pFont->info.constantWidth) { if (pFont->info.constantWidth) {
int ascent, descent, left, right = 0; int ascent, descent, left, right = 0;
ascent = MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent); ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent);
descent = MAX(pFont->info.fontDescent, pFont->info.maxbounds.descent); descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent);
left = pFont->info.maxbounds.leftSideBearing; left = pFont->info.maxbounds.leftSideBearing;
if (count > 0) { if (count > 0) {
right = (count - 1) * pFont->info.maxbounds.characterWidth; right = (count - 1) * pFont->info.maxbounds.characterWidth;
} }
right += pFont->info.maxbounds.rightSideBearing; right += pFont->info.maxbounds.rightSideBearing;
BB->x1 = BB->x1 =
MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, max(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->x1); &((WindowPtr) pDrawable)->winSize))->x1);
BB->y1 = BB->y1 =
MAX(pDrawable->y + y - ascent, max(pDrawable->y + y - ascent,
(REGION_EXTENTS(pGC->pScreen, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->y1); &((WindowPtr) pDrawable)->winSize))->y1);
BB->x2 = BB->x2 =
MIN(pDrawable->x + x + right, min(pDrawable->x + x + right,
(REGION_EXTENTS(pGC->pScreen, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->x2); &((WindowPtr) pDrawable)->winSize))->x2);
BB->y2 = BB->y2 =
MIN(pDrawable->y + y + descent, min(pDrawable->y + y + descent,
(REGION_EXTENTS(pGC->pScreen, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->y2); &((WindowPtr) pDrawable)->winSize))->y2);
} else { } else {
ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0)
? Linear16Bit : TwoD16Bit : Linear8Bit, BB); ? Linear16Bit : TwoD16Bit : Linear8Bit, BB);
BB->x1 = BB->x1 =
MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, max(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->x1); &((WindowPtr) pDrawable)->winSize))->x1);
BB->y1 = BB->y1 =
MAX(pDrawable->y + y + BB->y1, max(pDrawable->y + y + BB->y1,
(REGION_EXTENTS(pGC->pScreen, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->y1); &((WindowPtr) pDrawable)->winSize))->y1);
BB->x2 = BB->x2 =
MIN(pDrawable->x + x + BB->x2, min(pDrawable->x + x + BB->x2,
(REGION_EXTENTS(pGC->pScreen, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->x2); &((WindowPtr) pDrawable)->winSize))->x2);
BB->y2 = BB->y2 =
MIN(pDrawable->y + y + BB->y2, min(pDrawable->y + y + BB->y2,
(REGION_EXTENTS(pGC->pScreen, (REGION_EXTENTS(pGC->pScreen,
&((WindowPtr) pDrawable)->winSize))->y2); &((WindowPtr) pDrawable)->winSize))->y2);
} }

View File

@ -39,14 +39,10 @@
#include <cursorstr.h> #include <cursorstr.h>
#include <mipointrst.h> #include <mipointrst.h>
#include <servermd.h> #include <servermd.h>
#include "misc.h"
extern Bool g_fSoftwareCursor; extern Bool g_fSoftwareCursor;
#ifndef MIN
#define MIN(x,y) ((x)<(y)?(x):(y))
#endif
#define BYTE_COUNT(x) (((x) + 7) / 8) #define BYTE_COUNT(x) (((x) + 7) / 8)
#define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114) #define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114)
@ -198,8 +194,8 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
nBytes = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy; nBytes = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy;
/* Get the effective width and height */ /* Get the effective width and height */
nCX = MIN(pScreenPriv->cursor.sm_cx, pCursor->bits->width); nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width);
nCY = MIN(pScreenPriv->cursor.sm_cy, pCursor->bits->height); nCY = min(pScreenPriv->cursor.sm_cy, pCursor->bits->height);
/* Allocate memory for the bitmaps */ /* Allocate memory for the bitmaps */
pAnd = malloc (nBytes); pAnd = malloc (nBytes);

View File

@ -109,8 +109,8 @@ RootlessResolveColormap (ScreenPtr pScreen, int first_color,
map = RootlessGetColormap (pScreen); map = RootlessGetColormap (pScreen);
if (map == NULL || map->class != PseudoColor) return FALSE; if (map == NULL || map->class != PseudoColor) return FALSE;
last = MIN (map->pVisual->ColormapEntries, first_color + n_colors); last = min (map->pVisual->ColormapEntries, first_color + n_colors);
for (i = MAX (0, first_color); i < last; i++) { for (i = max (0, first_color); i < last; i++) {
Entry *ent = map->red + i; Entry *ent = map->red + i;
uint16_t red, green, blue; uint16_t red, green, blue;

View File

@ -36,6 +36,7 @@
#ifndef _ROOTLESSCOMMON_H #ifndef _ROOTLESSCOMMON_H
#define _ROOTLESSCOMMON_H #define _ROOTLESSCOMMON_H
#include "misc.h"
#include "rootless.h" #include "rootless.h"
#include "fb.h" #include "fb.h"
@ -120,12 +121,6 @@ typedef struct _RootlessScreenRec {
unsigned int colormap_changed :1; unsigned int colormap_changed :1;
} RootlessScreenRec, *RootlessScreenPtr; } RootlessScreenRec, *RootlessScreenPtr;
#undef MIN
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
// "Definition of the Porting Layer for the X11 Sample Server" says // "Definition of the Porting Layer for the X11 Sample Server" says
// unwrap and rewrap of screen functions is unnecessary, but // unwrap and rewrap of screen functions is unnecessary, but
// screen->CreateGC changes after a call to cfbCreateGC. // screen->CreateGC changes after a call to cfbCreateGC.

View File

@ -200,10 +200,10 @@ RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
x1 = x0 + w; x1 = x0 + w;
y1 = y0 + h; y1 = y0 + h;
x0 = MAX (x0, winRec->x); x0 = max (x0, winRec->x);
y0 = MAX (y0, winRec->y); y0 = max (y0, winRec->y);
x1 = MIN (x1, winRec->x + winRec->width); x1 = min (x1, winRec->x + winRec->width);
y1 = MIN (y1, winRec->y + winRec->height); y1 = min (y1, winRec->y + winRec->height);
sx = x0 - pDrawable->x; sx = x0 - pDrawable->x;
sy = y0 - pDrawable->y; sy = y0 - pDrawable->y;
@ -347,10 +347,10 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
x2 = x1 + glyph->info.width; x2 = x1 + glyph->info.width;
y2 = y1 + glyph->info.height; y2 = y1 + glyph->info.height;
box.x1 = MAX (box.x1, x1); box.x1 = max (box.x1, x1);
box.y1 = MAX (box.y1, y1); box.y1 = max (box.y1, y1);
box.x2 = MAX (box.x2, x2); box.x2 = max (box.x2, x2);
box.y2 = MAX (box.y2, y2); box.y2 = max (box.y2, y2);
x += glyph->info.xOff; x += glyph->info.xOff;
y += glyph->info.yOff; y += glyph->info.yOff;