slideshow/source/engine/tools.cxx | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
New commits: commit d39303f7ea696d36c4ab65286d4b7d8d1bb9069a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Nov 8 16:02:14 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Nov 9 11:57:31 2022 +0100 Resolves: tdf#148884 impress slideshow uses white text on white in dark mode In dark mode impress's auto text color assumes it will render against the DOCCOLOR by default, so leaving this as white gives white on white, this looks the simplest approach, propogate DOCCOLOR as the default slideshow background instead of reformatting to render onto a white slideshow Change-Id: Id484e14ce96fd05cb16a35586d83e37b36933c20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142464 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 3567fa5c146b..d48bda952462 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -42,6 +42,8 @@ #include <cppcanvas/basegfxfactory.hxx> +#include <svtools/colorcfg.hxx> + #include <unoview.hxx> #include <slideshowexceptions.hxx> #include <smilfunctionparser.hxx> @@ -688,19 +690,29 @@ namespace slideshow::internal rSize.getY() ), 0x000000FFU ); - // fill the bounds rectangle in white. Subtract one pixel - // from both width and height, because the slide size is - // chosen one pixel larger than given by the drawing - // layer. This is because shapes with line style, that - // have the size of the slide would otherwise be cut - // off. OTOH, every other slide background (solid fill, - // gradient, bitmap) render one pixel less, thus revealing - // ugly white pixel to the right and the bottom. + // tdf#148884 in dark mode impress's auto text color assumes it will render against + // the DOCCOLOR by default, so leaving this as white gives white on white, this + // looks the simplest approach, propogate dark mode into slideshow mode instead + // of reformatting to render onto a white slideshow + svtools::ColorConfig aColorConfig; + Color aApplicationDocumentColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor; + cppcanvas::IntSRGBA nCanvasColor = cppcanvas::makeColor(aApplicationDocumentColor.GetRed(), + aApplicationDocumentColor.GetGreen(), + aApplicationDocumentColor.GetBlue(), + 0xFF); + + // fill the bounds rectangle in DOCCOLOR (typically white). + // Subtract one pixel from both width and height, because the slide + // size is chosen one pixel larger than given by the drawing layer. + // This is because shapes with line style, that have the size of + // the slide would otherwise be cut off. OTOH, every other slide + // background (solid fill, gradient, bitmap) render one pixel less, + // thus revealing ugly white pixel to the right and the bottom. fillRect( pCanvas, ::basegfx::B2DRectangle( 0.0, 0.0, rSize.getX()-1, rSize.getY()-1 ), - 0xFFFFFFFFU ); + nCanvasColor ); } ::basegfx::B2DRectangle getAPIShapeBounds( const uno::Reference< drawing::XShape >& xShape )