Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Delphi XE7 change PNG image on every FMX form save?

I have a form with many custom firemonkey components where each contain multiple bitmaps (loaded from PNG image files). Every time the form is saved, the binary data of the PNG images change in the FMX file!

This messes up my version control log (SVN), as changing just one property in the form results in thousands of changed lines.

Is there any way I can avoid this?

See screen shot from SVN diff here: :

SVN diff here

When the form was saved, the DotInlay.PNG image was not changed by me, and not even the control that contained the image had any changes .

Edit: From the comments, this is a bug in Delphi, so I created a new QP report: https://quality.embarcadero.com/browse/RSP-11259

Vote for it if you find it should be solved.

like image 423
Hans Avatar asked Jun 03 '15 07:06

Hans


1 Answers

The IDE is just like that. One of the perils of putting binary resources into a .dfm/.fmx files. I don't believe that there is anything that you can do. Only Embarcadero can change their IDE.

What you have to do with .dfm/.fmx file and source control is to review carefully every commit and revert unintended changes. You need to do that no matter what because the IDE does have a habit of changing things that should not be changed. Even for non-binary resources.

My recommendation though is that you don't put images in .dfm/.fmx files. Keep them in resources. That way you can put the image file into the revision control and have it linked as a resource to your executable. You'll need to do more work in your code to load up the resource at runtime, but you can wrap that in helper methods if needed and each image load should be reduced to a one-liner.

The real benefit of this approach is that you exert better change control over your binary assets.

like image 158
David Heffernan Avatar answered Oct 23 '22 15:10

David Heffernan