1344 | | if (cursor->CursorData() != NULL && fAccSetCursorShape != NULL) { |
1345 | | // BeOS BCursor, 16x16 monochrome |
1346 | | uint8 size = cursor->CursorData()[0]; |
1347 | | // CursorData()[1] is color depth (always monochrome) |
1348 | | uint8 xHotSpot = cursor->CursorData()[2]; |
1349 | | uint8 yHotSpot = cursor->CursorData()[3]; |
1350 | | |
1351 | | // Create pointers to the cursor and/xor bit arrays |
1352 | | const uint8* andMask = cursor->CursorData() + 4; |
1353 | | const uint8* xorMask = cursor->CursorData() + 36; |
| 1341 | bool cursorSet = false; |
| 1356 | } else if (cursor->CursorData() != NULL && fAccSetCursorShape != NULL) { |
| 1357 | // BeOS BCursor, 16x16 monochrome |
| 1358 | uint8 size = cursor->CursorData()[0]; |
| 1359 | // CursorData()[1] is color depth (always monochrome) |
| 1360 | // x and y are switched |
| 1361 | uint8 xHotSpot = cursor->CursorData()[3]; |
| 1362 | uint8 yHotSpot = cursor->CursorData()[2]; |
| 1363 | |
| 1364 | // Create pointers to the cursor and/xor bit arrays |
| 1365 | // for the BeOS BCursor there are two 32 byte, 16x16 bit arrays |
| 1366 | // in the first: 1 is black, 0 is white |
| 1367 | // in the second: 1 is opaque, 0 is transparent |
| 1368 | // 1st 2nd |
| 1369 | // 0 0 transparent |
| 1370 | // 0 1 white |
| 1371 | // 1 0 transparent |
| 1372 | // 1 1 black |
| 1373 | // for the HW cursor the first is ANDed and the second is XORed |
| 1374 | // AND XOR |
| 1375 | // 0 0 white |
| 1376 | // 0 1 black |
| 1377 | // 1 0 transparent |
| 1378 | // 1 1 reverse |
| 1379 | // so, the first 32 bytes are the XOR mask |
| 1380 | const uint8* xorMask = cursor->CursorData() + 4; |
| 1381 | // the second 32 bytes *NOTed* are the AND mask |
| 1382 | // TODO maybe this should be NOTed when copied to the ServerCursor |
| 1383 | uint8 andMask[32]; |
| 1384 | const uint8* transMask = cursor->CursorData() + 36; |
| 1385 | for (int32 i = 0; i < 32; i++) |
| 1386 | andMask[i] = ~transMask[i]; |
| 1387 | |
| 1388 | // Time to talk to the accelerant! |
| 1389 | cursorSet = fAccSetCursorShape(size, size, xHotSpot, |
| 1390 | yHotSpot, andMask, xorMask) == B_OK; |
| 1391 | } |
| 1392 | |
| 1393 | if (cursorSet && !fHardwareCursorEnabled) { |
| 1394 | // we switched from SW to HW, so we need to erase the SW cursor |
| 1395 | if (fCursorVisible && fFloatingOverlaysLock.Lock()) { |
| 1396 | IntRect r = _CursorFrame(); |
| 1397 | fCursorVisible = false; |
| 1398 | // so the Invalidate doesn't draw it again |
| 1399 | _RestoreCursorArea(); |
| 1400 | Invalidate(r); |
| 1401 | fCursorVisible = true; |
| 1402 | fFloatingOverlaysLock.Unlock(); |
| 1403 | } |
| 1404 | // and we need to update our position |
| 1405 | if (fAccMoveCursor != NULL) |
| 1406 | fAccMoveCursor((uint16)fCursorLocation.x, |
| 1407 | (uint16)fCursorLocation.y); |