diff --git a/applications/lazimageeditor/DLBitmap.pas b/applications/lazimageeditor/DLBitmap.pas index c8d23b3d8..3eee6a0fb 100644 --- a/applications/lazimageeditor/DLBitmap.pas +++ b/applications/lazimageeditor/DLBitmap.pas @@ -144,7 +144,7 @@ operator div (const A, B: TRGBATriple): TRGBATriple; function DWordTrans(SrcRow: TRGBATriple): DWORD; function DWordToTriple(SrcRow: DWORD): TRGBATriple; procedure StretchLinear(Dest, Src: TDLBitmap); -procedure StretchDLBMP(Src: TDLBitmap; MultiX, MultiY: integer); +procedure StretchDLBMP(ACanvas: TCanvas; Src: TDLBitmap; NewLeft, NewTop, NewWidth, NewHeight: integer); implementation diff --git a/applications/lazimageeditor/DLBmpUtils.inc b/applications/lazimageeditor/DLBmpUtils.inc index 4c8dbe0b1..4910317b1 100644 --- a/applications/lazimageeditor/DLBmpUtils.inc +++ b/applications/lazimageeditor/DLBmpUtils.inc @@ -675,28 +675,29 @@ begin Dest.InvalidateScanLine; end; -procedure StretchDLBMP(Src: TDLBitmap; MultiX, MultiY: integer); +procedure StretchDLBMP(ACanvas: TCanvas; Src: TDLBitmap; NewLeft, NewTop, NewWidth, NewHeight: integer); var - sw, sh, dw, dh, i, j, k, l, nPixelSize: DWord; + sw, sh, dw, dh, i, j: DWord; Dest: TDLBitmap; begin Dest := TDLBitmap.Create; - sw := Src.Width; - sh := Src.Height; - dw := Src.Width * MultiX; - dh := Src.Height * MultiY; + sw := Max(1, NewWidth div Src.Width); + sh := Max(1, NewHeight div Src.Height); + dw := NewWidth - NewLeft; + dh := NewHeight - NewTop; Dest.Width := dw; Dest.Height := dh; - for i := 0 to sh - 1 do - for j := 0 to sw - 1 do - for k := 0 to MultiY - 1 do - for l := 0 to MultiX - 1 do - Dest.Pixels[j * MultiX + k, i * MultiY + l] := Src.Pixels[j, i]; + for i := 0 to dh - 1 do + for j := 0 to dw - 1 do + Dest.Pixels[j, i] := Src.Pixels[j div sw, i div sh]; Dest.InvalidateScanLine; - //Src.Assign(Dest); - Src.Width := dw; - Src.Height := dh; - Src.Canvas.Draw(0, 0, Dest); + ACanvas.Draw(NewLeft, NewTop, Dest); Dest.Free; end; + + + + + + diff --git a/applications/lazimageeditor/bmprgbtypes.pas b/applications/lazimageeditor/bmprgbtypes.pas index f6b9b59d7..69e9b49a1 100644 --- a/applications/lazimageeditor/bmprgbtypes.pas +++ b/applications/lazimageeditor/bmprgbtypes.pas @@ -598,14 +598,15 @@ end; procedure TRGBBitmapCore.StretchDrawTo(ACanvas: TCanvas; DstX, DstY, DstWidth, DstHeight: integer); begin - if ACanvas <> nil then + // if ACanvas <> nil then // ACanvas.StretchDraw(Rect(DstX, DstY, DstWidth, DstHeight), Self); // StretchDLBMP(Self, 3, 3); - begin + StretchDLBMP(ACanvas, Self, DstX, DstY, DstWidth, DstHeight); + {begin ACanvas.AntialiasingMode:=amOff; ACanvas.CopyMode:=cmSrcPaint; ACanvas.CopyRect(Rect(DstX, DstY, DstWidth, DstHeight), Self.Canvas, Rect(0,0,Width,Height)); - end; + end; } end; { TRGB32BitmapCore } diff --git a/applications/lazimageeditor/lazimageeditor.lpi b/applications/lazimageeditor/lazimageeditor.lpi index 302521cec..6f6371de1 100644 --- a/applications/lazimageeditor/lazimageeditor.lpi +++ b/applications/lazimageeditor/lazimageeditor.lpi @@ -49,7 +49,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -168,12 +168,10 @@ - - - + + - @@ -242,11 +240,10 @@ - - - + + @@ -358,10 +355,10 @@ - + - - + + @@ -391,10 +388,11 @@ - + + - - + + @@ -432,123 +430,123 @@ - + - - + + - + - - + + - + - + - + - + - + - - + + - - + + - + - - - - - - - - - - + + + + + + + + + + - + - - + + - - + + - + - - + + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + +