Initialize scale factor to the last scale factor set on any instance

Authored by hein on Dec 2 2017, 10:12 PM.

Description

Initialize scale factor to the last scale factor set on any instance

Summary:
Plasma::Svg initializes SvgPrivate::scaleFactor to 1.0. On systems with
a higher value for Units:devicePixelRatio, that means Svg::setScaleFactor
gets called with a different value right after instanciation and a fair
amount of work is done twice.

This patch introduces a static SvgPrivate::s_lastScaleFactor,
initialized to 1.0 but updated in Svg::setScaleFactor.
SvgPrivate::scaleFactor is then initialized to the static every time
its instanciated. That means after the first time Svg::setScaleFactor
is called with e.g. 2.0, subsequent Svg instances get initialized
with 2.0.

This ends up shaving a decent amount of time off of startup on scaled
systems.

Reviewers: Plasma, davidedmundson, broulik

Subscribers: plasma-devel, Frameworks

Tags: Plasma, Frameworks

Differential Revision: https://phabricator.kde.org/D9119