Skip to content

Commit

Permalink
remove TALDoubleBufferedTextLayout and refactor TALText
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeus64 committed Oct 12, 2023
1 parent bad7dde commit 3bad90a
Show file tree
Hide file tree
Showing 6 changed files with 694 additions and 1,239 deletions.
2 changes: 0 additions & 2 deletions Demos/ALFmxControls/_Source/UnitMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ procedure TForm1.FormCreate(Sender: TObject);
fALText.Parent := ALVertScrollBox1;
fALText.TextSettings.WordWrap := True;
fALText.TextSettings.HorzAlign := TTextAlign.Center;
fALText.doubleBuffered := True;
fALText.Align := TalignLayout.Top;
fALText.Margins.Top := 8;
fALText.Position.Y := button15.Position.Y - button15.Margins.Top;
Expand Down Expand Up @@ -910,7 +909,6 @@ procedure TForm1.ButtonLaunchScrollBoxDemoAlcinoeClick(Sender: TObject);
//-----
var LText := TALText.Create(self);
LText.Parent := LRectangle;
LText.doubleBuffered := True;
LText.Align := TalignLayout.left;
LText.Text := 'Alcinoe';
LText.Margins.Left := 15;
Expand Down
20 changes: 9 additions & 11 deletions Source/Alcinoe.FMX.Common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,15 @@ function ALTranslate(const AText: string): string;
var LChild: TControl;
begin

//
//if aControl is TPresentedControl then TPresentedControl(aControl).ApplyStyleLookup; // this to generate child controls
// // that can be TALText for exemple
// // (for the Tlabel)
acontrol.DisableDisappear := true; // this to keep the style when the control get out of the visible are
// else the style will be freed to be reaplied a little later

if (aControl is TALText) then begin
TALText(aControl).doubleBuffered := True;
TALText(aControl).MakeBufBitmap;
end
// This is used to generate child controls.
// For instance, TALText can be used for the TLabel.
//if aControl is TPresentedControl then TPresentedControl(aControl).ApplyStyleLookup;

// This ensures the style is retained when the control exits the visible area.
// Otherwise, the style will be released and reapplied shortly after.
acontrol.DisableDisappear := true;

if (aControl is TALText) then TALText(aControl).MakeBufBitmap
else if (aControl is TALRectangle) then begin
TALRectangle(aControl).doubleBuffered := True;
TALRectangle(aControl).MakeBufBitmap;
Expand Down
12 changes: 6 additions & 6 deletions Source/Alcinoe.FMX.Graphics.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8329,7 +8329,7 @@ procedure ALPaintRectangle(
//-----
if (not aDrawOnlyBorder) and
(Shadow <> nil) and
(Shadow.enabled) then aPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.ShadowColor){shadowColor});
(Shadow.enabled) then aPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.Color){shadowColor});

LJRect := TJRectf.JavaClass.init(aRect.left, aRect.top, aRect.right, aRect.bottom);
aCanvas.drawRoundRect(
Expand All @@ -8353,7 +8353,7 @@ procedure ALPaintRectangle(
//-----
if (not aDrawOnlyBorder) and
(Shadow <> nil) and
(Shadow.enabled) then aPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.ShadowColor){shadowColor});
(Shadow.enabled) then aPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.Color){shadowColor});

aCanvas.drawRect(
aRect.left{left},
Expand Down Expand Up @@ -8511,7 +8511,7 @@ procedure ALPaintRectangle(
//-----
if (not aDrawOnlyBorder) and
(Shadow <> nil) and
(Shadow.enabled) then aPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.ShadowColor){shadowColor});
(Shadow.enabled) then aPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.Color){shadowColor});

aCanvas.drawPath(LPath,aPaint);
LPath := nil;
Expand Down Expand Up @@ -9587,7 +9587,7 @@ procedure ALPaintCircle(
LShader := TJRadialGradient.JavaClass.init(LRect.CenterPoint.x{x}, LRect.CenterPoint.y{y}, LRect.width / 2{radius}, LColors, LStops, TJShader_TileMode.JavaClass.CLAMP{tile});
LPaint.setShader(LShader);
if (Shadow <> nil) and
(Shadow.enabled) then LPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.ShadowColor){shadowColor});
(Shadow.enabled) then LPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.Color){shadowColor});
aCanvas.drawCircle(LRect.CenterPoint.x{cx}, LRect.CenterPoint.y{cy}, LRect.width / 2{radius}, LPaint);
if (Shadow <> nil) and
(Shadow.enabled) then LPaint.clearShadowLayer;
Expand Down Expand Up @@ -9625,7 +9625,7 @@ procedure ALPaintCircle(
LJSrcRect := TJRect.JavaClass.init(0, 0, fill.Bitmap.Bitmap.Width, fill.Bitmap.Bitmap.height);
LPaint.setXfermode(LPorterDuffXfermode);
if (Shadow <> nil) and
(Shadow.enabled) then LPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.ShadowColor){shadowColor});
(Shadow.enabled) then LPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.Color){shadowColor});
aCanvas.drawBitmap(LTmpBitmap, LJSrcRect, LJDestRectf, LPaint);
if (Shadow <> nil) and
(Shadow.enabled) then LPaint.clearShadowLayer;
Expand All @@ -9645,7 +9645,7 @@ procedure ALPaintCircle(
else if Fill.Kind = TBrushKind.Solid then begin
LPaint.setColor(integer(Fill.Color));
if (Shadow <> nil) and
(Shadow.enabled) then LPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.ShadowColor){shadowColor});
(Shadow.enabled) then LPaint.setShadowLayer(Shadow.blur{radius}, Shadow.OffsetX{dx}, Shadow.OffsetY{dy}, integer(Shadow.Color){shadowColor});
aCanvas.drawCircle(LRect.CenterPoint.x{cx}, LRect.CenterPoint.y{cy}, LRect.width / 2{radius}, LPaint);
if (Shadow <> nil) and
(Shadow.enabled) then LPaint.clearShadowLayer;
Expand Down
1 change: 0 additions & 1 deletion Source/Alcinoe.FMX.Memo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,6 @@ constructor TALStyledMemo.Create(AOwner: TComponent);
fTextPromptControl.Anchors := [TAnchorKind.akLeft, TAnchorKind.akTop, TAnchorKind.akRight, TAnchorKind.akBottom];
fTextPromptControl.TextSettings.Assign(FTextSettings);
fTextPromptControl.color := TalphaColorRec.Null;
fTextPromptControl.doubleBuffered := True;
FOnChangeTracking := nil;
fReturnKeyType := TReturnKeyType.Default;
inherited onchangeTracking := OnChangeTrackingImpl;
Expand Down
Loading

0 comments on commit 3bad90a

Please sign in to comment.