From 3887d4ba32d25e20f2105afb7295817942b2f503 Mon Sep 17 00:00:00 2001 From: blikblum Date: Mon, 18 Jun 2007 14:57:33 +0000 Subject: [PATCH] * Fix compilation using EnableAdvancedGraphics define * Fix objects demo project file * Remove lcltypes.inc file git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@182 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../virtualtreeview-unstable/VTConfig.inc | 3 +- .../virtualtreeview-unstable/VirtualTrees.pas | 29 ++++++++++++++++--- .../demos/objects/mvcdemo.lpi | 3 -- .../virtualtreeview-unstable/lcltypes.inc | 6 ---- 4 files changed, 27 insertions(+), 14 deletions(-) delete mode 100644 components/virtualtreeview-unstable/lcltypes.inc diff --git a/components/virtualtreeview-unstable/VTConfig.inc b/components/virtualtreeview-unstable/VTConfig.inc index 5384f960d..138c0c529 100644 --- a/components/virtualtreeview-unstable/VTConfig.inc +++ b/components/virtualtreeview-unstable/VTConfig.inc @@ -30,7 +30,8 @@ {.$define EnablePrint} {$define NeedWindows} {.$define EnableNCFunctions} -{.$define EnableAdvancedGraphics} +{$define EnableAdvancedGraphics} +{$define EnableAlphaBlend} {$define EnableHeader} {$define EnableTimer} {.$define EnableAccessible} diff --git a/components/virtualtreeview-unstable/VirtualTrees.pas b/components/virtualtreeview-unstable/VirtualTrees.pas index c30ee5ff7..08746142c 100644 --- a/components/virtualtreeview-unstable/VirtualTrees.pas +++ b/components/virtualtreeview-unstable/VirtualTrees.pas @@ -263,7 +263,6 @@ var // Clipboard format IDs used in OLE drag'n drop and clipboard transfers. {$MinEnumSize 1, make enumerations as small as possible} type - {$I lcltypes.inc} // The exception used by the trees. EVirtualTreeError = class(Exception); @@ -4444,6 +4443,21 @@ end; //---------------------------------------------------------------------------------------------------------------------- +function GetBitmapBitsFromBitmap(Bitmap: HBITMAP): Pointer; +var + DIB: TDIBSection; +begin + Result := nil; + if Bitmap <> 0 then + begin + if GetObject(Bitmap, SizeOf(DIB), @DIB) = SizeOf(DIB) then + begin + Assert(DIB.dsBm.bmPlanes * DIB.dsBm.bmBitsPixel = 32, 'Alpha blending error: bitmap must use 32 bpp.'); + Result := DIB.dsBm.bmBits; + end; + end; +end; + function CalculateScanline(Bits: Pointer; Width, Height, Row: Integer): Pointer; // Helper function to calculate the start address for the given row. @@ -6991,9 +7005,16 @@ var HalfWidth, HalfHeight: Integer; T: Extended; + SourceBits, TargetBits: Pointer; begin {$ifdef EnableAdvancedGraphics} + SourceBits := GetBitmapBitsFromBitmap(Source.Handle); + TargetBits := GetBitmapBitsFromBitmap(Target.Handle); + + if (SourceBits = nil) or (TargetBits = nil) then + Exit; + UseColorKey := ColorKey <> clNone; ColorKeyRef := ColorToRGB(ColorKey) and $FFFFFF; // Color values are in the form BGR (red on LSB) while bitmap colors are in the form ARGB (blue on LSB) @@ -7013,8 +7034,8 @@ begin HalfHeight := Height div 2; for Y := 0 to Height - 1 do begin - TargetRun := Scanline[Y]; - SourceRun := Source.Scanline[Y]; + TargetRun := CalculateScanline(TargetBits, Width, Height, Y); + SourceRun := CalculateScanline(SourceBits, Source.Width, Source.Height, Y); for X := 0 to Width - 1 do begin Color := SourceRun.Color and $FFFFFF; @@ -17258,7 +17279,7 @@ begin NewCursor := crVT_MOVES; end; end; - + // Now load the cursor and apply it. Cursor := NewCursor; end; diff --git a/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi b/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi index 13ca0f4d2..363b0a120 100644 --- a/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi +++ b/components/virtualtreeview-unstable/demos/objects/mvcdemo.lpi @@ -65,10 +65,7 @@ -<<<<<<< .mine -======= ->>>>>>> .r167 diff --git a/components/virtualtreeview-unstable/lcltypes.inc b/components/virtualtreeview-unstable/lcltypes.inc deleted file mode 100644 index b8e2bb277..000000000 --- a/components/virtualtreeview-unstable/lcltypes.inc +++ /dev/null @@ -1,6 +0,0 @@ - - - - //TBiDiMode = (bdLeftToRight, bdRightToLeft, bdRightToLeftNoAlign, bdRightToLeftReadingOnly); - -