diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2017-09-29 22:46:48 -0500 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2017-11-17 22:11:32 -0600 |
| commit | 2c87a53f113be4e407b83eed5078e3d570001cff (patch) | |
| tree | b9520810751b95d3a3fa29077a570e9e757c45b7 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | 74610646ce678ed0644617c2de23544b446ea6dd (diff) | |
TextureCacheBase: make sure stitching rectangle bounds don't exceed the
texture size they are meant to represent
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 4116bc2617..2310631b94 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1353,11 +1353,31 @@ bool TextureCacheBase::LoadTextureFromOverlappingTextures(TCacheEntry* entry_to_ srcrect.right = (src_x + copy_width); 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.top = dst_y; dstrect.right = (dst_x + copy_width); 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); updated_entry = true; |
