PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

a little error in Surface::Clone

I have found a little error in Frog::Surface::Clone.
If you run Clone method in order to get clone of surface,
then first surface and second surface won't be equal always.
For example, I have surface with blue circle and white background.
Color mask of this surface is white color.
Clone method give me second surface with
blue circle and BLACK background.

Is it right?
The new surface probably defaults to a black background, and since the first one's color mask is white, it won't copy that to the second. If you change the color mask before cloning, does it copy the white?

-John
Thank you very much.
I have understood problem. The right code is
Code:

int iOldColorMask = sfc->GetColorMask();
sfc->SetColorMask(-1);// no color mask
Surface *clone = sfc->Clone();
sfc->SetColorMask(iOldColorMask);
clone->SetColorMask(iOldColorMask);

In that case can get two equal surfaces.