From 018b0c251c2c0c9b08170ad2363fc4419f6f41eb Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 11 Jun 2008 23:49:53 +0000 Subject: [PATCH] * The StrokeLine() variation that takes a rgb_color did change the drawing state of the painter without restoring it afterwards (HighColor and DrawingMode). This function is only used in decorators, but as such it could lead to strange effects. When clicking and holding the close button on the R5 MidiPlayer for example, the background of the scope would suddenly become the color of the close buttons middle line. As the drawing mode was also overwritten this could probably have lead to text rendering issues when zooming applications. As I didn't find a easy way to reproduce such a thing, this is only theory though. * Implement the missing IsExclusiveAccessLocked() method in the DrawingEngine which is not used at the moment. If corresponding debug output is generated though, it reveals possible locking issues with CopyRegion(). * Remove an empty line in the LineArrayData struct. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25934 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/DrawingEngine.cpp | 13 +++++++++++++ src/servers/app/drawing/DrawingEngine.h | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/servers/app/drawing/DrawingEngine.cpp b/src/servers/app/drawing/DrawingEngine.cpp index 25e30f474c..7f1c85e1c7 100644 --- a/src/servers/app/drawing/DrawingEngine.cpp +++ b/src/servers/app/drawing/DrawingEngine.cpp @@ -132,6 +132,13 @@ DrawingEngine::LockExclusiveAccess() } +bool +DrawingEngine::IsExclusiveAccessLocked() +{ + return fGraphicsCard->IsExclusiveAccessLocked(); +} + + void DrawingEngine::UnlockExclusiveAccess() { @@ -682,9 +689,15 @@ DrawingEngine::StrokeLine(const BPoint &start, const BPoint &end, AutoFloatingOverlaysHider _(fGraphicsCard, touched); if (!fPainter->StraightLine(start, end, color)) { + rgb_color previousColor = fPainter->HighColor(); + drawing_mode previousMode = fPainter->DrawingMode(); + fPainter->SetHighColor(color); fPainter->SetDrawingMode(B_OP_OVER); fPainter->StrokeLine(start, end); + + fPainter->SetDrawingMode(previousMode); + fPainter->SetHighColor(previousColor); } _CopyToFront(touched); diff --git a/src/servers/app/drawing/DrawingEngine.h b/src/servers/app/drawing/DrawingEngine.h index b6745522bf..d3a59c27ed 100644 --- a/src/servers/app/drawing/DrawingEngine.h +++ b/src/servers/app/drawing/DrawingEngine.h @@ -32,7 +32,6 @@ typedef struct { BPoint pt1; BPoint pt2; rgb_color color; - } LineArrayData; class DrawingEngine : public HWInterfaceListener {