Skip to content

drawBitmap() not always working... #204

@exdiogene

Description

@exdiogene

I was trying to enhance the solution for image drawing proposed in this discussion :

#160

The solution provided by "e-labInnovations" is a very slow process taking more than 900mS to display a 256 X 256 picture.

I had better performance using this code instead of his :

      r = ((my_data >> 11) & 0x1F) << 3;   // red   0 .. 255
      g = ((my_data >> 5) & 0x3F) << 2;  // green 0 .. 255
      b = (my_data & 0x1F) << 3;         // blue  0 .. 255

But it still take 630mS to display the picture!

So I tried to convert a line_array to a Bitmap_array to accelerate the process :

    png.getLineAsRGB565(pDraw, bpm_data2, PNG_RGB565_LITTLE_ENDIAN, 0xffffffff);
    for (int16_t i = 0; i < pDraw->iWidth; i++) {
      my_data = bpm_data2[i];
      r = ((my_data >> 11) & 0x1F) << 3;   // red   0 .. 255
      g = ((my_data >> 5) & 0x3F) << 2;  // green 0 .. 255
      b = (my_data & 0x1F) << 3;         // blue  0 .. 255
      myBitmap_data[(i * 4)] = r;
      myBitmap_data[(i * 4) + 1] = g;
      myBitmap_data[(i * 4) + 2] = b;
      myBitmap_data[(i * 4) + 3] = 0xff;
    }
    Bitmap myBitmap = Bitmap(pDraw->iWidth, 1, &myBitmap_data[0], PixelFormat::RGBA8888);
    canvas.drawBitmap(0,pDraw->y,&myBitmap);

Now the process take only 65mS to display the picture, but the picture is partially displayed between 20% to 50% vertically...

Some horizontal lines get lost in the process, probably due by the VGA synchronization process, is there a way to display the missing lines correctly?

The only found solution at the moment is to put a "canvas.waitCompletion(false);" after the drawBitmap(), but it increase the process to 120mS.

I tried to put the "canvas.waitCompletion(false);" before the drawBitmap(), but it create some garbage in my picture, do you know why?

Any answer would be greatly appreciated...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions