Problems with OutputDevice
Luboš Luňák
l.lunak at collabora.com
Mon Jan 4 12:55:30 UTC 2021
On Wednesday 30 of December 2020, Chris Sherlock wrote:
> I propose that it might be worthwhile moving the fallback code back into
> SalGraphics itself. Any new primitive functions need to have fallback code,
> or we mandate that any new backends must implement the primitive function.
> My POC can be found above on gerrit.
Please make sure that the fallback code stays in one shared place. The
SalGraphics implementations already have terrible amounts of copy&paste in
some places.
> OutputDevice cares about state too much
>
> OutputDevice is tangled up in state flags. As an example, there is a flag
> called DrawModeFlags. These flags are set to do things like change drawing
> to greyscale, or to prevent filling… all sorts of things that you would
> think that should normally be passed to the drawing function.
That's not how those flags are to be used (at least to my understanding). I
know places where those flags are set and then other code is called to
draw "normally", and OutputDevice will silently transform the drawing
according to the set flags. So the flags are an override and are not meant to
be passed directly to the drawing functions.
That said, I think a good question to ask would be whether it really makes
sense to have such functionality, as it may be some ancient cruft that
doesn't make much sense nowadays.
> OutputDevice relies of VirtualDevice for alpha blending
>
> What can I say? It’s an extraordinary hack and has been that way for a long
> time.
As Thorsten has already said, this is from times when the underlying
platforms couldn't do alpha themselves. The alpha hack has been an annoying
nuisance when implementing Skia, it makes code error-prone, complicated and
slow, so I'd like to see that go, if possible. Presumably not that easy
though.
> Conclusion
>
> These are my observations on the state of OutputDevice. No doubt some of
> you disagree that this state of affairs is so bad. There may even be
> disagreement that OutputDevice is doing anything it shouldn’t be. I don’t
> see any plans published though to do something about it. I have some ideas,
> one of which is to move the fallback drawing code into SalGraphics. That
> alone will cut back unnecessary code considerably.
>
> I would be curious what others think.
If you manage to clean up and simplify the code, I'm all for it.
--
Luboš Luňák
l.lunak at collabora.com
More information about the LibreOffice
mailing list