Tried to fix all issues with running a DEBUG build of app_server.
* CopyRegion should not need the HWInterface to be exclusive locked. * BitmapDrawingInterface does not need to be locked at all, since it doesn't use a shared HWInterface instance. * Window and Desktop should lock the HWInterface appropriately before invoking CopyRegion() on the DrawingEngine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35822 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
98248b1612
commit
a0b37b6e38
@ -18,6 +18,23 @@ BitmapDrawingEngine::~BitmapDrawingEngine()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BitmapDrawingEngine::IsParallelAccessLocked() const
|
||||
{
|
||||
// We don't share the HWInterface instance that the Painter is
|
||||
// attached to, so we never need to be locked.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BitmapDrawingEngine::IsExclusiveAccessLocked() const
|
||||
{
|
||||
// See IsParallelAccessLocked().
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
|
||||
{
|
||||
@ -63,7 +80,7 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
|
||||
}
|
||||
|
||||
|
||||
UtilityBitmap *
|
||||
UtilityBitmap*
|
||||
BitmapDrawingEngine::ExportToBitmap(int32 width, int32 height,
|
||||
color_space space)
|
||||
{
|
||||
|
@ -12,13 +12,18 @@ public:
|
||||
BitmapDrawingEngine();
|
||||
virtual ~BitmapDrawingEngine();
|
||||
|
||||
#if DEBUG
|
||||
virtual bool IsParallelAccessLocked() const;
|
||||
#endif
|
||||
virtual bool IsExclusiveAccessLocked() const;
|
||||
|
||||
status_t SetSize(int32 newWidth, int32 newHeight);
|
||||
UtilityBitmap * ExportToBitmap(int32 width, int32 height,
|
||||
UtilityBitmap* ExportToBitmap(int32 width, int32 height,
|
||||
color_space space);
|
||||
|
||||
private:
|
||||
BitmapHWInterface * fHWInterface;
|
||||
UtilityBitmap * fBitmap;
|
||||
BitmapHWInterface* fHWInterface;
|
||||
UtilityBitmap* fBitmap;
|
||||
BRegion fClipping;
|
||||
};
|
||||
|
||||
|
@ -1197,7 +1197,12 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace)
|
||||
// moved into the dirty region (for now)
|
||||
newDirtyRegion.Include(&window->VisibleRegion());
|
||||
|
||||
GetDrawingEngine()->CopyRegion(©Region, (int32)x, (int32)y);
|
||||
// NOTE: Having all windows locked should prevent any
|
||||
// problems with locking the drawing engine here.
|
||||
if (GetDrawingEngine()->LockParallelAccess()) {
|
||||
GetDrawingEngine()->CopyRegion(©Region, (int32)x, (int32)y);
|
||||
GetDrawingEngine()->UnlockParallelAccess();
|
||||
}
|
||||
|
||||
// in the dirty region, exclude the parts that we
|
||||
// could move by blitting
|
||||
|
@ -468,22 +468,28 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
|
||||
if (allDirtyRegions != NULL)
|
||||
copyRegion->Exclude(allDirtyRegions);
|
||||
|
||||
fDrawingEngine->CopyRegion(copyRegion, xOffset, yOffset);
|
||||
if (fDrawingEngine->LockParallelAccess()) {
|
||||
fDrawingEngine->CopyRegion(copyRegion, xOffset, yOffset);
|
||||
fDrawingEngine->UnlockParallelAccess();
|
||||
|
||||
// Prevent those parts from being added to the dirty region...
|
||||
newDirty->Exclude(copyRegion);
|
||||
// Prevent those parts from being added to the dirty region...
|
||||
newDirty->Exclude(copyRegion);
|
||||
|
||||
// The parts that could be copied are not dirty (at the
|
||||
// target location!)
|
||||
copyRegion->OffsetBy(xOffset, yOffset);
|
||||
// ... and even exclude them from the pending dirty region!
|
||||
if (fPendingUpdateSession->IsUsed())
|
||||
fPendingUpdateSession->DirtyRegion().Exclude(copyRegion);
|
||||
// The parts that could be copied are not dirty (at the
|
||||
// target location!)
|
||||
copyRegion->OffsetBy(xOffset, yOffset);
|
||||
// ... and even exclude them from the pending dirty region!
|
||||
if (fPendingUpdateSession->IsUsed())
|
||||
fPendingUpdateSession->DirtyRegion().Exclude(copyRegion);
|
||||
}
|
||||
|
||||
fRegionPool.Recycle(copyRegion);
|
||||
} else {
|
||||
// Fallback, should never be here.
|
||||
fDrawingEngine->CopyRegion(region, xOffset, yOffset);
|
||||
if (fDrawingEngine->LockParallelAccess()) {
|
||||
fDrawingEngine->CopyRegion(region, xOffset, yOffset);
|
||||
fDrawingEngine->UnlockParallelAccess();
|
||||
}
|
||||
}
|
||||
|
||||
if (allDirtyRegions != NULL)
|
||||
|
@ -458,7 +458,7 @@ void
|
||||
DrawingEngine::CopyRegion(/*const*/ BRegion* region, int32 xOffset,
|
||||
int32 yOffset)
|
||||
{
|
||||
ASSERT_EXCLUSIVE_LOCKED();
|
||||
ASSERT_PARALLEL_LOCKED();
|
||||
|
||||
BRect frame = region->Frame();
|
||||
frame = frame | frame.OffsetByCopy(xOffset, yOffset);
|
||||
|
@ -51,12 +51,12 @@ public:
|
||||
// locking
|
||||
bool LockParallelAccess();
|
||||
#if DEBUG
|
||||
bool IsParallelAccessLocked() const;
|
||||
virtual bool IsParallelAccessLocked() const;
|
||||
#endif
|
||||
void UnlockParallelAccess();
|
||||
|
||||
bool LockExclusiveAccess();
|
||||
bool IsExclusiveAccessLocked();
|
||||
virtual bool IsExclusiveAccessLocked();
|
||||
void UnlockExclusiveAccess();
|
||||
|
||||
// for screen shots
|
||||
|
Loading…
x
Reference in New Issue
Block a user