View Issue Details

IDProjectCategoryView StatusLast Update
0019747LazarusLCLpublic2011-10-22 01:22
ReportercobinesAssigned ToFelipe Monteiro de Carvalho 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindows XPOS VersionSP3
Product Version0.9.31 (SVN)Product Build31679 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0019747: Masked property not set correctly when assigning TIcon to TBitmap
DescriptionIn procedure TRasterImage.Assign(Source: TPersistent);

FMasked is copied like this

    FMasked := SrcImage.FMasked;

TCustomIcon does not have FMasked variable set to True, however it overrides GetMasked to always return True.

After assigning TIcon to for example TBitmap Masked is not True, because FMasked is copied, not GetMasked.

Proposed solution:

a) Set FMasked to True in TCustomIcon, delete GetMasked so that base functions just returns FMasked.

b) Change

    FMasked := SrcImage.FMasked;
to
    FMasked := SrcImage.Masked;
TagsNo tags attached.
Fixed in Revision32932
LazTarget0.99.0
Widgetset
Attached Files
  • solutionA.diff (1,263 bytes)
    Index: lcl/graphics.pp
    ===================================================================
    --- lcl/graphics.pp	(revision 31679)
    +++ lcl/graphics.pp	(working copy)
    @@ -1602,7 +1602,6 @@
         function GetIndex(AFormat: TPixelFormat; AHeight, AWidth: Word): Integer;
         function GetBitmapHandle: HBITMAP; override;
         class function GetDefaultSize: TSize; virtual;
    -    function GetMasked: Boolean; override;
         function GetMaskHandle: HBITMAP; override;
         function GetPalette: HPALETTE; override;
         function GetPixelFormat: TPixelFormat; override;
    Index: lcl/include/icon.inc
    ===================================================================
    --- lcl/include/icon.inc	(revision 31679)
    +++ lcl/include/icon.inc	(working copy)
    @@ -499,6 +499,7 @@
       inherited Create;
       FCurrent := -1;
       FRequestedSize := Size(0, 0);
    +  FMasked := True;
     end;
     
     procedure TCustomIcon.Delete(Aindex: Integer);
    @@ -556,12 +557,6 @@
       Result := TSharedIcon(FSharedImage).GetIndex(AFormat, AHeight, AWidth);
     end;
     
    -function TCustomIcon.GetMasked: Boolean;
    -begin
    -  // per definition an icon is masked, but maybe we should make it settable for alpha images
    -  Result := True;
    -end;
    -
     function TCustomIcon.GetMaskHandle: HBITMAP;
     begin
       if FCurrent = -1
    
    solutionA.diff (1,263 bytes)
  • solutionB.diff (480 bytes)
    Index: lcl/include/rasterimage.inc
    ===================================================================
    --- lcl/include/rasterimage.inc	(revision 31679)
    +++ lcl/include/rasterimage.inc	(working copy)
    @@ -64,7 +64,7 @@
     
         FTransparentMode := SrcImage.FTransparentMode;
         FTransparentColor := SrcImage.FTransparentColor;
    -    FMasked := SrcImage.FMasked;
    +    FMasked := SrcImage.Masked;
     
         // -> check if already shared
         if SrcImage.FSharedImage <> FSharedImage
    
    solutionB.diff (480 bytes)

Activities

2011-07-16 06:04

 

solutionA.diff (1,263 bytes)
Index: lcl/graphics.pp
===================================================================
--- lcl/graphics.pp	(revision 31679)
+++ lcl/graphics.pp	(working copy)
@@ -1602,7 +1602,6 @@
     function GetIndex(AFormat: TPixelFormat; AHeight, AWidth: Word): Integer;
     function GetBitmapHandle: HBITMAP; override;
     class function GetDefaultSize: TSize; virtual;
-    function GetMasked: Boolean; override;
     function GetMaskHandle: HBITMAP; override;
     function GetPalette: HPALETTE; override;
     function GetPixelFormat: TPixelFormat; override;
Index: lcl/include/icon.inc
===================================================================
--- lcl/include/icon.inc	(revision 31679)
+++ lcl/include/icon.inc	(working copy)
@@ -499,6 +499,7 @@
   inherited Create;
   FCurrent := -1;
   FRequestedSize := Size(0, 0);
+  FMasked := True;
 end;
 
 procedure TCustomIcon.Delete(Aindex: Integer);
@@ -556,12 +557,6 @@
   Result := TSharedIcon(FSharedImage).GetIndex(AFormat, AHeight, AWidth);
 end;
 
-function TCustomIcon.GetMasked: Boolean;
-begin
-  // per definition an icon is masked, but maybe we should make it settable for alpha images
-  Result := True;
-end;
-
 function TCustomIcon.GetMaskHandle: HBITMAP;
 begin
   if FCurrent = -1
solutionA.diff (1,263 bytes)

2011-07-16 06:04

 

solutionB.diff (480 bytes)
Index: lcl/include/rasterimage.inc
===================================================================
--- lcl/include/rasterimage.inc	(revision 31679)
+++ lcl/include/rasterimage.inc	(working copy)
@@ -64,7 +64,7 @@
 
     FTransparentMode := SrcImage.FTransparentMode;
     FTransparentColor := SrcImage.FTransparentColor;
-    FMasked := SrcImage.FMasked;
+    FMasked := SrcImage.Masked;
 
     // -> check if already shared
     if SrcImage.FSharedImage <> FSharedImage
solutionB.diff (480 bytes)

Vincent Snijders

2011-10-06 12:47

manager   ~0052628

Target 0.99 for review of the patches.

Felipe Monteiro de Carvalho

2011-10-17 09:08

developer   ~0053079

Last edited: 2011-10-17 09:09

Thanks, applied solution A

cobines

2011-10-22 01:22

reporter   ~0053269

Thanks.

Issue History

Date Modified Username Field Change
2011-07-16 06:02 cobines New Issue
2011-07-16 06:04 cobines File Added: solutionA.diff
2011-07-16 06:04 cobines File Added: solutionB.diff
2011-10-06 12:47 Vincent Snijders LazTarget => 0.99.0
2011-10-06 12:47 Vincent Snijders Note Added: 0052628
2011-10-06 12:47 Vincent Snijders Status new => acknowledged
2011-10-06 12:47 Vincent Snijders Target Version => 0.99.0
2011-10-17 09:08 Felipe Monteiro de Carvalho Fixed in Revision => 32932
2011-10-17 09:08 Felipe Monteiro de Carvalho Status acknowledged => resolved
2011-10-17 09:08 Felipe Monteiro de Carvalho Fixed in Version => 0.9.31 (SVN)
2011-10-17 09:08 Felipe Monteiro de Carvalho Resolution open => fixed
2011-10-17 09:08 Felipe Monteiro de Carvalho Assigned To => Felipe Monteiro de Carvalho
2011-10-17 09:08 Felipe Monteiro de Carvalho Note Added: 0053079
2011-10-17 09:09 Felipe Monteiro de Carvalho Note Edited: 0053079
2011-10-22 01:22 cobines Status resolved => closed
2011-10-22 01:22 cobines Note Added: 0053269