The VirtualDevice constructor include/vcl/virdev.hxx has a couple of modes; one of them looks pretty nasty:
explicit VirtualDevice( const OutputDevice& rCompDev,
sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount );
It would be great to check all uses of this method, and see if we can't create a differently named constructor, or even dummy sub-class that has a nicer name - that expresses what we want there. I suspect nAlphaBitCount is always zero if present [ but can't be removed because of ambiguity ].
git grep 'new VirtualDevice'
git grep ' VirtualDevice('
It'd be great to cleanup other calls to VirtualDevice constructors to give them nice names too I guess with thin sub-classes (?).
Migrating Whiteboard tags to Keywords: (easyHack, difficultyBeginner, skillCpp, topicCleanup)
Hi Michael, what is it that makes the constructor problematic? Could you give some more info?
I suspect the ambiguity is unpleasant - ie. if there are two constructors with similar arguments we should have nice, readable, descriptive enum that distinguishes between the two use-cases; rather than a random number that is always the same value nAlphaBitCount added to the end =)
It seems we have:
ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT);
I wonder if we could overload something into the vdev creation along those lines; not sure.
Beyond that the bigger problem is that VirtualDevices get created at a 1x1 size initially - complete with OS resources behind them, which are slow & expensive to create - and then we re-size them deleting the original stuff =) really the creation needs to have a smoother flow that passes in the size correctly.
JanI is default CC for Easy Hacks (Add Jan; remove LibreOffice Dev List from CC)