LCL-CustomDrawn-X11: Fixes the screenshot code

git-svn-id: trunk@36559 -
This commit is contained in:
sekelsenmat 2012-04-04 13:55:48 +00:00
parent 1bcb7d9585
commit f1243984e6
4 changed files with 18 additions and 22 deletions

View File

@ -312,8 +312,12 @@ begin
Result := TQtDesignWidget(WindowHandle).DesignContext = DC;
end;*)
function TCDWidgetSet.RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer
): Boolean;
function TCDWidgetSet.IsScreenDC(ADC: HDC): Boolean;
begin
Result := (ADC = HDC(Self.ScreenDC));
end;
function TCDWidgetSet.RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean;
begin
Result := IsValidDC(DC);
{ if Result then
@ -430,14 +434,21 @@ end;
Params: ADC:
ADesc:
Returns:
Describes the standard format utilized by Qt
------------------------------------------------------------------------------}
function TCDWidgetSet.RawImage_DescriptionFromDevice(ADC: HDC; out ADesc: TRawImageDescription): Boolean;
var
lSize: TPoint;
begin
Result := true;
ADesc.Init_BPP32_A8R8G8B8_BIO_TTB(100, 100);
if ADC = 0 then
begin
GetDeviceSize(ADC, lSize);
ADesc.Init_BPP32_A8R8G8B8_BIO_TTB(lSize.X, lSize.Y);
Exit;
end;
ADesc := TLazIntfImage(TLazCanvas(ADC).Image).DataDescription;
end;
{------------------------------------------------------------------------------

View File

@ -232,22 +232,6 @@ begin
ARawImage.Mask:=nil;
ARawImage.Palette:=nil;
Result := True;
(* ARawImage.Init;
ARawImage.Description.Init_BPP32_A8R8G8B8_BIO_TTB(ScreenBitmapWidth, ScreenBitmapHeight);
// Take the screenshot
screenshotImage := CGDisplayCreateImage(CGMainDisplayID()); // Requires 10.6+
// Draw it to our screen bitmap
lRect := CGRectMake(0, 0, ScreenBitmapWidth, ScreenBitmapHeight);
CGContextDrawImage(ScreenBitmapContext, lRect, screenshotImage);
// Now copy the data
ScreenImage.GetRawImage(lScreenRawImage, False);
ARawImage.CreateData(False);
lDataLength := Min(lScreenRawImage.DataSize, ARawImage.DataSize);
System.Move(lScreenRawImage.Data^, ARawImage.Data^, lDataLength); *)
end;
procedure TCDWidgetset.ShowVirtualKeyboard();

View File

@ -56,6 +56,7 @@ procedure HideVirtualKeyboard();
(*
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;*)
function IsMobilePlatform: Boolean; override;
function IsScreenDC(ADC: HDC): Boolean;
function PromptUser(const DialogCaption : string;
const DialogMessage : string;

View File

@ -2904,7 +2904,7 @@ begin
Result:= False;
// Screen size
if DC = 0 then
if IsScreenDC(DC) or (DC = 0) then
begin
P.X:= GetSystemMetrics(SM_CXSCREEN);
P.Y:= GetSystemMetrics(SM_CYSCREEN);