forked from old/legacy-imlib2
multiframe: Centralize handling of frame update offsets
This commit is contained in:
parent
6df68e3e2e
commit
b1bbe1d9e8
|
@ -729,6 +729,9 @@ __imlib_LoadProgress(ImlibImage * im, int x, int y, int w, int h)
|
||||||
lc->area += w * h;
|
lc->area += w * h;
|
||||||
lc->pct = (100. * lc->area + .1) / (im->w * im->h);
|
lc->pct = (100. * lc->area + .1) / (im->w * im->h);
|
||||||
|
|
||||||
|
x += im->frame_x;
|
||||||
|
y += im->frame_y;
|
||||||
|
|
||||||
rc = !lc->progress(im, lc->pct, x, y, w, h);
|
rc = !lc->progress(im, lc->pct, x, y, w, h);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -738,6 +741,7 @@ __EXPORT__ int
|
||||||
__imlib_LoadProgressRows(ImlibImage * im, int row, int nrows)
|
__imlib_LoadProgressRows(ImlibImage * im, int row, int nrows)
|
||||||
{
|
{
|
||||||
ImlibLdCtx *lc = im->lc;
|
ImlibLdCtx *lc = im->lc;
|
||||||
|
int col = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int pct, nrtot;
|
int pct, nrtot;
|
||||||
|
|
||||||
|
@ -758,7 +762,9 @@ __imlib_LoadProgressRows(ImlibImage * im, int row, int nrows)
|
||||||
pct = (100 * nrtot * (lc->pass + 1)) / (im->h * lc->n_pass);
|
pct = (100 * nrtot * (lc->pass + 1)) / (im->h * lc->n_pass);
|
||||||
if (pct == 100 || pct >= lc->pct + lc->granularity)
|
if (pct == 100 || pct >= lc->pct + lc->granularity)
|
||||||
{
|
{
|
||||||
rc = !lc->progress(im, pct, 0, row, im->w, nrows);
|
col += im->frame_x;
|
||||||
|
row += im->frame_y;
|
||||||
|
rc = !lc->progress(im, pct, col, row, im->w, nrows);
|
||||||
lc->row = nrtot;
|
lc->row = nrtot;
|
||||||
lc->pct += lc->granularity;
|
lc->pct += lc->granularity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ _load(ImlibImage * im, int load_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiframe && im->lc)
|
if (multiframe && im->lc)
|
||||||
__imlib_LoadProgress(im, im->frame_x, im->frame_y, im->w, im->h);
|
__imlib_LoadProgress(im, 0, 0, im->w, im->h);
|
||||||
|
|
||||||
rc = LOAD_SUCCESS;
|
rc = LOAD_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ row_callback(png_struct * png_ptr, png_byte * new_row,
|
||||||
|
|
||||||
done = pass >= 6 && (int)row_num >= PNG_PASS_ROWS(im->h, pass) - 1;
|
done = pass >= 6 && (int)row_num >= PNG_PASS_ROWS(im->h, pass) - 1;
|
||||||
if (im->lc && done)
|
if (im->lc && done)
|
||||||
__imlib_LoadProgress(im, im->frame_x, im->frame_y, im->w, im->h);
|
__imlib_LoadProgress(im, 0, 0, im->w, im->h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -277,9 +277,9 @@ row_callback(png_struct * png_ptr, png_byte * new_row,
|
||||||
if (im->frame_count > 1)
|
if (im->frame_count > 1)
|
||||||
{
|
{
|
||||||
if (done)
|
if (done)
|
||||||
__imlib_LoadProgress(im, im->frame_x, im->frame_y, im->w,
|
__imlib_LoadProgress(im, 0, 0, im->w, im->h);
|
||||||
im->h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (__imlib_LoadProgressRows(im, y, 1))
|
else if (__imlib_LoadProgressRows(im, y, 1))
|
||||||
{
|
{
|
||||||
png_process_data_pause(png_ptr, 0);
|
png_process_data_pause(png_ptr, 0);
|
||||||
|
|
|
@ -93,7 +93,7 @@ _load(ImlibImage * im, int load_data)
|
||||||
goto quit;
|
goto quit;
|
||||||
|
|
||||||
if (im->lc)
|
if (im->lc)
|
||||||
__imlib_LoadProgress(im, im->frame_x, im->frame_y, im->w, im->h);
|
__imlib_LoadProgress(im, 0, 0, im->w, im->h);
|
||||||
|
|
||||||
rc = LOAD_SUCCESS;
|
rc = LOAD_SUCCESS;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue