summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-27 22:10:45 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-17 16:38:44 +0200
commit57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47 (patch)
treef18e40e15f11c164ee136ac0574700c2257d6ada /src/video_core
parentMerge pull request #2978 from lioncash/doxygen (diff)
downloadyuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.gz
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.bz2
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.lz
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.xz
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.tar.zst
yuzu-57a46c69f1ae65902c3937bbfedc6ffa9f8ecf47.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/engines/fermi_2d.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index 7ff44f06d..c2d4dcc09 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -47,10 +47,20 @@ void Fermi2D::HandleSurfaceCopy() {
src_blit_x2 = static_cast<u32>((regs.blit_src_x >> 32) + regs.blit_dst_width);
src_blit_y2 = static_cast<u32>((regs.blit_src_y >> 32) + regs.blit_dst_height);
}
- const Common::Rectangle<u32> src_rect{src_blit_x1, src_blit_y1, src_blit_x2, src_blit_y2};
- const Common::Rectangle<u32> dst_rect{regs.blit_dst_x, regs.blit_dst_y,
- regs.blit_dst_x + regs.blit_dst_width,
- regs.blit_dst_y + regs.blit_dst_height};
+ const u32 dst_blit_x2 = regs.blit_dst_x + regs.blit_dst_width;
+ const u32 dst_blit_y2 = regs.blit_dst_x + regs.blit_dst_height;
+ const u32 excess_src_x2 = std::max<s32>(0, dst_blit_x2 - regs.dst.width);
+ const u32 excess_src_y2 = std::max<s32>(0, dst_blit_y2 - regs.dst.height);
+ const u32 excess_dst_x2 = std::max<s32>(0, src_blit_x2 - regs.src.width);
+ const u32 excess_dst_y2 = std::max<s32>(0, src_blit_y2 - regs.src.height);
+
+ const Common::Rectangle<u32> src_rect{
+ src_blit_x1, src_blit_y1, std::min<u32>(regs.src.width, src_blit_x2) - excess_src_x2,
+ std::min<u32>(regs.src.height, src_blit_y2) - excess_src_y2};
+ const Common::Rectangle<u32> dst_rect{
+ regs.blit_dst_x, regs.blit_dst_y,
+ std::min<u32>(regs.dst.width, dst_blit_x2) - excess_dst_x2,
+ std::min<u32>(regs.dst.height, dst_blit_y2) - excess_dst_y2};
Config copy_config;
copy_config.operation = regs.operation;
copy_config.filter = regs.blit_control.filter;