* Fix compilation under 64bit in windows

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2543 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2012-09-29 00:54:13 +00:00
parent 1b56006473
commit fef43dbcff
2 changed files with 47 additions and 9 deletions

View File

@ -6,13 +6,19 @@ procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; C
// ConstantAlpha must be in the range 0..255 where 0 means totally transparent (destination pixel only) // ConstantAlpha must be in the range 0..255 where 0 means totally transparent (destination pixel only)
// and 255 totally opaque (source pixel only). // and 255 totally opaque (source pixel only).
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// ConstantAlpha and Bias are on the stack // ConstantAlpha and Bias are on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -69,6 +75,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -78,13 +85,19 @@ procedure AlphaBlendLinePerPixel(Source, Destination: Pointer; Count, Bias: Inte
// Blends a line of Count pixels from Source to Destination using the alpha value of the source pixels. // Blends a line of Count pixels from Source to Destination using the alpha value of the source pixels.
// The layout of a pixel must be BGRA. // The layout of a pixel must be BGRA.
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// Bias is on the stack // Bias is on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -140,6 +153,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -150,13 +164,20 @@ procedure AlphaBlendLineMaster(Source, Destination: Pointer; Count: Integer; Con
// The layout of a pixel must be BGRA. // The layout of a pixel must be BGRA.
// ConstantAlpha must be in the range 0..255. // ConstantAlpha must be in the range 0..255.
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// ConstantAlpha and Bias are on the stack // ConstantAlpha and Bias are on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -221,6 +242,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -230,13 +252,20 @@ procedure AlphaBlendLineMasterAndColor(Destination: Pointer; Count: Integer; Con
// Blends a line of Count pixels in Destination against the given color using a constant alpha value. // Blends a line of Count pixels in Destination against the given color using a constant alpha value.
// The layout of a pixel must be BGRA and Color must be rrggbb00 (as stored by a COLORREF). // The layout of a pixel must be BGRA and Color must be rrggbb00 (as stored by a COLORREF).
// ConstantAlpha must be in the range 0..255. // ConstantAlpha must be in the range 0..255.
//
asm
{$ifdef CPU64}
{$else}
// EAX contains Destination // EAX contains Destination
// EDX contains Count // EDX contains Count
// ECX contains ConstantAlpha // ECX contains ConstantAlpha
// Color is passed on the stack // Color is passed on the stack
asm
// The used formula is: target = (alpha * color + (256 - alpha) * target) / 256. // The used formula is: target = (alpha * color + (256 - alpha) * target) / 256.
// alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance. // alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance.
// The remaining calculation is therefore: target = (F1 + F2 * target) / 256 // The remaining calculation is therefore: target = (F1 + F2 * target) / 256
@ -277,6 +306,7 @@ asm
ADD EAX, 4 ADD EAX, 4
DEC EDX DEC EDX
JNZ @1 JNZ @1
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -285,9 +315,17 @@ procedure EMMS;
// Reset MMX state to use the FPU for other tasks again. // Reset MMX state to use the FPU for other tasks again.
{$ifdef CPU64}
inline;
begin
end;
{$else}
asm asm
DB $0F, $77 /// EMMS DB $0F, $77 /// EMMS
end; end;
{$endif}
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ var
begin begin
if Msg = WM_PAINT then if Msg = WM_PAINT then
begin begin
PanningObject:=TVirtualPanningWindow(GetWindowLong(Window,GWL_USERDATA)); PanningObject:=TVirtualPanningWindow(GetWindowLongPtrW(Window,GWL_USERDATA));
if Assigned(PanningObject) then if Assigned(PanningObject) then
PanningObject.HandlePaintMessage; PanningObject.HandlePaintMessage;
end end