Skip to main content
JJ.Lin
Associate III
September 2, 2021
Question

How to cut down code size

  • September 2, 2021
  • 3 replies
  • 990 views

Hi,

I use some shapes in my screen view which makes the screen view class code size up to 15KB, how to cut down the code size? Can I new the object when the view is created? Will it work ?

Thanks!

This topic has been closed for replies.

3 replies

Romain DIELEMAN
ST Employee
September 9, 2021

Hi,

What do you mean by "can I new the object" ? Do you mean initialize a shape widget in the constructor or in the setUpScreen() function in the <NameOfScreen>View.cpp ?

/Romain

JJ.Lin
JJ.LinAuthor
Associate III
September 10, 2021

Yes! For the reaseon that I use a lot of shapes object in a View class and it cost nearly 40KB code size. Can I do like this ?:

Shape<4> *shape1 = new Shape<4>();

I need only set the four points and postion which are regular so that it will cost a less code size.But is it doable?

Thanks!

Xzhiy.1
Associate II
September 10, 2021

I think it works, you may do many extra work to maitain correct data of 4 Shapes, TouchGFX Demo 3 (TouchGFX Designer 4.17.0) show SparseContainerList class which use few Container to manage many items,may give you some inspiration.