View Issue Details

IDProjectCategoryView StatusLast Update
0026748PatchesWidgetsetpublic2016-02-16 12:24
ReporterAndrew G. KhodotovAssigned ToFelipe Monteiro de Carvalho 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Platformarm-winceOSWindows MobileOS Version6.5 Professional
Product Version1.2.4Product Build 
Target VersionFixed in Version 
Summary0026748: [Patch] Improved CreateBrushIndirect workaround
DescriptionCreateBrushIndirect doesn't exist under Windows CE (http://wiki.freepascal.org/Windows_CE_Development_Notes#Brushes), and TWinCEWidgetSet.CreateBrushIndirect uses workaround: call one of three other functions depend on brush style (BS_NULL, or BS_DIBPATTERNPT, or BS_SOLID in other cases).
But function CreatePatternBrush from lcl\include\winapi.inc try to create brush with style BS_PATTERN. In the train of this we can see solid (black?) brush.
Additional InformationAttached patch append creation of hBitmap (not DIB) patterned brush. In my mind it's solve http://bugs.freepascal.org/view.php?id=13483, http://bugs.freepascal.org/view.php?id=13022, http://bugs.freepascal.org/view.php?id=19110, http://bugs.freepascal.org/view.php?id=15068, http://bugs.freepascal.org/view.php?id=21998 and maybe some else issues about
blackness on the flat tool- and speedbuttons.
 
And I also replase chain of "if-else-if..." to single "case" clause: I think it's more readable and neat.
Tagspatch
Fixed in Revision46732
LazTarget-
WidgetsetWinCE
Attached Files
  • wincewinapi.inc.patch (1,021 bytes)
    Index: wincewinapi.inc
    ===================================================================
    --- wincewinapi.inc
    +++ wincewinapi.inc
    @@ -754,12 +754,13 @@ begin
       LB.lbHatch := LogBrush.lbHatch;
       //DebugLn(Format('Trace:> [TWinCEWidgetSet.CreateBrushIndirect]  Style: %d, Color: %8x', [lb.lbStyle, lb.lbColor]));
     
    -  if lb.lbStyle= BS_NULL then
    -    Result := Windows.GetStockObject(NULL_BRUSH)
    -  else if lb.lbStyle = BS_DIBPATTERNPT then
    -    Result := CreateDIBPatternBrushPt(pointer(lb.lbHatch), lb.lbColor)
    -  else { lb.lbStyle = BS_SOLID }
    -    Result := Windows.CreateSolidBrush(LB.lbColor);
    +  case lb.lbStyle
    +    of BS_NULL:Result := Windows.GetStockObject(NULL_BRUSH);
    +       BS_DIBPATTERNPT:Result := CreateDIBPatternBrushPt(pointer(lb.lbHatch), lb.lbColor);
    +       BS_PATTERN:CreatePatternBrush(lb.lbHatch)
    +    else { lb.lbStyle = BS_SOLID }
    +      Result := Windows.CreateSolidBrush(LB.lbColor)
    +  end
     
       //DebugLn(Format('Trace:< [TWinCEWidgetSet.CreateBrushIndirect] Got --> %x', [Result]));
     end;
    
    wincewinapi.inc.patch (1,021 bytes)

Relationships

related to 0015068 closedPaul Ishenin Lazarus Incorrect drawing of buttons when not using themes 
related to 0019110 resolvedFelipe Monteiro de Carvalho Lazarus [WinCE] TToolButton/TSpeedButton has a black background 
related to 0013022 closedFelipe Monteiro de Carvalho Lazarus TSpeedButton has black background in WinCE 
related to 0013483 closedFelipe Monteiro de Carvalho Lazarus TSpeedButton Down 
related to 0021998 resolvedStephano Lazarus TSpeedButton in check mode still has black background when down (WinCE) 

Activities

Andrew G. Khodotov

2014-09-19 19:14

reporter  

wincewinapi.inc.patch (1,021 bytes)
Index: wincewinapi.inc
===================================================================
--- wincewinapi.inc
+++ wincewinapi.inc
@@ -754,12 +754,13 @@ begin
   LB.lbHatch := LogBrush.lbHatch;
   //DebugLn(Format('Trace:> [TWinCEWidgetSet.CreateBrushIndirect]  Style: %d, Color: %8x', [lb.lbStyle, lb.lbColor]));
 
-  if lb.lbStyle= BS_NULL then
-    Result := Windows.GetStockObject(NULL_BRUSH)
-  else if lb.lbStyle = BS_DIBPATTERNPT then
-    Result := CreateDIBPatternBrushPt(pointer(lb.lbHatch), lb.lbColor)
-  else { lb.lbStyle = BS_SOLID }
-    Result := Windows.CreateSolidBrush(LB.lbColor);
+  case lb.lbStyle
+    of BS_NULL:Result := Windows.GetStockObject(NULL_BRUSH);
+       BS_DIBPATTERNPT:Result := CreateDIBPatternBrushPt(pointer(lb.lbHatch), lb.lbColor);
+       BS_PATTERN:CreatePatternBrush(lb.lbHatch)
+    else { lb.lbStyle = BS_SOLID }
+      Result := Windows.CreateSolidBrush(LB.lbColor)
+  end
 
   //DebugLn(Format('Trace:< [TWinCEWidgetSet.CreateBrushIndirect] Got --> %x', [Result]));
 end;
wincewinapi.inc.patch (1,021 bytes)

Felipe Monteiro de Carvalho

2014-10-31 17:51

developer   ~0078786

Thanks, applied

Andrew G. Khodotov

2016-02-16 12:24

reporter   ~0090057

Tested in LCL 1.6RC1. OK.
Thanks.

Issue History

Date Modified Username Field Change
2014-09-19 19:14 Andrew G. Khodotov New Issue
2014-09-19 19:14 Andrew G. Khodotov File Added: wincewinapi.inc.patch
2014-09-19 23:57 Juha Manninen Relationship added related to 0021998
2014-09-20 00:10 Mike Thompson Tag Attached: patch
2014-09-20 00:13 Juha Manninen Relationship added related to 0015068
2014-09-20 00:15 Juha Manninen Relationship added related to 0019110
2014-09-20 00:15 Juha Manninen Relationship added related to 0013022
2014-09-20 00:16 Juha Manninen Relationship added related to 0013483
2014-09-20 00:21 Juha Manninen Assigned To => Felipe Monteiro de Carvalho
2014-09-20 00:21 Juha Manninen Status new => assigned
2014-10-31 17:51 Felipe Monteiro de Carvalho Fixed in Revision => 46732
2014-10-31 17:51 Felipe Monteiro de Carvalho LazTarget => -
2014-10-31 17:51 Felipe Monteiro de Carvalho Note Added: 0078786
2014-10-31 17:51 Felipe Monteiro de Carvalho Status assigned => resolved
2014-10-31 17:51 Felipe Monteiro de Carvalho Resolution open => fixed
2016-02-16 12:24 Andrew G. Khodotov Note Added: 0090057
2016-02-16 12:24 Andrew G. Khodotov Status resolved => closed