equal
deleted
inserted
replaced
359 SDLTry(SDL_LockSurface(Image) >= 0, true); |
359 SDLTry(SDL_LockSurface(Image) >= 0, true); |
360 |
360 |
361 bpp:= Image^.format^.BytesPerPixel; |
361 bpp:= Image^.format^.BytesPerPixel; |
362 TryDo(bpp = 4, 'It should be 32 bpp sprite', true); |
362 TryDo(bpp = 4, 'It should be 32 bpp sprite', true); |
363 // Check that sprite fits free space |
363 // Check that sprite fits free space |
364 //p:= @(PByteArray(Image^.pixels)^[Image^.pitch * ( col * h + row * w )]); |
364 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ]); |
365 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 - 1 ]); |
|
366 case bpp of |
365 case bpp of |
367 4: for y:= 0 to Pred(h) do |
366 4: for y:= 0 to Pred(h) do |
368 begin |
367 begin |
369 for x:= 0 to Pred(w) do |
368 for x:= 0 to Pred(w) do |
370 if PLongword(@(p^[x * 4]))^ <> 0 then |
369 if PLongword(@(p^[x * 4]))^ <> 0 then |
389 SDL_UnlockSurface(Image); |
388 SDL_UnlockSurface(Image); |
390 exit |
389 exit |
391 end; |
390 end; |
392 |
391 |
393 // Checked, now place |
392 // Checked, now place |
394 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 - 1 ]); |
393 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ]); |
395 case bpp of |
394 case bpp of |
396 4: for y:= 0 to Pred(h) do |
395 4: for y:= 0 to Pred(h) do |
397 begin |
396 begin |
398 for x:= 0 to Pred(w) do |
397 for x:= 0 to Pred(w) do |
399 if PLongword(@(p^[x * 4]))^ <> 0 then |
398 if PLongword(@(p^[x * 4]))^ <> 0 then |