Small cleanup, mostly style changes. Fixed a small typo.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13517 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-07-07 09:29:28 +00:00
parent 8991f1a2af
commit 5fdea13fa5
+15 -13
View File
@@ -21,7 +21,7 @@
// Compiling for DANO/Zeta is broken as it doesn't have BRegion::set_size() // Compiling for DANO/Zeta is broken as it doesn't have BRegion::set_size()
#ifdef COMPILE_FOR_DANO #ifdef COMPILE_FOR_DANO
#warning "##### Bilding BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####" #warning "##### Building BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####"
#endif #endif
@@ -247,7 +247,9 @@ BDirectWindow::GetClippingRegion(BRegion *region, BPoint *origin) const
if (IsLocked()) if (IsLocked())
return B_ERROR; return B_ERROR;
if (LockDirect()) { if (!LockDirect())
return B_ERROR;
if (in_direct_connect) { if (in_direct_connect) {
UnlockDirect(); UnlockDirect();
return B_ERROR; return B_ERROR;
@@ -268,7 +270,7 @@ BDirectWindow::GetClippingRegion(BRegion *region, BPoint *origin) const
// Since we are friend of BRegion, we can access its private members. // Since we are friend of BRegion, we can access its private members.
// Otherwise, we would need to call BRegion::Include(clipping_rect) // Otherwise, we would need to call BRegion::Include(clipping_rect)
// for every clipping_rect in our clip_list, and that would be much // for every clipping_rect in our clip_list, and that would be much
// more overkill than this. // more overkill than this (tested ).
region->set_size(buffer_desc->clip_list_count); region->set_size(buffer_desc->clip_list_count);
region->count = buffer_desc->clip_list_count; region->count = buffer_desc->clip_list_count;
region->bound = buffer_desc->clip_bounds; region->bound = buffer_desc->clip_bounds;
@@ -286,9 +288,7 @@ BDirectWindow::GetClippingRegion(BRegion *region, BPoint *origin) const
UnlockDirect(); UnlockDirect();
return B_OK; return B_OK;
}
return B_ERROR;
} }
@@ -396,10 +396,11 @@ BDirectWindow::LockDirect() const
#if DW_NEEDS_LOCKING #if DW_NEEDS_LOCKING
BDirectWindow *casted = const_cast<BDirectWindow *>(this); BDirectWindow *casted = const_cast<BDirectWindow *>(this);
if (atomic_add(&casted->direct_lock, 1) > 0) if (atomic_add(&casted->direct_lock, 1) > 0) {
do { do {
status = acquire_sem(direct_sem); status = acquire_sem(direct_sem);
} while (status == B_INTERRUPTED); } while (status == B_INTERRUPTED);
}
if (status == B_OK) { if (status == B_OK) {
casted->direct_lock_owner = find_thread(NULL); casted->direct_lock_owner = find_thread(NULL);
@@ -439,7 +440,9 @@ BDirectWindow::InitData()
direct_driver_token = 0; direct_driver_token = 0;
direct_driver = NULL; direct_driver = NULL;
if (Lock()) { if (!Lock())
return;
struct dw_sync_data sync_data; struct dw_sync_data sync_data;
status_t status = B_ERROR; status_t status = B_ERROR;
@@ -450,18 +453,18 @@ BDirectWindow::InitData()
Flush(); Flush();
a_session->sread(sizeof(sync_data), &sync_data); a_session->sread(sizeof(sync_data), &sync_data);
a_session->sread(sizeof(status), &status); a_session->sread(sizeof(status), &status);
#endif #endif
Unlock(); Unlock();
if (status == B_OK) { if (status < B_OK)
return;
#if DW_NEEDS_LOCKING #if DW_NEEDS_LOCKING
direct_lock = 0; direct_lock = 0;
direct_lock_count = 0; direct_lock_count = 0;
direct_lock_owner = B_ERROR; direct_lock_owner = -1;
direct_lock_stack = NULL; direct_lock_stack = NULL;
direct_sem = create_sem(1, "direct sem"); direct_sem = create_sem(1, "direct sem");
if (direct_sem > 0) if (direct_sem > 0)
@@ -474,6 +477,7 @@ BDirectWindow::InitData()
cloned_clipping_area = clone_area("Clone direct area", (void**)&buffer_desc, cloned_clipping_area = clone_area("Clone direct area", (void**)&buffer_desc,
B_ANY_ADDRESS, B_READ_AREA, source_clipping_area); B_ANY_ADDRESS, B_READ_AREA, source_clipping_area);
if (cloned_clipping_area > 0) { if (cloned_clipping_area > 0) {
dw_init_status |= DW_STATUS_AREA_CLONED; dw_init_status |= DW_STATUS_AREA_CLONED;
@@ -488,8 +492,6 @@ BDirectWindow::InitData()
kill_thread(direct_deamon_id); kill_thread(direct_deamon_id);
} }
} }
}
}
} }