573 |
573 |
574 s:= filename + '.png'; |
574 s:= filename + '.png'; |
575 tmpsurf:= IMG_Load_RW(rwopsOpenRead(s), true); |
575 tmpsurf:= IMG_Load_RW(rwopsOpenRead(s), true); |
576 |
576 |
577 if tmpsurf = nil then |
577 if tmpsurf = nil then |
578 begin |
578 begin |
579 OutError(msgFailed, (imageFlags and ifCritical) <> 0); |
579 OutError(msgFailed, (imageFlags and ifCritical) <> 0); |
580 exit; |
580 exit; |
581 end; |
581 end; |
582 |
582 |
583 if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then |
583 if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then |
584 begin |
584 begin |
585 SDL_FreeSurface(tmpsurf); |
585 SDL_FreeSurface(tmpsurf); |
586 OutError(msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0))); |
586 OutError(msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0))); |
587 // dummy surface to replace non-critical textures that failed to load due to their size |
587 // dummy surface to replace non-critical textures that failed to load due to their size |
588 LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask); |
588 LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask); |
589 exit; |
589 exit; |
590 end; |
590 end; |
591 |
591 |
592 tmpsurf:= doSurfaceConversion(tmpsurf); |
592 tmpsurf:= doSurfaceConversion(tmpsurf); |
593 |
593 |
594 if (imageFlags and ifTransparent) <> 0 then |
594 if (imageFlags and ifTransparent) <> 0 then |
595 TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
595 TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |