Changeset 249


Ignore:
Timestamp:
May 22, 2020, 9:09:55 PM (5 years ago)
Author:
chronos
Message:
  • Fixed: Incorrect drawing of start screen ornament.
Location:
branches/highdpi/Packages/CevoComponents
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/CevoComponents/ScreenTools.pas

    r247 r249  
    980980procedure InitOrnament;
    981981var
    982   x, y, p, Light, Shade: Integer;
     982  P: TColor;
     983  X, Y, Light, Shade: Integer;
     984  PixelPtr: TPixelPointer;
    983985begin
    984986  if InitOrnamentDone then Exit;
     
    987989  Shade := MainTexture.clBevelShade and $FCFCFC shr 2 * 3 +
    988990    MainTexture.clBevelLight and $FCFCFC shr 2;
    989   for x := 0 to wOrna - 1 do
    990     for y := 0 to hOrna - 1 do begin
    991       p := GrExt[HGrSystem2].Data.Canvas.Pixels[xOrna + x, yOrna + y];
    992       if p = $0000FF then
    993         GrExt[HGrSystem2].Data.Canvas.Pixels[xOrna + x, yOrna + y] := Light
    994       else if p = $FF0000 then
    995         GrExt[HGrSystem2].Data.Canvas.Pixels[xOrna + x, yOrna + y] := Shade;
    996     end;
     991  GrExt[HGrSystem2].Data.BeginUpdate;
     992  PixelPtr := PixelPointer(GrExt[HGrSystem2].Data, ScaleToNative(xOrna), ScaleToNative(yOrna));
     993  for Y := 0 to ScaleToNative(hOrna) - 1 do begin
     994    for X := 0 to ScaleToNative(wOrna) - 1 do begin
     995      P := Color32ToColor(PixelPtr.Pixel^.ARGB);
     996      if P = $0000FF then PixelPtr.Pixel^.ARGB := ColorToColor32(Light)
     997      else if P = $FF0000 then PixelPtr.Pixel^.ARGB := ColorToColor32(Shade);
     998      PixelPtr.NextPixel;
     999    end;
     1000    PixelPtr.NextLine;
     1001  end;
    9971002  InitOrnamentDone := True;
     1003  GrExt[HGrSystem2].Data.EndUpdate;
    9981004end;
    9991005
  • branches/highdpi/Packages/CevoComponents/UPixelPointer.pas

    r246 r249  
    3737
    3838  function PixelPointer(Bitmap: TDpiRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline;
     39  function Color32ToColor(Color: TColor32): TColor;
     40  function ColorToColor32(Color: TColor): TColor32;
    3941
    4042
     
    8688end;
    8789
     90function Color32ToColor(Color: TColor32): TColor;
     91begin
     92  Result := ((Color shr 16) and $ff) or (Color and $00ff00) or
     93    ((Color and $ff) shl 16);
     94end;
     95
     96function ColorToColor32(Color: TColor): TColor32;
     97begin
     98  Result := $ff000000 or ((Color shr 16) and $ff) or (Color and $00ff00) or
     99    ((Color and $ff) shl 16);
     100end;
     101
    88102
    89103end.
Note: See TracChangeset for help on using the changeset viewer.