Mentions légales du service

Skip to content

InputCamera: remove bug-prone constructor, ask explicitely for camera size.

RODRIGUEZ Simon requested to merge fix-inputcamera-constructor into master

This is a potentially code-breaking change, so I'm using the merge request mechanism to notify people in the team.

We had an InputCamera(Camera & cam) constructor which was leaving uninitialized the width and height of the new InputCamera, leading to hard-to-find bugs with random camera sizes. This was because Camera doesn't have the notion of image size, only the notion of aspect ratio.

The fix I decided upon is to modify the constructor to require the developer to specify a size explicitely. I also had to remove an assignment operator that could create the same issue. This means that you might encounter compilation errors when you were creating an InputCamera directly from a Camera. To fix those cases, you now have to pass a width and height to the constructor (something that you would have had to set on the next line with InputCamera::size(w,h) in the previous setup, if you were aware of it).

If everybody is aware of this breaking change and is fine with it, this could be merged in master.

Merge request reports