diff options
Diffstat (limited to 'src/Fl_Anim_GIF_Image.cxx')
| -rw-r--r-- | src/Fl_Anim_GIF_Image.cxx | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/Fl_Anim_GIF_Image.cxx b/src/Fl_Anim_GIF_Image.cxx index f026d4961..048c8c580 100644 --- a/src/Fl_Anim_GIF_Image.cxx +++ b/src/Fl_Anim_GIF_Image.cxx @@ -193,7 +193,8 @@ double Fl_Anim_GIF_Image::FrameInfo::convert_delay(int d) const { void Fl_Anim_GIF_Image::FrameInfo::copy(const FrameInfo& fi) { // copy from source - for (int i = 0; i < fi.frames_size; i++) { + int i; + for (i = 0; i < fi.frames_size; i++) { if (!push_back_frame(fi.frames[i])) { break; } @@ -245,7 +246,8 @@ void Fl_Anim_GIF_Image::FrameInfo::dispose(int frame) { else { if ( px + pw > canvas_w ) pw = canvas_w - px; if ( py + ph > canvas_h ) ph = canvas_h - py; - for (int y = 0; y < ph; y++) { + int y; + for (y = 0; y < ph; y++) { memcpy(dst + ( y + py ) * canvas_w * 4 + px, src + y * frames[prev].w * 4, pw * 4); } } @@ -346,8 +348,9 @@ void Fl_Anim_GIF_Image::FrameInfo::on_frame_data(Fl_GIF_Image::GIF_FRAME &gf) { // copy image data to offscreen const uchar *bits = gf.bptr; const uchar *endp = offscreen + canvas_w * canvas_h * 4; - for (int y = frame.y; y < frame.y + frame.h; y++) { - for (int x = frame.x; x < frame.x + frame.w; x++) { + int y, x; + for (y = frame.y; y < frame.y + frame.h; y++) { + for (x = frame.x; x < frame.x + frame.w; x++) { uchar c = *bits++; if (c == gf.trans) continue; @@ -366,8 +369,8 @@ void Fl_Anim_GIF_Image::FrameInfo::on_frame_data(Fl_GIF_Image::GIF_FRAME &gf) { if (optimize_mem) { uchar *buf = new uchar[frame.w * frame.h * 4]; uchar *dest = buf; - for (int y = frame.y; y < frame.y + frame.h; y++) { - for (int x = frame.x; x < frame.x + frame.w; x++) { + for (y = frame.y; y < frame.y + frame.h; y++) { + for (x = frame.x; x < frame.x + frame.w; x++) { if (offscreen + y * canvas_w * 4 + x * 4 < endp) memcpy(dest, &offscreen[y * canvas_w * 4 + x * 4], 4); dest += 4; @@ -403,7 +406,8 @@ bool Fl_Anim_GIF_Image::FrameInfo::push_back_frame(const GifFrame &frame) { void Fl_Anim_GIF_Image::FrameInfo::resize(int W, int H) { double scale_factor_x = (double)W / (double)canvas_w; double scale_factor_y = (double)H / (double)canvas_h; - for (int i=0; i < frames_size; i++) { + int i; + for (i =0; i < frames_size; i++) { if (optimize_mem) { frames[i].x = (unsigned short)round(frames[i].x * scale_factor_x); frames[i].y = (unsigned short)round(frames[i].y * scale_factor_y); @@ -449,7 +453,8 @@ void Fl_Anim_GIF_Image::FrameInfo::set_to_background(int frame) { bg = tp; color.alpha = tp == bg ? T_FULL : tp < 0 ? T_FULL : T_NONE; DEBUG((" set to color %d/%d/%d alpha=%d\n", color.r, color.g, color.b, color.alpha)); - for (uchar *p = offscreen + canvas_w * canvas_h * 4 - 4; p >= offscreen; p -= 4) + uchar *p; + for (p = offscreen + canvas_w * canvas_h * 4 - 4; p >= offscreen; p -= 4) memcpy(p, &color, 4); } @@ -712,7 +717,8 @@ void Fl_Anim_GIF_Image::color_average(Fl_Color c, float i) /* */ { if (i < 0) { // immediate mode i = -i; - for (int f=0; f < frames(); f++) { + int f; + for (f =0; f < frames(); f++) { fi_->frames[f].rgb->color_average(c, i); } return; @@ -817,7 +823,8 @@ void Fl_Anim_GIF_Image::draw(int x, int y, int w, int h, while (f0 > 0 && !(fi_->frames[f0].x == 0 && fi_->frames[f0].y == 0 && fi_->frames[f0].w == this->w() && fi_->frames[f0].h == this->h())) --f0; - for (int f = f0; f <= frame_; f++) { + int f; + for (f = f0; f <= frame_; f++) { if (f < frame_ && fi_->frames[f].dispose == FrameInfo::DISPOSE_PREVIOUS) continue; if (f < frame_ && fi_->frames[f].dispose == FrameInfo::DISPOSE_BACKGROUND) continue; Fl_RGB_Image *rgb = fi_->frames[f].rgb; @@ -1057,7 +1064,8 @@ bool Fl_Anim_GIF_Image::load(const char *name, const unsigned char *imgdata /* = // we have to replicate the actions of the pixmap destructor here uncache(); if (alloc_data) { - for (int i = 0; i < count(); i ++) delete[] (char *)data()[i]; + int i; + for (i = 0; i < count(); i ++) delete[] (char *)data()[i]; delete[] (char **)data(); } alloc_data = 0; @@ -1278,7 +1286,8 @@ bool Fl_Anim_GIF_Image::next() { */ void Fl_Anim_GIF_Image::uncache() /* */ { Fl_GIF_Image::uncache(); - for (int i=0; i < fi_->frames_size; i++) { + int i; + for (i =0; i < fi_->frames_size; i++) { if (fi_->frames[i].rgb) fi_->frames[i].rgb->uncache(); } } |
