Ok, but that's awful. It doesn't have a well defined behaviour.
SetImage(A); --> Uses A's image rect as subrect
SetImage(B); --> Keeps A's subrect
SetImage(A); --> Uses A's image rect as subrect
SetSubRect(SubRect); --> changes sub rect
SetImage(B); --> doesn't modify the subrect
SetSubRect(SubRect); --> doesn't modify the subrect
SetImage(A); --> Uses A's image rect as subrect
It's confusing to say the least. The order of those calls affects the behaviour of each function (respect to Sub Rects).
You should at least document this behaviour in SetSubRect/SetImage doxygen comments.
The rectangle has to be valid in case you never assign an image, so that you can call Resize and get a valid colored rectangle when drawing your sprite.
That's no excuse. You could do this:
void Sprite::Resize(float Width, float Height)
{
if ((mySubRect.GetWidth() > 0) && (mySubRect.GetHeight() > 0))
{
SetScale(Width / mySubRect.GetWidth(), Height / mySubRect.GetHeight());
}
else
{
SetScale(Width, Height);
}
}