Micro-optimize RenderTransform::sceneChangeEvent.

Only cast the ptr when the type matches and do not incur an atomic
ref/deref for such cases.

The instruction cost goes down a bit for this function then when
profiling the bigscene-cpp example in Linux perf.

Change-Id: I81538d1e9bac166f97a70adcda2580684891dabe
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>