Removed all the remaining const_cast, and replaced them with mutable members (this is needed for optimized lazy calculations)

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1353 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-01-13 13:55:20 +00:00
parent 9f1354b2a9
commit 40f13c7302
14 changed files with 217 additions and 193 deletions

View file

@ -346,16 +346,16 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f myPosition; ///< Position of the object on screen
Vector2f myScale; ///< Scale of the object
Vector2f myOrigin; ///< Origin of translation / rotation / scaling of the object
float myRotation; ///< Orientation of the object, in degrees
Color myColor; ///< Overlay color of the object
Blend::Mode myBlendMode; ///< Blending mode
mutable bool myNeedUpdate; ///< Do we need to recompute the transform matrix ?
mutable bool myInvNeedUpdate; ///< Do we need to recompute the inverse transform matrix ?
mutable Matrix3 myMatrix; ///< Precomputed transform matrix gathering the translation / rotation / scale / center
mutable Matrix3 myInvMatrix; ///< Precomputed inverse transform matrix gathering the translation / rotation / scale / center
Vector2f myPosition; ///< Position of the object on screen
Vector2f myScale; ///< Scale of the object
Vector2f myOrigin; ///< Origin of translation / rotation / scaling of the object
float myRotation; ///< Orientation of the object, in degrees
Color myColor; ///< Overlay color of the object
Blend::Mode myBlendMode; ///< Blending mode
mutable Matrix3 myMatrix; ///< Precomputed transform matrix gathering the translation / rotation / scale / center
mutable Matrix3 myInvMatrix; ///< Precomputed inverse transform matrix gathering the translation / rotation / scale / center
mutable bool myMatrixUpdated; ///< Do we need to recompute the transform matrix ?
mutable bool myInvMatrixUpdated; ///< Do we need to recompute the inverse transform matrix ?
};
} // namespace sf

View file

@ -306,14 +306,14 @@ private :
/// array of pixels
///
////////////////////////////////////////////////////////////
void EnsureTextureUpdate();
void EnsureTextureUpdate() const;
////////////////////////////////////////////////////////////
/// Make sure the array of pixels is updated with the
/// texture in video memory
///
////////////////////////////////////////////////////////////
void EnsureArrayUpdate();
void EnsureArrayUpdate() const;
////////////////////////////////////////////////////////////
/// Reset the image attributes
@ -327,19 +327,24 @@ private :
////////////////////////////////////////////////////////////
void DestroyTexture();
////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////
typedef std::vector<Color> ColorArray; ///< Array of colors
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int myWidth; ///< Image width
unsigned int myHeight; ///< Image Height
unsigned int myTextureWidth; ///< Actual texture width (can be greater than image width because of padding)
unsigned int myTextureHeight; ///< Actual texture height (can be greater than image height because of padding)
unsigned int myTexture; ///< Internal texture identifier
bool myIsSmooth; ///< Status of the smooth filter
std::vector<Color> myPixels; ///< Pixels of the image
bool myNeedTextureUpdate; ///< Status of synchronization between pixels in central memory and the internal texture un video memory
bool myNeedArrayUpdate; ///< Status of synchronization between pixels in central memory and the internal texture un video memory
bool myPixelsFlipped; ///< To work around the inconsistency in Y orientation
unsigned int myWidth; ///< Image width
unsigned int myHeight; ///< Image Height
unsigned int myTextureWidth; ///< Actual texture width (can be greater than image width because of padding)
unsigned int myTextureHeight; ///< Actual texture height (can be greater than image height because of padding)
unsigned int myTexture; ///< Internal texture identifier
bool myIsSmooth; ///< Status of the smooth filter
mutable ColorArray myPixels; ///< Pixels of the image
mutable bool myTextureUpdated; ///< Status of synchronization between pixels in central memory and the internal texture un video memory
mutable bool myArrayUpdated; ///< Status of synchronization between pixels in central memory and the internal texture un video memory
mutable bool myPixelsFlipped; ///< To work around the inconsistency in Y orientation
};
} // namespace sf

View file

@ -172,17 +172,17 @@ private :
/// Recompute the bounding rectangle of the text
///
////////////////////////////////////////////////////////////
void RecomputeRect();
void UpdateRect() const;
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
String myString; ///< String to display
ResourcePtr<Font> myFont; ///< Font used to display the string
unsigned int myCharacterSize; ///< Base size of characters, in pixels
unsigned long myStyle; ///< Text style (see Style enum)
FloatRect myBaseRect; ///< Bounding rectangle of the text in object coordinates
bool myNeedRectUpdate; ///< Does the bounding rect need an update ?
String myString; ///< String to display
ResourcePtr<Font> myFont; ///< Font used to display the string
unsigned int myCharacterSize; ///< Base size of characters, in pixels
unsigned long myStyle; ///< Text style (see Style enum)
mutable FloatRect myBaseRect; ///< Bounding rectangle of the text in object coordinates
mutable bool myRectUpdated; ///< Is the bounding rectangle up-to-date ?
};
} // namespace sf

View file

@ -276,14 +276,14 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f myCenter; ///< Center of the view, in scene coordinates
Vector2f mySize; ///< Size of the view, in scene coordinates
float myRotation; ///< Angle of rotation of the view rectangle, in degrees
FloatRect myViewport; ///< Viewport rectangle, expressed as a factor of the render-target's size
mutable Matrix3 myMatrix; ///< Precomputed projection matrix corresponding to the view
mutable Matrix3 myInverseMatrix; ///< Precomputed inverse projection matrix corresponding to the view
mutable bool myNeedUpdate; ///< Internal state telling if the matrix needs to be updated
mutable bool myNeedInvUpdate; ///< Internal state telling if the matrix needs to be updated
Vector2f myCenter; ///< Center of the view, in scene coordinates
Vector2f mySize; ///< Size of the view, in scene coordinates
float myRotation; ///< Angle of rotation of the view rectangle, in degrees
FloatRect myViewport; ///< Viewport rectangle, expressed as a factor of the render-target's size
mutable Matrix3 myMatrix; ///< Precomputed projection matrix corresponding to the view
mutable Matrix3 myInverseMatrix; ///< Precomputed inverse projection matrix corresponding to the view
mutable bool myMatrixUpdated; ///< Internal state telling if the matrix needs to be updated
mutable bool myInvMatrixUpdated; ///< Internal state telling if the matrix needs to be updated
};
} // namespace sf