| Summary: | clean VirtualDevice constructor ... | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Michael Meeks <michael.meeks> |
| Component: | graphics stack | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | enhancement | CC: | fdbugs, mentoring |
| Priority: | medium | Keywords: | difficultyMedium, easyHack, skillCpp, topicCleanup |
| Version: | 4.3.0.2 rc | ||
| Hardware: | Other | ||
| OS: | All | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
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? Thanks :-) 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) [NinjaEdit] Hi, there I was taking a look at this in order to do an EasyHack, although it seems that the request no longer applies: there are no constructors of `VirtualDevice` that receive `uint_16` as bitCount or alphaBitCount) I guess this means this can be closed After checking with Chris, I am closing this. Thanks for the note, Felipe. |
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 (?). Thanks !