Changeset 52 for trunk/LocalPlayer/Term.pas
- Timestamp:
- Jan 11, 2017, 10:14:11 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r50 r52 506 506 Sharpen = 80; 507 507 type 508 TLine = array [0 .. 99999, 0 .. 2] of Byte;509 508 TBuffer = array [0 .. 99999, 0 .. 2] of integer; 510 509 var … … 512 511 ydivider: integer; 513 512 resampled: ^TBuffer; 514 line: ^TLine;513 PixelPtr: TPixelPointer; 515 514 begin 516 515 nx := BigImp.width div xSizeBig * xSizeSmall; … … 529 528 if ydivider > ySizeSmall then 530 529 ydivider := ySizeSmall; 531 line := BigImp.ScanLine[cut + iy * ySizeBig + y];530 PixelPtr.Init(BigImp, 0, cut + iy * ySizeBig + y); 532 531 for x := 0 to xSizeBig - 1 do 533 532 begin … … 541 540 for ch := 0 to 2 do 542 541 begin 543 c := line[ix * xSizeBig + x, ch]; 542 PixelPtr.SetX(ix * xSizeBig + x); 543 c := PixelPtr.Pixel^.Planes[ch]; 544 544 inc(resampled[ir, ch], c * xdivider * ydivider); 545 545 if xdivider < xSizeSmall then … … 558 558 559 559 // sharpen resampled icons 560 SmallImp.width := nx; 561 SmallImp.height := ny; 560 SmallImp.SetSize(nx, ny); 562 561 SmallImp.BeginUpdate; 563 for y := 0 to ny - 1 do 564 begin 565 line := SmallImp.ScanLine[y]; 562 for y := 0 to ny - 1 do begin 563 PixelPtr.Init(SmallImp, 0, y); 566 564 for x := 0 to nx - 1 do 567 for ch := 0 to 2 do 568 begin 565 for ch := 0 to 2 do begin 569 566 sum := 0; 570 567 Cnt := 0; … … 581 578 sum := ((Cnt * Sharpen + 800) * resampled[x + nx * y, ch] - sum * 582 579 Sharpen) div (800 * xSizeBig * (ySizeBig - 2 * cut)); 583 if sum < 0 then 584 sum := 0; 585 if sum > 255 then 586 sum := 255; 587 line[x][ch] := sum; 580 if sum < 0 then sum := 0; 581 if sum > 255 then sum := 255; 582 PixelPtr.SetX(x); 583 PixelPtr.Pixel^.Planes[ch] := sum; 588 584 end; 589 585 end; … … 4066 4062 4067 4063 procedure TMainScreen.MiniPaint; 4068 type4069 TLine = array [0 .. 99999999, 0 .. 2] of Byte;4070 4064 var 4071 4065 uix, cix, x, y, Loc, i, hw, xm, cm, cmPolOcean, cmPolNone: integer; 4072 PrevMini Line, MiniLine: ^TLine;4066 PrevMiniPixel, MiniPixel: PPixel32; 4073 4067 begin 4074 4068 cmPolOcean := GrExt[HGrSystem].Data.Canvas.Pixels[101, 67]; … … 4080 4074 FillRect(Rect(0, 0, Mini.width, Mini.height)); 4081 4075 end; 4082 MiniLine := nil;4083 4076 Mini.BeginUpdate; 4084 4077 for y := 0 to G.ly - 1 do 4085 4078 begin 4086 PrevMiniLine := MiniLine;4087 MiniLine := Mini.ScanLine[y];4088 4079 for x := 0 to G.lx - 1 do 4089 4080 if MyMap[x + G.lx * y] and fTerrain <> fUNKNOWN then … … 4093 4084 begin 4094 4085 xm := ((x - xwMini) * 2 + i + y and 1 - hw + G.lx * 5) mod (G.lx * 2); 4086 MiniPixel := GetBitmapPixelPtr(Mini, xm, y); 4095 4087 cm := MiniColors[MyMap[Loc] and fTerrain, i]; 4096 4088 if ClientMode = cEditMap then … … 4115 4107 end; 4116 4108 cm := $808080 or cm shr 1; { increase brightness } 4117 if PrevMiniLine <> nil then 4118 begin // 2x2 city dot covers two scanlines 4119 PrevMiniLine[xm, 0] := cm shr 16; 4120 PrevMiniLine[xm, 1] := cm shr 8 and $FF; 4121 PrevMiniLine[xm, 2] := cm and $FF; 4109 if y > 0 then begin 4110 // 2x2 city dot covers two scanlines 4111 PrevMiniPixel := GetBitmapPixelPtr(Mini, xm, y - 1); 4112 PrevMiniPixel^.B := cm shr 16; 4113 PrevMiniPixel^.G := cm shr 8 and $FF; 4114 PrevMiniPixel^.R := cm and $FF; 4122 4115 end 4123 4116 end … … 4148 4141 cm := Tribe[MyRO.Territory[Loc]].Color; 4149 4142 end; 4150 Mini Line[xm, 0]:= cm shr 16;4151 Mini Line[xm, 1]:= cm shr 8 and $FF;4152 Mini Line[xm, 2]:= cm and $FF;4143 MiniPixel^.B := cm shr 16; 4144 MiniPixel^.G := cm shr 8 and $FF; 4145 MiniPixel^.R := cm and $FF; 4153 4146 end; 4154 4147 end;
Note:
See TracChangeset
for help on using the changeset viewer.