Joel Pilon(deleted)
|
Re: Who is responsible for alloc mem for access.direct.data?
|
Joel Pilon(deleted)
05/26/2011 5:23 PM
post86178
|
Re: Who is responsible for alloc mem for access.direct.data?
It been a long time, but i'm pretty sure the lib will allocate the memory, however I think you're responsible for
freeing it.
----- Original Message -----
From: Reza Salehi [mailto:community-noreply@qnx.com]
Sent: Thursday, May 26, 2011 05:21 PM
To: advanced-graphics <post86177@community.qnx.com>
Subject: Who is responsible for alloc mem for access.direct.data?
Hi All,
I am having a problem with setting img.flags |= IMG_DIRECT. Who is responsible for alloc memory for acess.direct.data?
Is it the user or does the img_load_file() allocates memeory when the user sets the IMG_DIRECT flag. I have been
spinning why wheels on this. I am trying to grab the acess.direct.data pointer after loading a png file, but my system
hangs everytime I set the IMG_DIRECT flag.
Thanks,
Reza.
_______________________________________________
Advanced Graphics
http://community.qnx.com/sf/go/post86177
|
|
|
Reza Salehi
|
Re: Who is responsible for alloc mem for access.direct.data?
|
Reza Salehi
05/26/2011 5:59 PM
post86180
|
Re: Who is responsible for alloc mem for access.direct.data?
Hi Joel,
Thanks for answering. I though the same. However, I wrote a small code and it seems like data is NULL before and after
img_load_file() call! The function returns OK so the image does get loaded (somewhere), but the point is still data
pointer is still NULL. So, when I try to use this pointer to attach it to a gf surface, the system hangs.
img.flags = 0;
img.flags |= IMG_DIRECT;
printf("data before load %p \n",img.access.direct.data);
if ((rc = img_load_file(ilib, "/tmp/n_day_r.png", NULL, &img)) != IMG_ERR_OK) {
fprintf(stderr, "img_load_file(%s) failed: %d\n", "/tmp/n_day_r.png", rc);
return -1;
}
else
{
fprintf(stderr, "img_load_file(%s) sucess : %d\n", "/tmp/n_day_r.png", rc);
fprintf(stdout, "img is %dx%dx%d\n", img.w, img.h, IMG_FMT_BPP(img.format));
}
printf("data after load %d \n",img.access.direct.data);
|
|
|