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:
@@ -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
|
status_t
|
||||||
BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
|
BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
|
||||||
{
|
{
|
||||||
@@ -63,7 +80,7 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UtilityBitmap *
|
UtilityBitmap*
|
||||||
BitmapDrawingEngine::ExportToBitmap(int32 width, int32 height,
|
BitmapDrawingEngine::ExportToBitmap(int32 width, int32 height,
|
||||||
color_space space)
|
color_space space)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,13 +12,18 @@ public:
|
|||||||
BitmapDrawingEngine();
|
BitmapDrawingEngine();
|
||||||
virtual ~BitmapDrawingEngine();
|
virtual ~BitmapDrawingEngine();
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
virtual bool IsParallelAccessLocked() const;
|
||||||
|
#endif
|
||||||
|
virtual bool IsExclusiveAccessLocked() const;
|
||||||
|
|
||||||
status_t SetSize(int32 newWidth, int32 newHeight);
|
status_t SetSize(int32 newWidth, int32 newHeight);
|
||||||
UtilityBitmap * ExportToBitmap(int32 width, int32 height,
|
UtilityBitmap* ExportToBitmap(int32 width, int32 height,
|
||||||
color_space space);
|
color_space space);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BitmapHWInterface * fHWInterface;
|
BitmapHWInterface* fHWInterface;
|
||||||
UtilityBitmap * fBitmap;
|
UtilityBitmap* fBitmap;
|
||||||
BRegion fClipping;
|
BRegion fClipping;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1197,7 +1197,12 @@ Desktop::MoveWindowBy(Window* window, float x, float y, int32 workspace)
|
|||||||
// moved into the dirty region (for now)
|
// moved into the dirty region (for now)
|
||||||
newDirtyRegion.Include(&window->VisibleRegion());
|
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
|
// in the dirty region, exclude the parts that we
|
||||||
// could move by blitting
|
// could move by blitting
|
||||||
|
|||||||
+16
-10
@@ -468,22 +468,28 @@ Window::CopyContents(BRegion* region, int32 xOffset, int32 yOffset)
|
|||||||
if (allDirtyRegions != NULL)
|
if (allDirtyRegions != NULL)
|
||||||
copyRegion->Exclude(allDirtyRegions);
|
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...
|
// Prevent those parts from being added to the dirty region...
|
||||||
newDirty->Exclude(copyRegion);
|
newDirty->Exclude(copyRegion);
|
||||||
|
|
||||||
// The parts that could be copied are not dirty (at the
|
// The parts that could be copied are not dirty (at the
|
||||||
// target location!)
|
// target location!)
|
||||||
copyRegion->OffsetBy(xOffset, yOffset);
|
copyRegion->OffsetBy(xOffset, yOffset);
|
||||||
// ... and even exclude them from the pending dirty region!
|
// ... and even exclude them from the pending dirty region!
|
||||||
if (fPendingUpdateSession->IsUsed())
|
if (fPendingUpdateSession->IsUsed())
|
||||||
fPendingUpdateSession->DirtyRegion().Exclude(copyRegion);
|
fPendingUpdateSession->DirtyRegion().Exclude(copyRegion);
|
||||||
|
}
|
||||||
|
|
||||||
fRegionPool.Recycle(copyRegion);
|
fRegionPool.Recycle(copyRegion);
|
||||||
} else {
|
} else {
|
||||||
// Fallback, should never be here.
|
// Fallback, should never be here.
|
||||||
fDrawingEngine->CopyRegion(region, xOffset, yOffset);
|
if (fDrawingEngine->LockParallelAccess()) {
|
||||||
|
fDrawingEngine->CopyRegion(region, xOffset, yOffset);
|
||||||
|
fDrawingEngine->UnlockParallelAccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allDirtyRegions != NULL)
|
if (allDirtyRegions != NULL)
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ void
|
|||||||
DrawingEngine::CopyRegion(/*const*/ BRegion* region, int32 xOffset,
|
DrawingEngine::CopyRegion(/*const*/ BRegion* region, int32 xOffset,
|
||||||
int32 yOffset)
|
int32 yOffset)
|
||||||
{
|
{
|
||||||
ASSERT_EXCLUSIVE_LOCKED();
|
ASSERT_PARALLEL_LOCKED();
|
||||||
|
|
||||||
BRect frame = region->Frame();
|
BRect frame = region->Frame();
|
||||||
frame = frame | frame.OffsetByCopy(xOffset, yOffset);
|
frame = frame | frame.OffsetByCopy(xOffset, yOffset);
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ public:
|
|||||||
// locking
|
// locking
|
||||||
bool LockParallelAccess();
|
bool LockParallelAccess();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
bool IsParallelAccessLocked() const;
|
virtual bool IsParallelAccessLocked() const;
|
||||||
#endif
|
#endif
|
||||||
void UnlockParallelAccess();
|
void UnlockParallelAccess();
|
||||||
|
|
||||||
bool LockExclusiveAccess();
|
bool LockExclusiveAccess();
|
||||||
bool IsExclusiveAccessLocked();
|
virtual bool IsExclusiveAccessLocked();
|
||||||
void UnlockExclusiveAccess();
|
void UnlockExclusiveAccess();
|
||||||
|
|
||||||
// for screen shots
|
// for screen shots
|
||||||
|
|||||||
Reference in New Issue
Block a user