hedgewars/uStore.pas
changeset 2592 d86618629e20
parent 2587 0dfa56a8513c
child 2593 dd995a9c8871
equal deleted inserted replaced
2591:c6597b65caea 2592:d86618629e20
   215 		if SDL_MustLock(texsurf) then
   215 		if SDL_MustLock(texsurf) then
   216 			SDLTry(SDL_LockSurface(texsurf) >= 0, true);
   216 			SDLTry(SDL_LockSurface(texsurf) >= 0, true);
   217 
   217 
   218 		// make black pixel be alpha-transparent
   218 		// make black pixel be alpha-transparent
   219 		for i:= 0 to texsurf^.w * texsurf^.h - 1 do
   219 		for i:= 0 to texsurf^.w * texsurf^.h - 1 do
   220 			if PLongwordArray(texsurf^.pixels)^[i] = $FF000000 then PLongwordArray(texsurf^.pixels)^[i]:= 0;
   220 			if PLongwordArray(texsurf^.pixels)^[i] = AMask then PLongwordArray(texsurf^.pixels)^[i]:= 0;
   221 
   221 
   222 		if SDL_MustLock(texsurf) then
   222 		if SDL_MustLock(texsurf) then
   223 			SDL_UnlockSurface(texsurf);
   223 			SDL_UnlockSurface(texsurf);
   224 
   224 
   225 		CrosshairTex:= Surface2Tex(texsurf, false);
   225 		CrosshairTex:= Surface2Tex(texsurf, false);
  1138    for srcY:= 0 to src^.h - 1 do
  1138    for srcY:= 0 to src^.h - 1 do
  1139       begin
  1139       begin
  1140       i:= (destY + srcY) * (dest^.pitch div 4) + destX + srcX;
  1140       i:= (destY + srcY) * (dest^.pitch div 4) + destX + srcX;
  1141       j:= srcY * (src^.pitch div 4) + srcX;
  1141       j:= srcY * (src^.pitch div 4) + srcX;
  1142       // basic skip of transparent pixels - cleverness would be to do true alpha
  1142       // basic skip of transparent pixels - cleverness would be to do true alpha
  1143       if (i < maxDest) and ($FF000000 and srcPixels^[j] <> 0) then destPixels^[i]:= srcPixels^[j];
  1143       if (i < maxDest) and (AMask and srcPixels^[j] <> 0) then destPixels^[i]:= srcPixels^[j];
  1144       end;
  1144       end;
  1145 end;
  1145 end;
  1146 
  1146 
  1147 procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL, apparently
  1147 procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL, apparently
  1148 var y, x, i, j: LongInt;
  1148 var y, x, i, j: LongInt;