mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-25 09:09:49 +00:00
Avoid a potential divide by zero.
This commit is contained in:
parent
8a3a67dc5b
commit
10626e356d
@ -590,7 +590,7 @@ void FramebufferManagerCommon::FindTransferFramebuffers(VirtualFramebuffer *&dst
|
||||
}
|
||||
if (match) {
|
||||
dstYOffset = yOffset;
|
||||
dstXOffset = (byteOffset / bpp) % dstStride;
|
||||
dstXOffset = dstStride == 0 ? 0 : (byteOffset / bpp) % dstStride;
|
||||
dstBuffer = vfb;
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ bool TextureCacheDX9::AttachFramebuffer(TexCacheEntry *entry, u32 address, Virtu
|
||||
|
||||
const u32 bitOffset = (texaddr - addr) * 8;
|
||||
const u32 pixelOffset = bitOffset / std::max(1U, (u32)textureBitsPerPixel[entry->format]);
|
||||
fbInfo.yOffset = pixelOffset / entry->bufw;
|
||||
fbInfo.yOffset = entry->bufw == 0 ? 0 : pixelOffset / entry->bufw;
|
||||
fbInfo.xOffset = entry->bufw == 0 ? 0 : pixelOffset % entry->bufw;
|
||||
|
||||
if (framebuffer->fb_stride != entry->bufw) {
|
||||
|
@ -357,7 +357,7 @@ bool TextureCache::AttachFramebuffer(TexCacheEntry *entry, u32 address, VirtualF
|
||||
|
||||
const u32 bitOffset = (texaddr - addr) * 8;
|
||||
const u32 pixelOffset = bitOffset / std::max(1U, (u32)textureBitsPerPixel[entry->format]);
|
||||
fbInfo.yOffset = pixelOffset / entry->bufw;
|
||||
fbInfo.yOffset = entry->bufw == 0 ? 0 : pixelOffset / entry->bufw;
|
||||
fbInfo.xOffset = entry->bufw == 0 ? 0 : pixelOffset % entry->bufw;
|
||||
|
||||
if (framebuffer->fb_stride != entry->bufw) {
|
||||
|
Loading…
Reference in New Issue
Block a user