hedgewars/uTextures.pas
changeset 10131 4b4a043111f4
parent 10108 c68cf030eded
child 10155 ac01a2aeff69
equal deleted inserted replaced
10130:a9d509848390 10131:4b4a043111f4
   117               (tw shr BShift and $FF) * RGB_LUMINANCE_BLUE);
   117               (tw shr BShift and $FF) * RGB_LUMINANCE_BLUE);
   118         if tw > 255 then tw:= 255;
   118         if tw > 255 then tw:= 255;
   119         tw:= (tw and $FF shl RShift) or (tw and $FF shl BShift) or (tw and $FF shl GShift) or (fromP4^[x] and AMask);
   119         tw:= (tw and $FF shl RShift) or (tw and $FF shl BShift) or (tw and $FF shl GShift) or (fromP4^[x] and AMask);
   120         fromP4^[x]:= tw;
   120         fromP4^[x]:= tw;
   121         end;
   121         end;
   122     fromP4:= @(fromP4^[Surf^.pitch div 4])
   122     fromP4:= PLongWordArray(@(fromP4^[Surf^.pitch div 4]))
   123     end;
   123     end;
   124 end;
   124 end;
   125 
   125 
   126 { this will make invisible pixels that have a visible neighbor have the
   126 { this will make invisible pixels that have a visible neighbor have the
   127   same color as their visible neighbor, so that bilinear filtering won't
   127   same color as their visible neighbor, so that bilinear filtering won't
   263         begin
   263         begin
   264         for x:= 0 to Pred(Surf^.w) do
   264         for x:= 0 to Pred(Surf^.w) do
   265             toP4^[x]:= fromP4^[x];
   265             toP4^[x]:= fromP4^[x];
   266         for x:= Surf^.w to Pred(tw) do
   266         for x:= Surf^.w to Pred(tw) do
   267             toP4^[x]:= 0;
   267             toP4^[x]:= 0;
   268         toP4:= @(toP4^[tw]);
   268         toP4:= PLongWordArray(@(toP4^[tw]));
   269         fromP4:= @(fromP4^[Surf^.pitch div 4])
   269         fromP4:= PLongWordArray(@(fromP4^[Surf^.pitch div 4]))
   270         end;
   270         end;
   271 
   271 
   272     for y:= Surf^.h to Pred(th) do
   272     for y:= Surf^.h to Pred(th) do
   273         begin
   273         begin
   274         for x:= 0 to Pred(tw) do
   274         for x:= 0 to Pred(tw) do
   275             toP4^[x]:= 0;
   275             toP4^[x]:= 0;
   276         toP4:= @(toP4^[tw])
   276         toP4:= PLongWordArray(@(toP4^[tw]))
   277         end;
   277         end;
   278 
   278 
   279     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp);
   279     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp);
   280 
   280 
   281     FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel)
   281     FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel)