296 tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, ifAlpha or ifCritical or ifTransparent); |
300 tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, ifAlpha or ifCritical or ifTransparent); |
297 end; |
301 end; |
298 |
302 |
299 if tmpsurf <> nil then |
303 if tmpsurf <> nil then |
300 begin |
304 begin |
|
305 {$IFDEF DARWIN} |
|
306 {* this is a workaround for http://bugzilla.libsdl.org/show_bug.cgi?id=868 |
|
307 remove this when it's fixed in upstream; it causes problems on ppc *} |
|
308 tmpP := tmpsurf^.pixels; |
|
309 for i:= 0 to (tmpsurf^.pitch shr 2) * tmpsurf^.h - 1 do |
|
310 begin |
|
311 tmpA:= tmpP^[i] shr 24 and $FF; |
|
312 tmpR:= tmpP^[i] shr 16 and $FF; |
|
313 tmpG:= tmpP^[i] shr 8 and $FF; |
|
314 tmpB:= tmpP^[i] and $FF; |
|
315 |
|
316 if tmpA <> 0 then |
|
317 begin |
|
318 tmpR:= round(tmpR * 255/tmpA); |
|
319 tmpG:= round(tmpG * 255/tmpA); |
|
320 tmpB:= round(tmpB * 255/tmpA); |
|
321 end; |
|
322 |
|
323 if tmpR > 255 then tmpR:= 255; |
|
324 if tmpG > 255 then tmpG:= 255; |
|
325 if tmpB > 255 then tmpB:= 255; |
|
326 |
|
327 tmpP^[i]:= (tmpA shl 24) or (tmpR shl 16) or (tmpG shl 8) or tmpB; |
|
328 |
|
329 //AddFileLog(inttostr(tmpP^[i*128] shr 24) + ' | ' + inttostr(tmpP^[i*128] shr 16 and $FF) + ' | ' + inttostr(tmpP^[i*128] shr 8 and $FF)+ ' | ' + inttostr(tmpP^[i*128] and $FF)); |
|
330 end; |
|
331 {$ENDIF} |
|
332 |
301 if imageWidth = 0 then imageWidth := tmpsurf^.w; |
333 if imageWidth = 0 then imageWidth := tmpsurf^.w; |
302 if imageHeight = 0 then imageHeight := tmpsurf^.h; |
334 if imageHeight = 0 then imageHeight := tmpsurf^.h; |
303 if Width = 0 then Width:= tmpsurf^.w; |
335 if Width = 0 then Width:= tmpsurf^.w; |
304 if Height = 0 then Height:= tmpsurf^.h; |
336 if Height = 0 then Height:= tmpsurf^.h; |
305 if (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]) then |
337 if (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]) then |