* now the Decorator uses the DrawingEngine instance of the WindowLayer,

so that we can draw the window borders using parallel access too.
  Seems to improve things even further, using the app_server environment
  with direct accelerant access on R5 looks pretty decent now, but
  of cause still far from perfect. The global font lock could actually
  be the problem now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19528 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-12-15 23:05:35 +00:00
parent 527b4ad1b3
commit b93f9f1371
3 changed files with 38 additions and 29 deletions

View File

@ -37,13 +37,14 @@ class DecorInfo {
image_id ID() const { return fID; }
const char* Name() const { return fName.String(); }
Decorator* Instantiate(Desktop* desktop, BRect rect, const char* title,
Decorator* Instantiate(Desktop* desktop, DrawingEngine* engine,
BRect rect, const char* title,
window_look look, uint32 flags);
private:
image_id fID;
BString fName;
create_decorator *fAllocator;
create_decorator* fAllocator;
};
@ -71,8 +72,8 @@ DecorInfo::~DecorInfo()
Decorator *
DecorInfo::Instantiate(Desktop* desktop, BRect rect, const char *title,
window_look look, uint32 flags)
DecorInfo::Instantiate(Desktop* desktop, DrawingEngine* engine, BRect rect,
const char *title, window_look look, uint32 flags)
{
if (!desktop->LockSingleWindow())
return NULL;
@ -92,7 +93,7 @@ DecorInfo::Instantiate(Desktop* desktop, BRect rect, const char *title,
desktop->UnlockSingleWindow();
decorator->SetDrawingEngine(desktop->GetDrawingEngine());
decorator->SetDrawingEngine(engine);
decorator->SetTitle(title);
return decorator;
@ -192,10 +193,11 @@ DecorManager::RescanDecorators()
Decorator *
DecorManager::AllocateDecorator(Desktop* desktop, BRect rect, const char *title,
window_look look, uint32 flags)
DecorManager::AllocateDecorator(Desktop* desktop, DrawingEngine* engine,
BRect rect, const char* title, window_look look, uint32 flags)
{
// Create a new instance of the current decorator. Ownership is that of the caller
// Create a new instance of the current decorator.
// Ownership is that of the caller
if (!fCurrentDecor) {
// We should *never* be here. If we do, it's a bug.
@ -203,7 +205,8 @@ DecorManager::AllocateDecorator(Desktop* desktop, BRect rect, const char *title,
return NULL;
}
return fCurrentDecor->Instantiate(desktop, rect, title, look, flags);
return fCurrentDecor->Instantiate(desktop, engine, rect, title,
look, flags);
}
@ -224,7 +227,7 @@ DecorManager::GetDecorator() const
bool
DecorManager::SetDecorator(int32 index)
{
DecorInfo *newDecInfo = (DecorInfo*)fDecorList.ItemAt(index);
DecorInfo* newDecInfo = (DecorInfo*)fDecorList.ItemAt(index);
if (newDecInfo) {
fCurrentDecor = newDecInfo;

View File

@ -17,7 +17,7 @@
class DecorInfo;
class Desktop;
class DrawingEngine;
class DecorManager : public BLocker {
public:
@ -26,8 +26,10 @@ class DecorManager : public BLocker {
void RescanDecorators();
Decorator* AllocateDecorator(Desktop* desktop, BRect rect,
const char *title, window_look look,
Decorator* AllocateDecorator(Desktop* desktop,
DrawingEngine* engine,
BRect rect,
const char* title, window_look look,
uint32 flags);
int32 CountDecorators() const;

View File

@ -137,22 +137,26 @@ WindowLayer::WindowLayer(const BRect& frame, const char *name,
SetFlags(flags, NULL);
if (fLook != B_NO_BORDER_WINDOW_LOOK) {
fDecorator = gDecorManager.AllocateDecorator(fDesktop, frame, name, fLook, fFlags);
if (fDecorator)
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
fDecorator = gDecorManager.AllocateDecorator(fDesktop, fDrawingEngine,
frame, name, fLook, fFlags);
if (fDecorator) {
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight,
&fMaxWidth, &fMaxHeight);
}
}
// do we need to change our size to let the decorator fit?
// _ResizeBy() will adapt the frame for validity before resizing
if (feel == kDesktopWindowFeel) {
// the desktop window spans over the whole screen
// ToDo: this functionality should be moved somewhere else (so that it
// is always used when the workspace is changed)
// ToDo: this functionality should be moved somewhere else
// (so that it is always used when the workspace is changed)
uint16 width, height;
uint32 colorSpace;
float frequency;
if (fDesktop->ScreenAt(0)) {
fDesktop->ScreenAt(0)->GetMode(width, height, colorSpace, frequency);
fDesktop->ScreenAt(0)->GetMode(width, height,
colorSpace, frequency);
// TODO: MOVE THIS AWAY!!! ResizeBy contains calls to virtual methods!
// Also, there is no TopLayer()!
fFrame.OffsetTo(B_ORIGIN);
@ -797,7 +801,7 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
visibleBorder->IntersectWith(&VisibleRegion());
DrawingEngine* engine = fDecorator->GetDrawingEngine();
engine->LockExclusiveAccess();
engine->LockParallelAccess();
engine->ConstrainClippingRegion(visibleBorder);
if (fIsZooming) {
@ -808,7 +812,7 @@ WindowLayer::MouseDown(BMessage* message, BPoint where, int32* _viewToken)
fDecorator->SetMinimize(true);
}
engine->UnlockExclusiveAccess();
engine->UnlockParallelAccess();
fRegionPool.Recycle(visibleBorder);
@ -874,7 +878,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
visibleBorder->IntersectWith(&VisibleRegion());
DrawingEngine* engine = fDecorator->GetDrawingEngine();
engine->LockExclusiveAccess();
engine->LockParallelAccess();
engine->ConstrainClippingRegion(visibleBorder);
if (fIsZooming) {
@ -902,7 +906,7 @@ WindowLayer::MouseUp(BMessage* message, BPoint where, int32* _viewToken)
}
}
engine->UnlockExclusiveAccess();
engine->UnlockParallelAccess();
fRegionPool.Recycle(visibleBorder);
}
@ -962,7 +966,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
visibleBorder->IntersectWith(&VisibleRegion());
DrawingEngine* engine = fDecorator->GetDrawingEngine();
engine->LockExclusiveAccess();
engine->LockParallelAccess();
engine->ConstrainClippingRegion(visibleBorder);
if (fIsZooming) {
@ -973,7 +977,7 @@ WindowLayer::MouseMoved(BMessage *message, BPoint where, int32* _viewToken,
fDecorator->SetMinimize(_ActionFor(message) == DEC_MINIMIZE);
}
engine->UnlockExclusiveAccess();
engine->UnlockParallelAccess();
fRegionPool.Recycle(visibleBorder);
}
@ -1267,8 +1271,8 @@ WindowLayer::SetLook(window_look look, BRegion* updateRegion)
{
if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) {
// we need a new decorator
fDecorator = gDecorManager.AllocateDecorator(fDesktop, Frame(),
Title(), fLook, fFlags);
fDecorator = gDecorManager.AllocateDecorator(fDesktop, fDrawingEngine,
Frame(), Title(), fLook, fFlags);
if (IsFocus())
fDecorator->SetFocus(true);
}
@ -1775,11 +1779,11 @@ WindowLayer::_DrawBorder()
dirtyBorderRegion->IntersectWith(&fDirtyRegion);
DrawingEngine* engine = fDecorator->GetDrawingEngine();
if (dirtyBorderRegion->CountRects() > 0 && engine->LockExclusiveAccess()) {
if (dirtyBorderRegion->CountRects() > 0 && engine->LockParallelAccess()) {
engine->ConstrainClippingRegion(dirtyBorderRegion);
fDecorator->Draw(dirtyBorderRegion->Frame());
engine->UnlockExclusiveAccess();
engine->UnlockParallelAccess();
}
fRegionPool.Recycle(dirtyBorderRegion);
}