customdrawn-android: Now OnPaint renders correctly

git-svn-id: trunk@33823 -
This commit is contained in:
sekelsenmat 2011-11-28 10:47:46 +00:00
parent 4afd5cec0f
commit 6478043aae
2 changed files with 11 additions and 11 deletions

View File

@ -417,7 +417,6 @@ var
lCurForm: TCDNonNativeForm; lCurForm: TCDNonNativeForm;
struct : TPaintStruct; struct : TPaintStruct;
lWidth, lHeight: Integer;
lBitmap, lMask: HBITMAP; lBitmap, lMask: HBITMAP;
lRawImage: TRawImage; lRawImage: TRawImage;
{$IFDEF VerboseCDPaintProfiler} {$IFDEF VerboseCDPaintProfiler}
@ -446,13 +445,10 @@ begin
{$ENDIF} {$ENDIF}
//if (AWinControl = nil) or (AWindowInfo = nil) then Exit; //if (AWinControl = nil) or (AWindowInfo = nil) then Exit;
lWidth := 200;//Round(AWinControl.width);
lHeight := 200;//Round(AWinControl.height);
FillChar(struct, SizeOf(TPaintStruct), 0); FillChar(struct, SizeOf(TPaintStruct), 0);
// Prepare the non-native image and canvas // Prepare the non-native image and canvas
UpdateControlLazImageAndCanvas(lCurForm.Image, lCurForm.Canvas, lWidth, lHeight, clfBGRA32, pixels); UpdateControlLazImageAndCanvas(lCurForm.Image, lCurForm.Canvas, Width, Height, clfRGBA32, pixels);
struct.hdc := HDC(lCurForm.Canvas); struct.hdc := HDC(lCurForm.Canvas);

View File

@ -17,7 +17,8 @@ uses
type type
TUpdateLazImageFormat = ( TUpdateLazImageFormat = (
clfRGB16_R5G6B5, clfRGB16_R5G6B5,
clfRGB24, clfRGB24UpsideDown, clfBGR24, clfBGRA32); clfRGB24, clfRGB24UpsideDown, clfBGR24,
clfBGRA32, clfRGBA32, clfARGB32);
TCDWinControl = class TCDWinControl = class
public public
@ -150,6 +151,8 @@ begin
clfRGB24UpsideDown: lRawImage.Description.Init_BPP24_R8G8B8_BIO_TTB_UpsideDown(AWidth, AHeight); clfRGB24UpsideDown: lRawImage.Description.Init_BPP24_R8G8B8_BIO_TTB_UpsideDown(AWidth, AHeight);
clfBGR24: lRawImage.Description.Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight); clfBGR24: lRawImage.Description.Init_BPP24_B8G8R8_BIO_TTB(AWidth, AHeight);
clfBGRA32: lRawImage.Description.Init_BPP32_B8G8R8A8_BIO_TTB(AWidth, AHeight); clfBGRA32: lRawImage.Description.Init_BPP32_B8G8R8A8_BIO_TTB(AWidth, AHeight);
clfRGBA32: lRawImage.Description.Init_BPP32_R8G8B8A8_BIO_TTB(AWidth, AHeight);
clfARGB32: lRawImage.Description.Init_BPP32_A8R8G8B8_BIO_TTB(AWidth, AHeight);
end; end;
// Now connect the pixel buffer or create one // Now connect the pixel buffer or create one
@ -157,11 +160,12 @@ begin
else else
begin begin
case AFormat of case AFormat of
clfRGB16_R5G6B5: lPixelSize := 2; clfRGB16_R5G6B5:
clfRGB24: lPixelSize := 3; lPixelSize := 2;
clfRGB24UpsideDown: lPixelSize := 3; clfRGB24, clfRGB24UpsideDown, clfBGR24:
clfBGR24: lPixelSize := 3; lPixelSize := 3;
clfBGRA32: lPixelSize := 4; clfBGRA32, clfRGBA32, clfARGB32:
lPixelSize := 4;
end; end;
lRawImage.Data := AData; lRawImage.Data := AData;