Fix crash with running animators on re-shown windows.

The non-threaded render loops would clean up the nodes for a window
when it was hidden, but the animators kept running and had a reference
to the deleted nodes. This was not a problem for the threaded render
loop as it would wipe the animator controller as well which would
clean the jobs.

Fix it by triggering a reset of all nodes in the animators when the
window is told to clean up. If an animator is ticked when it doesn't
have a node, it will simply do nothing. When the window is made visible
again, we call initialize on all animators to find the new node.

Task-number: QTBUG-37995
Change-Id: Ie5609d95db29f4b2b30ca5bf641dce901e528389
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Fix crash with cleanup of animators.

We had several separate issues relating to how the jobs were cleaned up.

The first was that upon getting setWindow(0), the animator did not
reset m_controller to 0, leading to the starts() coming after that to
post null jobs to the controller. This would later crash in
beforeNodeSync as the starting job was null.

The second issue was that during shutdown, QQuickAnimatorProxy
would try to delete jobs on the controller which was already
deleted. The controller is deleted on the GUI thread regardless
of render loop, so this was solved with a QPointer.

The third was that we were a bit too aggressive in trying to clean up
jobs on the GUI thread, so we introduced a new bool which gets set to
true in startJob() so that Proxy::deleteJob() knows who owns the job.

Task-number: QTBUG-37833
Change-Id: I1b6221a2c1ce2bfd0758801b950cda00ff6899d0
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Fix memory leak and crash with transform animators.

Every time initialize() was called, we would increment the ref on
an item. However, initialize is called every time the job is started,
so the ref would increase and only decrease once, leading to a leaked
helper. Change it to only increment the first time.

A different problem was that when an item was destroyed, we could run
the risk of the QQuickTransformAnimatorJob destructor being called
with the helper's item being null. This would lead to the helper not
being removed from the cache and a dangling helper would remain in the
transforms cache. Now change it so that when a target is destroyed, we
explicitly destroy the helper as well (as no animation can happen then
anyway) and reset all pointers in the job.

Change-Id: I1ce76db134bbc1871d32f1224ba5b68a4a4eeafa
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Remove alpha channel from images that doesn't actually have alpha.

We did this for QPixmap since forever, and it has a huge impact
on rendering performance, so there is no reason why we shouldn't
spend that extra bit of time.

Change-Id: Ibd2e6d585525a5b5a975b8d7498c21dec00647c5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>