fixed render artifacts and possibble crashed related to it in graphicsBlitAtlasImage
This commit is contained in:
25
graphics.c
25
graphics.c
@@ -40,16 +40,7 @@ void graphicsInit() {
|
||||
void graphicsBlitAtlasImage(int atlasX, int atlasY, int destX, int destY, int w, int h, bool center) {
|
||||
// debug_printf("start graphicsBlitAtlasImage ax = %d ay = %d dx = %d dy = %d w = %d h = %d %x %x\n", atlasX, atlasY, destX, destY, w, h, screenImage, spriteAtlas);
|
||||
|
||||
// // asm_inline("int $3");
|
||||
|
||||
|
||||
// if (destX < 0 || destY < 0) {
|
||||
// return;
|
||||
// }
|
||||
// // assert(destX + w <= screenImage->Width && destY + h <= screenImage->Height);
|
||||
// if (destX + w > screenImage->Width || destY + h > screenImage->Height) {
|
||||
// return;
|
||||
// }
|
||||
// asm_inline("int $3");
|
||||
|
||||
int screen_width = (int)screenImage->Width;
|
||||
int screen_height = (int)screenImage->Height;
|
||||
@@ -64,27 +55,29 @@ void graphicsBlitAtlasImage(int atlasX, int atlasY, int destX, int destY, int w,
|
||||
}
|
||||
|
||||
if (destX < 0) {
|
||||
destX = 0;
|
||||
atlasX -= destX;
|
||||
w = destX + w;
|
||||
destX = 0;
|
||||
}
|
||||
if (destX + w > screen_width) {
|
||||
w = screen_width - destX;
|
||||
}
|
||||
|
||||
if (destY < 0) {
|
||||
destY = 0;
|
||||
atlasY -= destY;
|
||||
h = destY + h;
|
||||
destY = 0;
|
||||
}
|
||||
if (destY + h > screen_height) {
|
||||
h = screen_height - destY;
|
||||
}
|
||||
|
||||
if (w <= 0 || h <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//printf("start graphicsBlitAtlasImage ax = %d ay = %d dx = %d dy = %d w = %d h = %d %x %x\n\n", atlasX, atlasY, destX, destY, w, h, screenImage, spriteAtlas);
|
||||
|
||||
|
||||
// assert(destX + w <= screen_width && destY + h <= screen_height);
|
||||
// assert(destX >= 0 && destY >= 0);
|
||||
|
||||
// asm_inline("int $3");
|
||||
/*unsigned char buf[512];
|
||||
save_fpu_state(buf);
|
||||
|
Reference in New Issue
Block a user