mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +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;
|
IntRect rectangle = area;
|
||||||
if (rectangle.Left < 0) rectangle.Left = 0;
|
if (rectangle.Left < 0) rectangle.Left = 0;
|
||||||
if (rectangle.Top < 0) rectangle.Top = 0;
|
if (rectangle.Top < 0) rectangle.Top = 0;
|
||||||
if (rectangle.Width > width) rectangle.Width = width;
|
if (rectangle.Left + rectangle.Width > width) rectangle.Width = width - rectangle.Left;
|
||||||
if (rectangle.Height > height) rectangle.Height = height;
|
if (rectangle.Top + rectangle.Height > height) rectangle.Height = height - rectangle.Top;
|
||||||
|
|
||||||
// Create the texture and upload the pixels
|
// Create the texture and upload the pixels
|
||||||
if (Create(rectangle.Width, rectangle.Height))
|
if (Create(rectangle.Width, rectangle.Height))
|
||||||
|
Loading…
Reference in New Issue
Block a user