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,9 +210,13 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
int r; int r;
tim = ecore_x_image_new(w, h, im->vis, im->depth); tim = ecore_x_image_new(w, h, im->vis, im->depth);
if (tim)
{
ecore_x_image_get(tim, draw, x, y, 0, 0, w, h); ecore_x_image_get(tim, draw, x, y, 0, 0, w, h);
spixels = ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp); spixels = ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp);
pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp); pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
if ((pixels) && (spixels))
{
p = pixels + (sy * bpl) + (sx * bpp); p = pixels + (sy * bpl) + (sx * bpp);
sp = spixels; sp = spixels;
for (r = srows; r > 0; r--) for (r = srows; r > 0; r--)
@ -221,9 +225,11 @@ ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
p += bpl; p += bpl;
sp += sbpl; sp += sbpl;
} }
}
ecore_x_image_free(tim); ecore_x_image_free(tim);
} }
} }
}
else else
{ {
printf("currently unimplemented ecore_x_image_get without shm\n"); printf("currently unimplemented ecore_x_image_get without shm\n");