summaryrefslogtreecommitdiff
path: root/src/drivers/Xlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/Xlib')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx6
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx6
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx21
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx15
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx18
5 files changed, 43 insertions, 23 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
index 336e4b429..1fa277520 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
@@ -128,7 +128,8 @@ void Fl_Xlib_Graphics_Driver::font_name(int num, const char *name) {
#if !USE_XFT
if (s->xlist && s->n >= 0) XFreeFontNames(s->xlist);
#endif
- for (Fl_Font_Descriptor* f = s->first; f;) {
+ Fl_Font_Descriptor *f;
+ for (f = s->first; f;) {
Fl_Font_Descriptor* n = f->next; delete f; f = n;
}
s->first = 0;
@@ -146,7 +147,8 @@ Fl_Region Fl_Xlib_Graphics_Driver::scale_clip(float f) {
Region r = (Region)rstack[rstackptr];
if (r == 0 || (f == 1 && offset_x_ == 0 && offset_y_ == 0) ) return 0;
Region r2 = XCreateRegion();
- for (int i = 0; i < r->numRects; i++) {
+ int i;
+ for (i = 0; i < r->numRects; i++) {
int x = floor(r->rects[i].x1 + offset_x_, f);
int y = floor(r->rects[i].y1 + offset_y_, f);
int w = floor((r->rects[i].x2 + offset_x_) , f) - x;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
index b6297da61..236734d90 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
@@ -232,14 +232,16 @@ ulong fl_xpixel(Fl_Color i) {
// the colormap after this and make decisions here wrong.
numcolors = fl_visual->colormap_size;
if (!allcolors) allcolors = new XColor[numcolors];
- for (int p = numcolors; p--;) allcolors[p].pixel = p;
+ int p;
+ for (p = numcolors; p--;) allcolors[p].pixel = p;
XQueryColors(fl_display, colormap, allcolors, numcolors);
}
// find least-squares match:
int mindist = 0x7FFFFFFF;
unsigned int bestmatch = 0;
- for (unsigned int n = numcolors; n--;) {
+ unsigned int n;
+ for (n = numcolors; n--;) {
XColor &a = allcolors[n];
int d, t;
t = int(r)-int(a.red>>8); d = t*t;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx
index 8ba7fb908..176a388ae 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx
@@ -159,7 +159,8 @@ const char* Fl_Xlib_Graphics_Driver::get_font_name(Fl_Font fnum, int* ap) {
}
// collect all the attribute words:
- for (int n = 3; n <= 6; n++) {
+ int n;
+ for (n = 3; n <= 6; n++) {
// get the next word:
if (*e) e++;
x = e;
@@ -228,7 +229,8 @@ static int ultrasort(const void *aa, const void *bb) {
// compare the family and all the attribute words:
int atype = 0;
int btype = 0;
- for (int n = 2; n <= 6; n++) {
+ int n;
+ for (n = 2; n <= 6; n++) {
int at = attribute(n,a);
int bt = attribute(n,b);
if (at < 0) {
@@ -308,7 +310,8 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* xstarname) {
if (!xlist) return (Fl_Font)fl_free_font;
qsort(xlist, xlistsize, sizeof(*xlist), ultrasort);
int used_xlist = 0;
- for (int i=0; i<xlistsize;) {
+ int i;
+ for (i =0; i<xlistsize;) {
int first_xlist = i;
const char *p = xlist[i++];
char canon[1024];
@@ -359,7 +362,8 @@ int Fl_Xlib_Graphics_Driver::get_font_sizes(Fl_Font fnum, int*& sizep) {
int listsize = s->n; if (listsize<0) listsize = -listsize;
static int sizes[128];
int numsizes = 0;
- for (int i = 0; i < listsize; i++) {
+ int i;
+ for (i = 0; i < listsize; i++) {
char *q = s->xlist[i];
char *d = fl_find_fontsize(q);
if (!d) continue;
@@ -371,7 +375,8 @@ int Fl_Xlib_Graphics_Driver::get_font_sizes(Fl_Font fnum, int*& sizep) {
int n;
for (n = numsizes-1; n > 0; n--) if (sizes[n-1] < s) break;
if (sizes[n] != s) {
- for (int m = numsizes; m > n; m--) sizes[m] = sizes[m-1];
+ int m;
+ for (m = numsizes; m > n; m--) sizes[m] = sizes[m-1];
sizes[n] = s;
numsizes++;
}
@@ -392,7 +397,8 @@ Fl_Xlib_Font_Descriptor::Fl_Xlib_Font_Descriptor(const char* name) : Fl_Font_Des
}
# if HAVE_GL
listbase = 0;
- for (int u = 0; u < 64; u++) glok[u] = 0;
+ int u;
+ for (u = 0; u < 64; u++) glok[u] = 0;
# endif
}
@@ -464,7 +470,8 @@ static const char *find_best_font(const char *fname, int size) {
int matchedlength = 32767;
int found_encoding = 0;
int m = cnt; if (m<0) m = -m;
- for (int n=0; n < m; n++) {
+ int n;
+ for (n =0; n < m; n++) {
char* thisname = list[n];
if (fl_correct_encoding(thisname)) {
if (!found_encoding) ptsize = 0; // force it to choose this
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
index a7537a184..92b0e0ef6 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
@@ -489,7 +489,8 @@ static XftFont* fontopen(const char* name, /*Fl_Fontsize*/double size, bool core
int comma_count = 0;
unsigned len = strlen(name);
if (len > 512) len = 512; // ensure we are not passed an unbounded font name
- for(unsigned idx = 0; idx < len; idx++) {
+ unsigned idx;
+ for (idx = 0; idx < len; idx++) {
if(name[idx] == '-') hyphen_count++; // check for XLFD hyphens
if(name[idx] == ',') comma_count++; // are there multiple names?
}
@@ -897,7 +898,8 @@ int Fl_Xlib_Graphics_Driver::get_font_sizes(Fl_Font fnum, int*& sizep) {
array = new int[array_size = fs->nfont+1];
}
array[0] = 0; int j = 1; // claim all fonts are scalable
- for (int i = 0; i < fs->nfont; i++) {
+ int i;
+ for (i = 0; i < fs->nfont; i++) {
double v;
if (XftPatternGetDouble(fs->fonts[i], XFT_PIXEL_SIZE, 0, &v) == XftResultMatch) {
array[j++] = int(v);
@@ -1309,7 +1311,8 @@ double Fl_Xlib_Graphics_Driver::width_unscaled(unsigned int utf32) {
}
if (!desc->width[r]) {
desc->width[r] = (int*)new int[0x0400];
- for (int i = 0; i < 0x0400; i++) desc->width[r][i] = -1;
+ int i;
+ for (i = 0; i < 0x0400; i++) desc->width[r][i] = -1;
} else {
if ( desc->width[r][utf32&0x03FF] >= 0 ) { // already cached
return double(desc->width[r][utf32 & 0x03FF]);
@@ -1412,13 +1415,15 @@ Fl_Font Fl_Xlib_Graphics_Driver::set_fonts(const char* pattern_name)
Fl_Xlib_Graphics_Driver::context();
Fl_Xlib_Graphics_Driver::init_built_in_fonts();
pango_font_map_list_families(Fl_Xlib_Graphics_Driver::pfmap_, &families, &n_families);
- for (int fam = 0; fam < n_families; fam++) {
+ int fam;
+ for (fam = 0; fam < n_families; fam++) {
PangoFontFace **faces;
int n_faces;
const char *fam_name = pango_font_family_get_name (families[fam]);
int lfam = strlen(fam_name);
pango_font_family_list_faces(families[fam], &faces, &n_faces);
- for (int j = 0; j < n_faces; j++) {
+ int j;
+ for (j = 0; j < n_faces; j++) {
const char *p = pango_font_face_get_face_name(faces[j]);
// Remove " Regular" suffix from font names
if (!strcasecmp(p, "regular")) p = NULL;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
index 5dafe503f..6c13f643f 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
@@ -544,7 +544,8 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
xi.bytes_per_line = linesize*sizeof(STORETYPE);
if (buf) {
buf += delta*dx+linedelta*dy;
- for (int j=0; j<h; ) {
+ int j;
+ for (j =0; j<h; ) {
STORETYPE *to = buffer;
int k;
for (k = 0; j<h && k<blocking; k++, j++) {
@@ -556,7 +557,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
} else {
STORETYPE* linebuf = new STORETYPE[(W*delta+(sizeof(STORETYPE)-1))/sizeof(STORETYPE)];
- for (int j=0; j<h; ) {
+ for (j =0; j<h; ) {
STORETYPE *to = buffer;
int k;
for (k = 0; j<h && k<blocking; k++, j++) {
@@ -676,8 +677,10 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
if (img->d() == 2) {
// Composite grayscale + alpha over RGB...
- for (int y = H; y > 0; y--, srcptr+=srcskip)
- for (int x = W; x > 0; x--) {
+ int y;
+ for (y = H; y > 0; y--, srcptr+=srcskip)
+ int x;
+ for (x = W; x > 0; x--) {
srcg = *srcptr++;
srca = *srcptr++;
if (srca == 255) { // special case "copy"
@@ -700,8 +703,8 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
}
} else {
// Composite RGBA over RGB...
- for (int y = H; y > 0; y--, srcptr+=srcskip)
- for (int x = W; x > 0; x--) {
+ for (y = H; y > 0; y--, srcptr+=srcskip)
+ for (x = W; x > 0; x--) {
srcr = *srcptr++;
srcg = *srcptr++;
srcb = *srcptr++;
@@ -901,7 +904,8 @@ void Fl_Xlib_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, in
Region r = (Region)XRectangleRegion(X,Y,W,H);
XIntersectRegion(r, (Region)clip_region(), r);
int X1, Y1, W1, H1;
- for (int i = 0; i < r->numRects; i++) {
+ int i;
+ for (i = 0; i < r->numRects; i++) {
X1 = r->rects[i].x1;
Y1 = r->rects[i].y1;
W1 = r->rects[i].x2 - r->rects[i].x1;