mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 01:59:34 +02:00
customdrawn-android: Fixes the screen blinking
git-svn-id: trunk@33839 -
This commit is contained in:
parent
9063d804bf
commit
3a5fb38765
@ -35,7 +35,7 @@ uses
|
||||
{$ifdef CD_Cocoa}MacOSAll, CocoaAll, CocoaPrivate,{$endif}
|
||||
{$ifdef CD_X11}X, XLib, XUtil, customdrawn_x11proc,{unitxft, Xft font support}{$endif}
|
||||
{$ifdef CD_Android}
|
||||
cmem, customdrawn_androidproc, jni, bitmap, log,
|
||||
cmem, customdrawn_androidproc, jni, bitmap, log,
|
||||
{$endif}
|
||||
// Widgetset
|
||||
customdrawnproc,
|
||||
|
@ -93,7 +93,7 @@ begin
|
||||
FillChar(struct, SizeOf(TPaintStruct), 0);
|
||||
|
||||
// Prepare the non-native image and canvas
|
||||
UpdateControlLazImageAndCanvas(lCurForm.Image, lCurForm.Canvas, Width, Height, clfRGBA32, pixels);
|
||||
UpdateControlLazImageAndCanvas(lCurForm.Image, lCurForm.Canvas, Width, Height, clfRGBA32, pixels, True, False);
|
||||
|
||||
struct.hdc := HDC(lCurForm.Canvas);
|
||||
|
||||
|
@ -48,7 +48,7 @@ procedure HideForm(ACDForm: TCDNonNativeForm);
|
||||
|
||||
procedure UpdateControlLazImageAndCanvas(var AImage: TLazIntfImage;
|
||||
var ACanvas: TLazCanvas; AWidth, AHeight: Integer; AFormat: TUpdateLazImageFormat;
|
||||
AData: Pointer = nil);
|
||||
AData: Pointer = nil; AForceUpdate: Boolean = False; AFreeImageOnUpdate: Boolean = True);
|
||||
procedure RenderChildWinControls(var AImage: TLazIntfImage;
|
||||
var ACanvas: TLazCanvas; ACDControlsList: TFPList);
|
||||
//procedure RenderWinControl(var AImage: TLazIntfImage;
|
||||
@ -128,9 +128,10 @@ begin
|
||||
NonNativeForms.Move(lCurIndex, 0);
|
||||
end;
|
||||
|
||||
// If AForceUpdate=True then it will update even if the width and height remain the same
|
||||
procedure UpdateControlLazImageAndCanvas(var AImage: TLazIntfImage;
|
||||
var ACanvas: TLazCanvas; AWidth, AHeight: Integer; AFormat: TUpdateLazImageFormat;
|
||||
AData: Pointer = nil);
|
||||
AData: Pointer = nil; AForceUpdate: Boolean = False; AFreeImageOnUpdate: Boolean = True);
|
||||
var
|
||||
lRawImage: TRawImage;
|
||||
lPixelSize: Byte;
|
||||
@ -140,9 +141,10 @@ begin
|
||||
[PtrInt(AImage), PtrInt(ACanvas)]));
|
||||
{$ENDIF}
|
||||
// Check if the image needs update
|
||||
if (AImage = nil) or (AWidth <> AImage.Width) or (AHeight <> AImage.Height) then
|
||||
if (AImage = nil) or (AWidth <> AImage.Width) or (AHeight <> AImage.Height)
|
||||
or AForceUpdate then
|
||||
begin
|
||||
if (AImage <> nil) then AImage.Free;
|
||||
if (AImage <> nil) and AFreeImageOnUpdate then AImage.Free;
|
||||
|
||||
lRawImage.Init;
|
||||
case AFormat of
|
||||
|
Loading…
Reference in New Issue
Block a user