some safety to avoid possible segv's

SVN revision: 44996
This commit is contained in:
Carsten Haitzler 2010-01-08 23:27:15 +00:00
parent ecb57ac1b8
commit fcf3c4d73e
1 changed files with 16 additions and 10 deletions

View File

@ -210,18 +210,24 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
int r;
tim = ecore_x_image_new(w, h, im->vis, im->depth);
ecore_x_image_get(tim, draw, x, y, 0, 0, w, h);
spixels = ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp);
pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
p = pixels + (sy * bpl) + (sx * bpp);
sp = spixels;
for (r = srows; r > 0; r--)
if (tim)
{
memcpy(p, sp, sbpl);
p += bpl;
sp += sbpl;
ecore_x_image_get(tim, draw, x, y, 0, 0, w, h);
spixels = ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp);
pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
if ((pixels) && (spixels))
{
p = pixels + (sy * bpl) + (sx * bpp);
sp = spixels;
for (r = srows; r > 0; r--)
{
memcpy(p, sp, sbpl);
p += bpl;
sp += sbpl;
}
}
ecore_x_image_free(tim);
}
ecore_x_image_free(tim);
}
}
else