Removed a couple of deadlocks caused by missing DisplayDriver unlocks

remove possible NULL pointer crash in LayerData
Added low-level clipping to ViewDriver
Some minor UI tweaks to WinBorder


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10216 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-11-24 20:07:41 +00:00
parent eb740ad17f
commit 9655bd6c06
4 changed files with 32 additions and 7 deletions
+13
View File
@@ -146,6 +146,7 @@ void DisplayDriver::DrawBitmap(BRegion *region, ServerBitmap *bitmap, const BRec
if(!AcquireBuffer(&frameBuffer)) if(!AcquireBuffer(&frameBuffer))
{ {
debugger("ERROR: Couldn't acquire framebuffer in DrawBitmap()\n"); debugger("ERROR: Couldn't acquire framebuffer in DrawBitmap()\n");
Unlock();
return; return;
} }
@@ -306,6 +307,7 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
if(!AcquireBuffer(&frameBuffer)) if(!AcquireBuffer(&frameBuffer))
{ {
debugger("ERROR: Couldn't acquire framebuffer in CopyRegionList()\n"); debugger("ERROR: Couldn't acquire framebuffer in CopyRegionList()\n");
Unlock();
return; return;
} }
@@ -2382,6 +2384,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
end.x=MAX(first.x,MAX(second.x,third.x)); end.x=MAX(first.x,MAX(second.x,third.x));
StrokeSolidLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), color); StrokeSolidLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), color);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2397,6 +2400,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
for(i=(int32)first.y+1; i<=third.y; i++) for(i=(int32)first.y+1; i<=third.y; i++)
StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2410,6 +2414,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
for(i=(int32)first.y; i<third.y; i++) for(i=(int32)first.y; i<third.y; i++)
StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2500,6 +2505,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
end.x=MAX(first.x,MAX(second.x,third.x)); end.x=MAX(first.x,MAX(second.x,third.x));
StrokePatternLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), d); StrokePatternLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), d);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2515,6 +2521,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
for(i=(int32)first.y+1; i<=third.y; i++) for(i=(int32)first.y+1; i<=third.y; i++)
StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2528,6 +2535,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
for(i=(int32)first.y; i<third.y; i++) for(i=(int32)first.y; i<third.y; i++)
StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2697,6 +2705,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
{ {
StrokeEllipse(r,color); StrokeEllipse(r,color);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -2865,6 +2874,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
{ {
StrokeEllipse(r,d); StrokeEllipse(r,d);
fCursorHandler.DriverShow(); fCursorHandler.DriverShow();
Unlock();
return; return;
} }
@@ -3733,7 +3743,10 @@ float DisplayDriver::StringWidth(const char *string, int32 length, const DrawDat
FontStyle *style=font->Style(); FontStyle *style=font->Style();
if(!style) if(!style)
{
Unlock();
return 0.0; return 0.0;
}
FT_Face face; FT_Face face;
FT_GlyphSlot slot; FT_GlyphSlot slot;
+1 -1
View File
@@ -49,7 +49,7 @@ DrawData::DrawData(void)
scale=1.0; scale=1.0;
fontAliasing=true; fontAliasing=true;
if(fontserver) if(fontserver && fontserver->GetSystemPlain())
font=*(fontserver->GetSystemPlain()); font=*(fontserver->GetSystemPlain());
clipReg=NULL; clipReg=NULL;
+1
View File
@@ -753,6 +753,7 @@ void ViewDriver::SetDrawData(const DrawData *d, bool set_font_data)
unlock=true; unlock=true;
} }
drawview->ConstrainClippingRegion(d->clipReg);
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->SetDrawingMode(d->draw_mode); drawview->SetDrawingMode(d->draw_mode);
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
+11
View File
@@ -304,21 +304,30 @@ void WinBorder::MouseUp(PointerEvent& evt)
if (!(Window()->IsLocked())) if (!(Window()->IsLocked()))
debugger("you must lock the attached ServerWindow object\n\t before calling WinBorder::MouseUp()\n"); debugger("you must lock the attached ServerWindow object\n\t before calling WinBorder::MouseUp()\n");
click_type action;
// find out where user clicked in Decorator
action = fDecorator->Clicked(evt.where, evt.buttons, evt.modifiers);
if(fIsMoving) if(fIsMoving)
{ {
fIsMoving = false; fIsMoving = false;
return; return;
} }
if (fIsResizing) if (fIsResizing)
{ {
fIsResizing = false; fIsResizing = false;
return; return;
} }
if (fIsZooming) if (fIsZooming)
{ {
fIsZooming = false; fIsZooming = false;
fDecorator->SetZoom(false); fDecorator->SetZoom(false);
fDecorator->DrawZoom(); fDecorator->DrawZoom();
if(action==DEC_ZOOM)
Window()->Zoom(); Window()->Zoom();
return; return;
} }
@@ -327,6 +336,7 @@ void WinBorder::MouseUp(PointerEvent& evt)
fIsClosing = false; fIsClosing = false;
fDecorator->SetClose(false); fDecorator->SetClose(false);
fDecorator->DrawClose(); fDecorator->DrawClose();
if(action==DEC_CLOSE)
Window()->Quit(); Window()->Quit();
return; return;
} }
@@ -335,6 +345,7 @@ void WinBorder::MouseUp(PointerEvent& evt)
fIsMinimizing = false; fIsMinimizing = false;
fDecorator->SetMinimize(false); fDecorator->SetMinimize(false);
fDecorator->DrawMinimize(); fDecorator->DrawMinimize();
if(action==DEC_MINIMIZE)
Window()->Minimize(true); Window()->Minimize(true);
return; return;
} }