summaryrefslogtreecommitdiff
path: root/src/drivers/SVG
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/SVG')
-rw-r--r--src/drivers/SVG/Fl_SVG_File_Surface.cxx39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/drivers/SVG/Fl_SVG_File_Surface.cxx b/src/drivers/SVG/Fl_SVG_File_Surface.cxx
index 2a1439f74..5109dc9b4 100644
--- a/src/drivers/SVG/Fl_SVG_File_Surface.cxx
+++ b/src/drivers/SVG/Fl_SVG_File_Surface.cxx
@@ -232,7 +232,8 @@ void Fl_SVG_Graphics_Driver::compute_dasharray(float s, char *dashes) {
if (dasharray_) free(dasharray_);
int array_len = int(10*strlen(dashes) + 1);
dasharray_ = (char*)calloc(array_len, 1);
- for (char *p = dashes; *p; p++) {
+ char *p;
+ for (p = dashes; *p; p++) {
int c = snprintf(dasharray_+strlen(dasharray_), array_len, "%.3f,", (*p)/s);
array_len -= c;
}
@@ -283,7 +284,8 @@ void Fl_SVG_Graphics_Driver::draw(const char *str, int n, int x, int y) {
fprintf(out_, "<text x=\"%d\" y=\"%d\" font-family=\"%s\"%s%s font-size=\"%d\" "
"xml:space=\"preserve\" "
" fill=\"rgb(%u,%u,%u)\" textLength=\"%d\">", x, y, family_, bold_, style_, size(), red_, green_, blue_, (int)width(str, n));
- for (int i = 0; i < n; i++) {
+ int i;
+ for (i = 0; i < n; i++) {
if (str[i] == '&') fputs("&amp;", out_);
else if (str[i] == '<') fputs("&lt;", out_);
else if (str[i] == '>') fputs("&gt;", out_);
@@ -526,7 +528,8 @@ void Fl_SVG_Graphics_Driver::define_rgb_png(Fl_RGB_Image *rgb, const char *name,
png_set_IHDR(png_ptr, info_ptr, rgb->data_w(), rgb->data_h(), 8, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
const uchar **row_pointers = new const uchar*[rgb->data_h()];
int ld = rgb->ld() ? rgb->ld() : rgb->d() * rgb->data_w();
- for (int i=0; i < rgb->data_h(); i++) row_pointers[i] = (rgb->array + i*ld);
+ int i;
+ for (i =0; i < rgb->data_h(); i++) row_pointers[i] = (rgb->array + i*ld);
png_set_rows(png_ptr, info_ptr, (png_bytepp)row_pointers);
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
png_write_end(png_ptr, NULL);
@@ -683,12 +686,15 @@ void Fl_SVG_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP, int WP,
Fl_RGB_Image *rgb = new Fl_RGB_Image(data, bm->data_w(), bm->data_h(), 4);
rgb->alloc_array = 1;
int rowBytes = (bm->data_w()+7)>>3 ;
- for (int j = 0; j < bm->data_h(); j++) {
+ int j;
+ for (j = 0; j < bm->data_h(); j++) {
const uchar *p = bm->array + j*rowBytes;
- for (int i = 0; i < rowBytes; i++) {
+ int i;
+ for (i = 0; i < rowBytes; i++) {
uchar q = *p;
int last = bm->data_w() - 8*i; if (last > 8) last = 8;
- for (int k=0; k < last; k++) {
+ int k;
+ for (k =0; k < last; k++) {
if (q&1) {
uchar *r = (uchar*)rgb->array + j*bm->data_w()*4 + i*8*4 + k*4;
*r++ = R; *r++ = G; *r++ = B; *r = ~0;
@@ -729,7 +735,8 @@ void Fl_SVG_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, i
void Fl_SVG_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data, int x, int y, int w, int h, int d) {
uchar *buf = new uchar[w*h*d];
- for (int j = 0; j < h; j++) {
+ int j;
+ for (j = 0; j < h; j++) {
cb(data, 0, j, w, buf + j*w*d);
}
draw_image(buf, x, y, w, h, d, 0);
@@ -743,7 +750,8 @@ struct mono_image_data {
};
static void mono_image_cb(mono_image_data* data, int x, int y, int w, uchar* buf) {
- for (int i = 0; i < w; i++)
+ int i;
+ for (i = 0; i < w; i++)
*buf++ = *(data->buf + y*data->l + (x++)*data->d);
}
@@ -755,7 +763,8 @@ void Fl_SVG_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int
void Fl_SVG_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int x, int y, int w, int h, int d) {
uchar *buf = new uchar[w*h*d];
- for (int j = 0; j < h; j++) {
+ int j;
+ for (j = 0; j < h; j++) {
cb(data, 0, j, w, buf + j*w*d);
}
draw_image_mono(buf, x, y, w, h, d, 0);
@@ -879,7 +888,8 @@ void Fl_SVG_Graphics_Driver::loop(int x0, int y0, int x1, int y1, int x2, int y2
}
void Fl_SVG_Graphics_Driver::end_points() {
- for (int i=0; i<n; i++) {
+ int i;
+ for (i =0; i<n; i++) {
clocale_printf("<path d=\"M %f %f L %f %f\" fill=\"none\" stroke=\"rgb(%u,%u,%u)\" stroke-width=\"%d\" />\n",
xpoint[i].x, xpoint[i].y, xpoint[i].x, xpoint[i].y, red_, green_, blue_, width_);
}
@@ -892,7 +902,8 @@ void Fl_SVG_Graphics_Driver::end_line() {
}
if (n<=1) return;
clocale_printf("<path d=\"M %f %f", xpoint[0].x, xpoint[0].y);
- for (int i=1; i<n; i++)
+ int i;
+ for (i =1; i<n; i++)
clocale_printf(" L %f %f", xpoint[i].x, xpoint[i].y);
fprintf(out_, "\" fill=\"none\" stroke=\"rgb(%u,%u,%u)\" stroke-width=\"%d\" stroke-dasharray=\"%s\" stroke-linecap=\"%s\" stroke-linejoin=\"%s\" />\n",
red_, green_, blue_, width_, dasharray_, linecap_, linejoin_);
@@ -906,7 +917,8 @@ void Fl_SVG_Graphics_Driver::end_polygon() {
}
if (n<=1) return;
clocale_printf("<path d=\"M %f %f", xpoint[0].x, xpoint[0].y);
- for (int i=1; i<n; i++)
+ int i;
+ for (i =1; i<n; i++)
clocale_printf(" L %f %f", xpoint[i].x, xpoint[i].y);
fprintf(out_, " z\" fill=\"rgb(%u,%u,%u)\" />\n", red_, green_, blue_);
}
@@ -936,7 +948,8 @@ void Fl_SVG_Graphics_Driver::end_complex_polygon() {
}
if (n<=1) return;
clocale_printf("<path d=\"M %f %f", xpoint[0].x, xpoint[0].y);
- for (int i=1; i<n; i++)
+ int i;
+ for (i =1; i<n; i++)
clocale_printf(" L %f %f", xpoint[i].x, xpoint[i].y);
fprintf(out_, " z\" fill=\"rgb(%u,%u,%u)\" />\n", red_, green_, blue_);
}