Hi Cedric and all others.
I have attached a minimal test case that shows the same behaviour as
our application code. The image size is set once, but the second time
(if there has been a rendering in between) the assertion error occurs
if the new size differs from the old. We are not, as Carsten Haitzler
asked, calling evas_object_image_size_set() from inside the get_pixels
callback. Perhaps there are some other restrictions on when it is
allowed to change the image size?
/Mats
On Wed, Jun 4, 2008 at 5:09 PM, Cedric BAIL <[EMAIL PROTECTED]> wrote:
>> [...] when we resize it, we get the following assertion
>> error:
>>
>> evas-0.9.9.041/src/lib/cache/evas_cache_image.c:488:
>> evas_cache_image_size_set: Assertion `im->references > 0' failed.
>>
>> This does not happen the first time we set the image size, but as we
>> want the bitmap to exactly match the size of the displayed area, we
>> need to resize the buffer as the displayed area changes. Any ideas?
>
> Sounds like a cache bug, do you have some test case for this that you
> could send to me ?
>
#include <Ecore_Evas.h>
#include <Ecore.h>
#include <stdlib.h>
#include <stdio.h>
#define WIDTH 400
#define HEIGHT 400
Ecore_Evas *ee;
Evas *evas;
Evas_Object *base_rect;
#define BUFWIDTH 10
#define BUFHEIGHT 10
int pixels[BUFWIDTH*BUFHEIGHT]; // our buffer for the image
static void _pixels_get(void* _data, Evas_Object* obj)
{
evas_object_image_data_set(obj, pixels);
}
static void draw_to_buffer(){
// Just make the area blue
for(int i=0; i<BUFWIDTH*BUFHEIGHT; i++){
pixels[i] = 0xFF0000FF;
}
}
int main(){
ecore_init();
ecore_evas_init();
ee = ecore_evas_software_x11_new(0, 0, 0, 0, WIDTH, HEIGHT);
ecore_evas_title_set(ee, "Ecore_Evas Template");
ecore_evas_show(ee);
evas = ecore_evas_get(ee);
draw_to_buffer();
Evas_Object* image_obj = evas_object_image_add(evas);
unsigned int *pixel = (unsigned int*) evas_object_image_data_get(image_obj, 1);
evas_object_image_pixels_get_callback_set(image_obj, _pixels_get, (void*) 1);
evas_object_resize(image_obj, 100, 100);
evas_object_move(image_obj, 20, 20);
int x, y, w, h;
evas_object_geometry_get(image_obj, &x, &y, &w, &h);
evas_object_image_fill_set(image_obj, 0, 0, w, h);
// The first call to evas_object_image_size_set() - no problems
//
evas_object_image_size_set(image_obj, BUFWIDTH, BUFHEIGHT);
evas_object_image_pixels_dirty_set(image_obj, 1);
evas_object_show(image_obj);
// There must be at least one render pass between the calls to
// evas_object_image_size_set() to provoke the problem.
//
evas_render(evas);
// Below is where the assert failure occurs. Note that if the
// size is the same as in the previous call, no error occurs.
// (Remove the row below to make the program work)
//
evas_object_image_size_set(image_obj, BUFWIDTH-1, BUFHEIGHT);
// We never get here
ecore_main_loop_begin();
return 0;
}
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel