Changeset 559 for trunk/Packages/DpiControls/Dpi.Common.pas
- Timestamp:
- Apr 25, 2024, 8:40:07 PM (3 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/DpiControls/Dpi.Common.pas
r552 r559 25 25 function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND; 26 26 X, Y, cx, cy: Integer; uFlags: UINT): Boolean; 27 function ScaleToNative(Value: Integer): Integer; 27 function ScaleToNative(Value: Integer): Integer; inline; 28 28 function ScaleToNativeDist(Base, Value: Integer): Integer; 29 29 function ScaleFromNative(Value: Integer): Integer; … … 64 64 DstPixelX, DstPixelY: Integer; 65 65 DstPixelWidth, DstPixelHeight: Integer; 66 New X, NewY: Integer;66 NewY: Integer; 67 67 begin 68 68 if not Precise or (Frac(ScreenInfo.Dpi / 96) = 0) then begin … … 107 107 Dest.BeginUpdate; 108 108 SrcPixel := TPixelPointer.Create(Src.NativeBitmap); 109 DstPixel := TPixelPointer.Create(Dest.NativeBitmap );109 DstPixel := TPixelPointer.Create(Dest.NativeBitmap, ScaleToNative(X), ScaleToNative(Y)); 110 110 if Rop = SRCCOPY then begin 111 111 for YY := 0 to Height - 1 do begin 112 NewY := ScaleToNative(Y + YY);113 DstPixelHeight := ScaleToNative(Y + YY + 1) - NewY;114 112 SrcPixel.SetXY(0, ScaleToNative(YSrc + YY)); 113 DstPixelHeight := ScaleToNative(Y + YY + 1) - ScaleToNative(Y + YY); 115 114 for DstPixelY := 0 to DstPixelHeight - 1 do begin 116 DstPixel.SetXY(0, NewY + DstPixelY);117 115 for XX := 0 to Width - 1 do begin 118 116 SrcPixel.SetX(ScaleToNative(XSrc + XX)); 119 NewX := ScaleToNative(X + XX); 120 DstPixel.SetX(NewX); 121 DstPixelWidth := ScaleToNative(X + XX + 1) - NewX; 117 DstPixelWidth := ScaleToNative(X + XX + 1) - ScaleToNative(X + XX); 122 118 for DstPixelX := 0 to DstPixelWidth - 1 do begin 123 119 DstPixel.PixelRGB := SrcPixel.PixelARGB; … … 125 121 end; 126 122 end; 123 DstPixel.NextLine; 127 124 end; 128 125 end; … … 130 127 if Rop = SRCPAINT then begin 131 128 for YY := 0 to Height - 1 do begin 132 NewY := ScaleToNative(Y + YY);133 DstPixelHeight := ScaleToNative(Y + YY + 1) - NewY;134 129 SrcPixel.SetXY(0, ScaleToNative(YSrc + YY)); 130 DstPixelHeight := ScaleToNative(Y + YY + 1) - ScaleToNative(Y + YY); 135 131 for DstPixelY := 0 to DstPixelHeight - 1 do begin 136 DstPixel.SetXY(0, NewY + DstPixelY);137 132 for XX := 0 to Width - 1 do begin 138 133 SrcPixel.SetX(ScaleToNative(XSrc + XX)); 139 NewX := ScaleToNative(X + XX); 140 DstPixel.SetX(NewX); 141 DstPixelWidth := ScaleToNative(X + XX + 1) - NewX; 134 DstPixelWidth := ScaleToNative(X + XX + 1) - ScaleToNative(X + XX); 142 135 for DstPixelX := 0 to DstPixelWidth - 1 do begin 143 DstPixel.PixelRGB := SrcPixel.PixelARGB or DstPixel.PixelARGB;136 DstPixel.PixelRGB := DstPixel.PixelRGB or SrcPixel.PixelARGB; 144 137 DstPixel.NextPixel; 145 138 end; 146 139 end; 140 DstPixel.NextLine; 147 141 end; 148 142 end; … … 150 144 if Rop = SRCAND then begin 151 145 for YY := 0 to Height - 1 do begin 152 NewY := ScaleToNative(Y + YY);153 DstPixelHeight := ScaleToNative(Y + YY + 1) - NewY;154 146 SrcPixel.SetXY(0, ScaleToNative(YSrc + YY)); 147 DstPixelHeight := ScaleToNative(Y + YY + 1) - ScaleToNative(Y + YY); 155 148 for DstPixelY := 0 to DstPixelHeight - 1 do begin 156 DstPixel.SetXY(0, NewY + DstPixelY);157 149 for XX := 0 to Width - 1 do begin 158 150 SrcPixel.SetX(ScaleToNative(XSrc + XX)); 159 NewX := ScaleToNative(X + XX); 160 DstPixel.SetX(NewX); 161 DstPixelWidth := ScaleToNative(X + XX + 1) - NewX; 151 DstPixelWidth := ScaleToNative(X + XX + 1) - ScaleToNative(X + XX); 162 152 for DstPixelX := 0 to DstPixelWidth - 1 do begin 163 DstPixel.PixelRGB := SrcPixel.PixelARGB and DstPixel.PixelARGB;153 DstPixel.PixelRGB := DstPixel.PixelRGB and SrcPixel.PixelARGB; 164 154 DstPixel.NextPixel; 165 155 end; 166 156 end; 157 DstPixel.NextLine; 167 158 end; 168 159 end; … … 170 161 if Rop = DSTINVERT then begin 171 162 for YY := 0 to Height - 1 do begin 172 NewY := ScaleToNative(Y + YY);173 DstPixelHeight := ScaleToNative(Y + YY + 1) - NewY;174 163 SrcPixel.SetXY(0, ScaleToNative(YSrc + YY)); 164 DstPixelHeight := ScaleToNative(Y + YY + 1) - ScaleToNative(Y + YY); 175 165 for DstPixelY := 0 to DstPixelHeight - 1 do begin 176 DstPixel.SetXY(0, NewY + DstPixelY);177 166 for XX := 0 to Width - 1 do begin 178 167 SrcPixel.SetX(ScaleToNative(XSrc + XX)); 179 NewX := ScaleToNative(X + XX); 180 DstPixel.SetX(NewX); 181 DstPixelWidth := ScaleToNative(X + XX + 1) - NewX; 168 DstPixelWidth := ScaleToNative(X + XX + 1) - ScaleToNative(X + XX); 182 169 for DstPixelX := 0 to DstPixelWidth - 1 do begin 183 DstPixel.PixelRGB := not DstPixel.Pixel ARGB;170 DstPixel.PixelRGB := not DstPixel.PixelRGB; 184 171 DstPixel.NextPixel; 185 172 end; 186 173 end; 174 DstPixel.NextLine; 187 175 end; 188 176 end; … … 236 224 end; 237 225 238 function ScaleToNative(Value: Integer): Integer; 226 function ScaleToNative(Value: Integer): Integer; inline; 239 227 begin 240 228 Result := ScreenInfo.Lookup[Value];
Note:
See TracChangeset
for help on using the changeset viewer.