[Marble-devel] New scanline access method

Torsten Rahn tackat at t-online.de
Sat Nov 7 21:37:30 CET 2009


Am Samstag 07 November 2009 19:33:06 schrieb Carlos Licea:
> The C-style cast rules go as follows:
> 	The semantics for a cast-expression (aka a 'C-Style Cast') are defined as
>  the first of these that succeeds: const_cast, static_cast, static_cast
>  followed by const_cast, reinterpret_cast, reinterpret_cast followed by
>  const_cast. See 5.4 [expr.cast]
> In this context the static_cast is not possible (there's no "legal" way to
> transform a bunch of uchar to a QRgb), so, what is happening is a
> reinterprete_cast. That's why the old c-style is not recommended anymore.
>  You don't really know which combinations of casting are happening behind
>  the scenes.

I've tried it using reinterprete cast and I still get the same results.
Also I looked at the QImage::detach code. Of course in our case the canvas 
image is only used by a single instance (so the reference count always stays 
"1") -- this could also be kind of "encouraged" through the fact that we are 
referencing the canvas image via a pointer. 
The detach only happens if the refcount gets bigger than 1. So in our case it 
looks like it doesn't happen (I'd feel better if somebody would check whether 
the canvas image gets actually detached).
So that could explain why the change doesn't have any effect for me (of course 
it might also be that the effect gets hidden by a bigger bottleneck).

I think we should investigate this further before committing anything :-)


More information about the Marble-devel mailing list