glx: indent -br -i3 -npcs --no-tabs xfont.c

This commit is contained in:
RALOVICH, Kristóf 2008-10-13 15:04:31 +02:00 committed by Alan Hourihane
parent b57e9f2a74
commit 1bb4658fab
1 changed files with 192 additions and 191 deletions

View File

@ -64,16 +64,14 @@ dump_font_struct (XFontStruct *font)
printf("char_or_byte2 = (%u,%u)\n",
font->min_char_or_byte2, font->max_char_or_byte2);
printf("byte1 = (%u,%u)\n", font->min_byte1, font->max_byte1);
printf ("all_chars_exist = %s\n", font->all_chars_exist ? "True" :
"False");
printf("all_chars_exist = %s\n", font->all_chars_exist ? "True" : "False");
printf("default_char = %c (\\%03o)\n",
(char) (isprint(font->default_char) ? font->default_char : ' '),
font->default_char);
dump_char_struct(&font->min_bounds, "min> ");
dump_char_struct(&font->max_bounds, "max> ");
#if 0
for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++)
{
for (c = font->min_char_or_byte2; c <= font->max_char_or_byte2; c++) {
char prefix[8];
sprintf(prefix, "%d> ", c);
dump_char_struct(&font->per_char[c], prefix);
@ -90,8 +88,7 @@ dump_bitmap (unsigned int width, unsigned int height, GLubyte *bitmap)
for (x = 0; x < 8 * width; x++)
printf("%o", 7 - (x % 8));
putchar('\n');
for (y = 0; y < height; y++)
{
for (y = 0; y < height; y++) {
printf("%3o:", y);
for (x = 0; x < 8 * width; x++)
putchar((bitmap[width * (height - y - 1) + x / 8] & (1 << (7 - (x %
@ -158,7 +155,8 @@ fill_bitmap (Display *dpy, Window win, GC gc,
for (y = 0; y < height; y++)
for (x = 0; x < 8 * width; x++)
if (XGetPixel(image, x, y))
bitmap[width*(height - y - 1) + x/8] |= (1 << (7 - (x % 8)));
bitmap[width * (height - y - 1) + x / 8] |=
(1 << (7 - (x % 8)));
XDestroyImage(image);
}
@ -169,7 +167,8 @@ fill_bitmap (Display *dpy, Window win, GC gc,
* determine if a given glyph is valid and return the
* corresponding XCharStruct.
*/
static XCharStruct *isvalid(XFontStruct *fs, int which)
static XCharStruct *
isvalid(XFontStruct * fs, int which)
{
unsigned int rows, pages;
int byte1 = 0, byte2 = 0;
@ -180,16 +179,17 @@ static XCharStruct *isvalid(XFontStruct *fs, int which)
if (rows == 1) {
/* "linear" fonts */
if ((fs->min_char_or_byte2 > which) ||
(fs->max_char_or_byte2 < which)) valid = 0;
} else {
if ((fs->min_char_or_byte2 > which) || (fs->max_char_or_byte2 < which))
valid = 0;
}
else {
/* "matrix" fonts */
byte2 = which & 0xff;
byte1 = which >> 8;
if ((fs->min_char_or_byte2 > byte2) ||
(fs->max_char_or_byte2 < byte2) ||
(fs->min_byte1 > byte1) ||
(fs->max_byte1 < byte1)) valid = 0;
(fs->min_byte1 > byte1) || (fs->max_byte1 < byte1))
valid = 0;
}
if (valid) {
@ -197,20 +197,23 @@ static XCharStruct *isvalid(XFontStruct *fs, int which)
if (rows == 1) {
/* "linear" fonts */
return (fs->per_char + (which - fs->min_char_or_byte2));
} else {
}
else {
/* "matrix" fonts */
i = ((byte1 - fs->min_byte1) * pages) +
(byte2 - fs->min_char_or_byte2);
return (fs->per_char + i);
}
} else {
}
else {
return (&fs->min_bounds);
}
}
return (NULL);
}
_X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
_X_HIDDEN void
DRI_glXUseXFont(Font font, int first, int count, int listbase)
{
GLXContext CC;
Display *dpy;
@ -234,8 +237,7 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
win = CC->currentDrawable;
fs = XQueryFont(dpy, font);
if (!fs)
{
if (!fs) {
__glXSetError(CC, GL_INVALID_VALUE);
return;
}
@ -246,8 +248,7 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
max_bm_width = (max_width + 7) / 8;
max_bm_height = max_height;
bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof
(GLubyte));
bm = (GLubyte *) Xmalloc((max_bm_width * max_bm_height) * sizeof(GLubyte));
if (!bm) {
XFreeFontInfo(NULL, fs, 1);
__glXSetError(CC, GL_OUT_OF_MEMORY);
@ -294,8 +295,7 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
dump_font_struct(fs);
#endif
for (i = 0; i < count; i++)
{
for (i = 0; i < count; i++) {
unsigned int width, height, bm_width, bm_height;
GLfloat x0, y0, dx, dy;
XCharStruct *ch;
@ -309,7 +309,8 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
if (!ch) {
ch = &fs->max_bounds;
valid = 0;
} else {
}
else {
valid = 1;
}
@ -350,12 +351,12 @@ _X_HIDDEN void DRI_glXUseXFont( Font font, int first, int count, int listbase )
#ifdef DEBUG
if (debug_xfonts) {
printf("width/height = %u/%u\n", width, height);
printf ("bm_width/bm_height = %u/%u\n", bm_width,
bm_height);
printf("bm_width/bm_height = %u/%u\n", bm_width, bm_height);
dump_bitmap(bm_width, bm_height, bm);
}
#endif
} else {
}
else {
glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL);
}
glEndList();