Skip to main content
GMeur
Associate III
May 15, 2019
Solved

Assertion failed: No buffer allocated for CanvasWidgetRender

  • May 15, 2019
  • 1 reply
  • 1290 views

Hi,

I'm getting this error message and have no clue how to resolve the problem?

(I'm getting it while trying to instantiate from the code a custom container).

Thanks in advance for your help!

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Hi @GMeur​,

The assert tells you that the Canvas Renderer has no buffer in which to work. If you check out the simulator/main.cpp files in our application templates you'll see that you can do something like the following which configures the size of a buffer, once, for the entire duration of the application - You could override this in a concrete view if you wanted.

#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
#define CANVAS_BUFFER_SIZE (3600)
 
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);

Best regards,

Martin

1 reply

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
May 16, 2019

Hi @GMeur​,

The assert tells you that the Canvas Renderer has no buffer in which to work. If you check out the simulator/main.cpp files in our application templates you'll see that you can do something like the following which configures the size of a buffer, once, for the entire duration of the application - You could override this in a concrete view if you wanted.

#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
#define CANVAS_BUFFER_SIZE (3600)
 
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);

Best regards,

Martin

scottSD
Senior III
June 6, 2019

This was very helpful.