On 8 Jul 2019, at 9:06 pm, Tomaž Vajngerl <quikee@xxxxxxxxx> wrote:
I have to agree with this. In actual fact, I have long thought that OutputDevice is a misnomer anyway, because: 1. It’s not a “device” 2. It deals with things other than output - it also handles input! I like the idea of gradually moving it to RenderContext. The class definitely needs splitting up, but it’s very difficult to do as so many other classes use it and rely on it. But getting back to the bug: I have been looking at each area and I’m starting with some low-hanging fruit to start with: https://gerrit.libreoffice.org/#/c/75521/ - changes GetBackground().GetColor() to GetBackgroundColor() - turns out that this allows us to remove at least one area that removes the need for GetOutDevType in SmTmpDevice::Impl_GetColor() https://gerrit.libreoffice.org/#/c/75524/ - further follows this up by introducing a new function GetReadableFontColor() and overrides this for Printer https://gerrit.libreoffice.org/#/c/75556/ - moves some code into Window::SaveBackground() and creates an OutputDevice::SaveBackground() for all other cases. https://gerrit.libreoffice.org/#/c/75616/ - makes Flush() a virtual function introduced in OutputDevice - it’s a noop as there is no need to do any flushes in OutputDevice but if any subclasses need to flush their buffers then it can be overridden. https://gerrit.libreoffice.org/#/c/75641/ makes ExpandPaintClipRegion() and virtual function of OutputDevice These are all small changes, I’m hoping that they are reasonable! I’m fairly confident that we can actually start to eliminate GetOutDevType() without resorting to dynamic_cast<> hackiness. There are a few hairy bits of the code (in particular svx) that are going to be harder to refactor, but again, in time I think we can resolve this. Ultimately, if we can seperate OutputDevice from Window, VirtualDevice and Printer then I’m pretty certain we can make OutputDevice smaller and more focussed, and eventually even get to the Holy Grail of making it a true RenderContext. Chris |
_______________________________________________ LibreOffice mailing list LibreOffice@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/libreoffice