[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] Bug with ARGB32 buffer canvas when stride != output width * 4



I've encountered another bug.  This one exists with ARGB32 but not
BGRA32.

If the row stride given in the info struct (dest_buffer_row_bytes) is
not equal to the output width * 4, nothing ends up getting rendered to
the canvas (it is completely empty).

See attached test case.

Cheers,
Jason.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <Evas.h>
#include <Evas_Engine_Buffer.h>

int main(int argc, char **argv)
{
    unsigned char *buffer = malloc(800*600*4);
    Evas_Engine_Info_Buffer *einfo;

    evas_init();
    Evas *evas = evas_new();

    evas_output_method_set(evas, evas_render_method_lookup("buffer"));
    einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(evas);
    einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
    einfo->info.dest_buffer_row_bytes = 800*4;
    einfo->info.dest_buffer = buffer;

    evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);

    // If output size is 800,600, it works.
    evas_output_size_set(evas, 640, 480);
    evas_output_viewport_set(evas, 0, 0, 640, 480);
    
    Evas_Object *rect = evas_object_rectangle_add(evas);
    evas_object_color_set(rect, 255, 255, 255, 255);
    evas_object_resize(rect, 640 , 480);
    evas_object_move(rect, 0, 0);
    evas_object_show(rect);

    evas_render(evas);

    printf("Value should be 255: %d\n", buffer[0]);
}