mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 19:58:53 +00:00
TextureCacheBase: make sure stitching rectangle bounds don't exceed the
texture size they are meant to represent
This commit is contained in:
parent
74610646ce
commit
2c87a53f11
1 changed files with 20 additions and 0 deletions
|
@ -1353,11 +1353,31 @@ bool TextureCacheBase::LoadTextureFromOverlappingTextures(TCacheEntry* entry_to_
|
||||||
srcrect.right = (src_x + copy_width);
|
srcrect.right = (src_x + copy_width);
|
||||||
srcrect.bottom = (src_y + copy_height);
|
srcrect.bottom = (src_y + copy_height);
|
||||||
|
|
||||||
|
if (static_cast<int>(entry->GetWidth()) == srcrect.GetWidth())
|
||||||
|
{
|
||||||
|
srcrect.right -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (static_cast<int>(entry->GetHeight()) == srcrect.GetHeight())
|
||||||
|
{
|
||||||
|
srcrect.bottom -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
dstrect.left = dst_x;
|
dstrect.left = dst_x;
|
||||||
dstrect.top = dst_y;
|
dstrect.top = dst_y;
|
||||||
dstrect.right = (dst_x + copy_width);
|
dstrect.right = (dst_x + copy_width);
|
||||||
dstrect.bottom = (dst_y + copy_height);
|
dstrect.bottom = (dst_y + copy_height);
|
||||||
|
|
||||||
|
if (static_cast<int>(entry_to_update->GetWidth()) == dstrect.GetWidth())
|
||||||
|
{
|
||||||
|
dstrect.right -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (static_cast<int>(entry_to_update->GetHeight()) == dstrect.GetHeight())
|
||||||
|
{
|
||||||
|
dstrect.bottom -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, dstrect);
|
entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, dstrect);
|
||||||
|
|
||||||
updated_entry = true;
|
updated_entry = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue