Question
Assert Fault in Bitmap::getSizeOfBitmap(...)
Hi ST Community,
we want to create a graph in a CacheableContainer.
So far this works as well.
As soon as an additional GraphElementArea is instantiated (not added to the graph) there is an assertion fault when drawToDynamicBitmap(....) is executed.
The drawToDynamicBitmap(...)is private and is part of the Proprietary code.
Does anyone know the reason for this?
Code:
class cCacheableGraphContainer : public touchgfx::CacheableContainer{
public:
cCacheableGraphContainer();
virtual ~cCacheableGraphContainer(){}
virtual void initialize(void);
void setContent(cGraphData* data);
void updateContent(void);
void setPosition(int16_t x, int16_t y, int16_t width, int16_t height);
protected:
void updateGraphRange(void);
touchgfx::Box bgBox;
touchgfx::GraphWrapAndOverwrite<144> dynamicGraph;
touchgfx::PainterRGB565 dynamicGraphAreaPainter;
touchgfx::PainterRGB565 dynamicGraphLinePainter;
touchgfx::GraphElementArea dynamicGraphArea;
cGraphVerticalLine graphLinesV;
cGraphHorizontalLine graphLinesH;
cGraphLabelsY graphLablesY;
cGraphLine graphLine;
};cCacheableGraphContainer::cCacheableGraphContainer(){
bgBox.setPosition(0, 0, 10, 10);
//Graph init
dynamicGraph.setScale(100);
dynamicGraph.setGraphRangeX(0, 143);
dynamicGraph.setPosition(0, 0, 207, 118);
dynamicGraph.setGraphAreaMargin(2, 3, 80, 2);
dynamicGraph.setGraphAreaPadding(2, 0, 0, 2);
dynamicGraph.setGraphRangeY(0, 100);
graphLablesY.setGraphData(graphData);
graphLablesY.setScale(100);
graphLablesY.setLabelTypedText(touchgfx::TypedText(T_SINGLEUSEID88));
graphLablesY.setColor(touchgfx::Color::getColorFrom24BitRGB(183, 227, 242));
graphLablesY.setLabelDecimals(0);
dynamicGraph.addRightElement(graphLablesY);
graphLinesV.setScale(100);
graphLinesV.setColor(touchgfx::Color::getColorFrom24BitRGB(183, 227, 242));
graphLinesV.setLineWidth(1);
dynamicGraph.addGraphElement(graphLinesV);
graphLinesH.setGraphData(graphData);
graphLinesH.setScale(100);
graphLinesH.setColor(touchgfx::Color::getColorFrom24BitRGB(183, 227, 242));
graphLinesH.setLineWidth(1);
dynamicGraph.addGraphElement(graphLinesH);
graphLine.setScale(100);
dynamicGraphLinePainter.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
graphLine.setPainter(dynamicGraphLinePainter);
graphLine.setLineWidth(2);
dynamicGraph.addGraphElement(graphLine);
graphLine.setScale(1);
// dynamicGraphArea.setScale(1);
// dynamicGraphAreaPainter.setColor(touchgfx::Color::getColorFrom24BitRGB(20, 151, 197));
// dynamicGraphArea.setAlpha(128);
// dynamicGraphArea.setPainter(dynamicGraphAreaPainter);
// dynamicGraphArea.setBaseline(0);
// dynamicGraph.addGraphElement(dynamicGraphArea);
add(bgBox);
add(dynamicGraph);
graphData = nullptr;
}The class which instantiate the CacheableContainer:
class cCacheGraph : public touchgfx::Image {
public:
cCacheGraph();
virtual ~cCacheGraph();
virtual void initialize(void);
void setContent(cGraphData* data);
void updateContent(void);
virtual void dataChanged(void);
protected:
cCacheableGraphContainer graphContainer;
};The function where the Asseratino Fault take place
void cCacheGraph::initialize(void){
if(getWidgethBitmapID() == BITMAP_INVALID){
uint16_t w = getWidth();
uint16_t h = getHeight();
BitmapId bitmapID = Bitmap::dynamicBitmapCreate(w, h, Bitmap::RGB565);
DBGAIF("Dynamic Bitmap created: %d", bitmapID);
setWidgetBitmapID(bitmapID);
}
graphContainer.setCacheBitmap(getWidgethBitmapID());
graphContainer.enableCachedMode(true);
updateContent();
}