mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Fixed error in subrect adjustment in Texture::LoadFromImage
This commit is contained in:
parent
9f7573c395
commit
5b6c824773
@ -188,8 +188,8 @@ bool Texture::LoadFromImage(const Image& image, const IntRect& area)
|
||||
IntRect rectangle = area;
|
||||
if (rectangle.Left < 0) rectangle.Left = 0;
|
||||
if (rectangle.Top < 0) rectangle.Top = 0;
|
||||
if (rectangle.Width > width) rectangle.Width = width;
|
||||
if (rectangle.Height > height) rectangle.Height = height;
|
||||
if (rectangle.Left + rectangle.Width > width) rectangle.Width = width - rectangle.Left;
|
||||
if (rectangle.Top + rectangle.Height > height) rectangle.Height = height - rectangle.Top;
|
||||
|
||||
// Create the texture and upload the pixels
|
||||
if (Create(rectangle.Width, rectangle.Height))
|
||||
|
Loading…
Reference in New Issue
Block a user