Ignore:
Timestamp:
Jan 15, 2017, 11:47:01 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Unified direct pixel access using TPixelPointer.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/TechTree.pas

    r57 r72  
    123123  X, Y, ad, TexWidth, TexHeight: Integer;
    124124  s: string;
    125   SrcPixel, DstPixel: PPixel32;
     125  SrcPixel, DstPixel: TPixelPointer;
    126126begin
    127127  if Image = nil then
     
    165165    // texturize background
    166166    Image.BeginUpdate;
    167     TexWidth := Paper.width;
    168     TexHeight := Paper.height;
    169     for Y := 0 to Image.height - 1 do
    170     begin
    171       for X := 0 to Image.width - 1 do
    172       begin
    173         DstPixel := GetBitmapPixelPtr(Image, X, Y);
    174         if (DstPixel^.ARGB and $FFFFFF) = $7F007F then // transparent
    175         begin
    176           SrcPixel := GetBitmapPixelPtr(Paper, X mod TexWidth, Y mod TexHeight);
    177           DstPixel^.B := SrcPixel^.B;
    178           DstPixel^.G := SrcPixel^.G;
    179           DstPixel^.R := SrcPixel^.R;
     167    TexWidth := Paper.Width;
     168    TexHeight := Paper.Height;
     169    DstPixel.Init(Image);
     170    SrcPixel.Init(Paper);
     171    for Y := 0 to Image.Height - 1 do begin
     172      for X := 0 to Image.Width - 1 do begin
     173        if (DstPixel.Pixel^.ARGB and $FFFFFF) = $7F007F then begin // transparent
     174          SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight);
     175          DstPixel.Pixel^.B := SrcPixel.Pixel^.B;
     176          DstPixel.Pixel^.G := SrcPixel.Pixel^.G;
     177          DstPixel.Pixel^.R := SrcPixel.Pixel^.R;
    180178        end;
     179        DstPixel.NextPixel;
    181180      end;
     181      DstPixel.NextLine;
    182182    end;
    183183    Image.EndUpdate;
Note: See TracChangeset for help on using the changeset viewer.