View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0015822 | Lazarus | LCL | public | 2010-02-20 13:32 | 2010-05-11 12:04 |
Reporter | zg | Assigned To | Dmitry Boyarintsev | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 0.9.28.3 (SVN) | Product Build | |||
Target Version | 0.9.30 | Fixed in Version | 0.9.29 (SVN) | ||
Summary | 0015822: vista/server 2008 SetPixel bug. | ||||
Description | The Vista/Server 2008 has a bug in SetPixel. In case you using windows classic theme the SetPixel dont' draw pixels with 8 bit setted in X-coordinate (256-511, 768-1023,...). The attached patch workaround this problem. | ||||
Additional Information | discussion on msdn forum: http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/thread/9100f5cc-dbc9-4b4a-a46f-23c434d76e87/ related bug: http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=10332 | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 25291 | ||||
LazTarget | 0.9.30 | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
related to | 0010332 | closed | Vincent Snijders | DrawGrid.Canvas.Pixel problem with x coords 256-511 (bit 8 set) (Windows) |
2010-02-20 13:32
|
vista_setpixel.zip (882 bytes) |
|
Sorry, this is workaround for a Vista bug. The bug needs to be fixed in Vista instead of Lazarus. |
|
in ideal world - yes. but unfortunately we live in real world. this bug known from vista release (and may be early), now sp2 and bug still not fixed. so no any chance it will be ever fixed. |
|
I suppose this is similar problem in http://www.lazarus.freepascal.org/index.php/topic,8482.0.html. I agree to leave it to MS. |
|
> I agree to leave it to MS. ms known about this problem at least three years. in win7 code that cause this bug — removed. so chance that it will be fixed — 0. anyway that is problem with offered patch? |
|
Again. This windows bug will not be fixed in the LCL. If you want you can fix it in your application. LCL has no goal to workaound system behavior. |
|
> If you want you can fix it in your application. please explain me how i can fix standard grid painting (TCustomDrawGrid.DrawFocusRect->DrawRubberRect->DrawVertLine/DrawHorzLine->TCanvass.SetPixel) without changing lcl sources? |
|
LCL should be cross-platform and should work correctly on each windows platform :) Fixed patch a bit. |
2010-05-08 19:21
|
vista_setpixel2.patch (1,878 bytes)
Index: lcl/interfaces/win32/win32object.inc =================================================================== --- lcl/interfaces/win32/win32object.inc (revision 25226) +++ lcl/interfaces/win32/win32object.inc (working copy) @@ -730,9 +730,31 @@ Set the color of the specified pixel on the canvas ------------------------------------------------------------------------------} + +var + IntSetPixel : function (DC:HDC; X, Y:longint; cl:Windows.COLORREF):Windows.COLORREF; stdcall = nil; + +function VistaSetPixel(DC:HDC; X,Y:longint; cl:Windows.COLORREF):Windows.COLORREF; stdcall; +var + pen, oldpen: HPEN; +begin + if x and $100=0 then + Result:=Windows.SetPixel(DC,X,Y,cl) + else + begin + pen := Windows.CreatePen(PS_SOLID, 1, Windows.ColorRef(ColorToRGB(cl))); + oldpen := Windows.SelectObject(DC, pen); + Windows.MoveToEx(DC, X, Y, nil); + Windows.LineTo(DC, X, Y + 1); + Windows.SelectObject(DC, oldpen); + Windows.DeleteObject(pen); + Result:=cl; + end; +end; + procedure TWin32WidgetSet.DCSetPixel(CanvasHandle: HDC; X, Y: integer; AColor: TGraphicsColor); begin - Windows.SetPixel(CanvasHandle, X, Y, Windows.ColorRef(ColorToRGB(AColor))); + IntSetPixel(CanvasHandle, X, Y, Windows.ColorRef(ColorToRGB(AColor))); end; {------------------------------------------------------------------------------ Index: lcl/interfaces/win32/win32int.pp =================================================================== --- lcl/interfaces/win32/win32int.pp (revision 25226) +++ lcl/interfaces/win32/win32int.pp (working copy) @@ -305,6 +305,11 @@ then MMenuItemInfoSize := W95_MENUITEMINFO_SIZE else MMenuItemInfoSize := sizeof(MENUITEMINFO); + if WindowsVersion=wvVista then + IntSetPixel:=@VistaSetPixel + else + IntSetPixel:=@Windows.SetPixel; + finalization if CurDoubleBuffer.Bitmap <> 0 then begin |
|
please test and close if ok |
2010-05-10 11:05
|
missed.7z (333 bytes) |
|
one direct SetPixel call still exists. |
|
please test and close if ok |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-02-20 13:32 | zg | New Issue | |
2010-02-20 13:32 | zg | File Added: vista_setpixel.zip | |
2010-02-20 13:32 | zg | Widgetset | => Win32/Win64 |
2010-03-12 14:52 | Vincent Snijders | Relationship added | related to 0010332 |
2010-03-12 14:55 | Vincent Snijders | LazTarget | => 0.9.30 |
2010-03-12 14:55 | Vincent Snijders | Status | new => acknowledged |
2010-03-12 14:55 | Vincent Snijders | Target Version | => 0.9.30 |
2010-04-19 10:26 | Paul Ishenin | Status | acknowledged => resolved |
2010-04-19 10:26 | Paul Ishenin | Fixed in Version | => 0.9.29 (SVN) |
2010-04-19 10:26 | Paul Ishenin | Resolution | open => won't fix |
2010-04-19 10:26 | Paul Ishenin | Assigned To | => Paul Ishenin |
2010-04-19 10:26 | Paul Ishenin | Note Added: 0036815 | |
2010-05-06 01:20 | zg | Status | resolved => assigned |
2010-05-06 01:20 | zg | Resolution | won't fix => reopened |
2010-05-06 01:20 | zg | Note Added: 0037313 | |
2010-05-06 03:52 | malcome | Note Added: 0037315 | |
2010-05-06 11:30 | zg | Note Added: 0037319 | |
2010-05-07 05:43 | Paul Ishenin | Status | assigned => resolved |
2010-05-07 05:43 | Paul Ishenin | Resolution | reopened => won't fix |
2010-05-07 05:43 | Paul Ishenin | Note Added: 0037340 | |
2010-05-08 16:45 | zg | Status | resolved => assigned |
2010-05-08 16:45 | zg | Resolution | won't fix => reopened |
2010-05-08 16:45 | zg | Note Added: 0037363 | |
2010-05-08 18:46 | Paul Ishenin | Assigned To | Paul Ishenin => |
2010-05-08 18:46 | Paul Ishenin | Status | assigned => acknowledged |
2010-05-08 19:21 | Dmitry Boyarintsev | Note Added: 0037369 | |
2010-05-08 19:21 | Dmitry Boyarintsev | File Added: vista_setpixel2.patch | |
2010-05-09 15:45 | Paul Ishenin | Status | acknowledged => assigned |
2010-05-09 15:45 | Paul Ishenin | Assigned To | => Dmitry Boyarintsev |
2010-05-09 17:11 | Dmitry Boyarintsev | Fixed in Revision | => 25277 |
2010-05-09 17:11 | Dmitry Boyarintsev | Status | assigned => resolved |
2010-05-09 17:11 | Dmitry Boyarintsev | Resolution | reopened => fixed |
2010-05-09 17:11 | Dmitry Boyarintsev | Note Added: 0037397 | |
2010-05-10 11:05 | zg | File Added: missed.7z | |
2010-05-10 11:06 | zg | Status | resolved => assigned |
2010-05-10 11:06 | zg | Resolution | fixed => reopened |
2010-05-10 11:06 | zg | Note Added: 0037411 | |
2010-05-10 11:34 | Dmitry Boyarintsev | Note Added: 0037414 | |
2010-05-10 11:35 | Dmitry Boyarintsev | Fixed in Revision | 25277 => 25291 |
2010-05-10 11:35 | Dmitry Boyarintsev | Status | assigned => resolved |
2010-05-10 11:35 | Dmitry Boyarintsev | Resolution | reopened => fixed |
2010-05-11 12:04 | zg | Status | resolved => closed |