accelerated software cursor drawing 11 times
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15531 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
040ce75726
commit
2a867ee674
@ -217,8 +217,6 @@ HWInterface::HideSoftwareCursor(const BRect& area)
|
|||||||
fCursorAreaBackup->right,
|
fCursorAreaBackup->right,
|
||||||
fCursorAreaBackup->bottom);
|
fCursorAreaBackup->bottom);
|
||||||
if (area.Intersects(backupArea)) {
|
if (area.Intersects(backupArea)) {
|
||||||
//printf("HideSoftwareCursor(BRect(%.1f, %.1f, %.1f, %.1f))\n", area.left, area.top, area.right, area.bottom);
|
|
||||||
//backupArea.PrintToStream();
|
|
||||||
_RestoreCursorArea();
|
_RestoreCursorArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +226,6 @@ HWInterface::HideSoftwareCursor(const BRect& area)
|
|||||||
void
|
void
|
||||||
HWInterface::HideSoftwareCursor()
|
HWInterface::HideSoftwareCursor()
|
||||||
{
|
{
|
||||||
//printf("HideSoftwareCursor()\n");
|
|
||||||
_RestoreCursorArea();
|
_RestoreCursorArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +234,6 @@ void
|
|||||||
HWInterface::ShowSoftwareCursor()
|
HWInterface::ShowSoftwareCursor()
|
||||||
{
|
{
|
||||||
if (fCursorAreaBackup && fCursorAreaBackup->cursor_hidden) {
|
if (fCursorAreaBackup && fCursorAreaBackup->cursor_hidden) {
|
||||||
//printf("ShowSoftwareCursor()\n");
|
|
||||||
_DrawCursor(_CursorFrame());
|
_DrawCursor(_CursorFrame());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,7 +290,6 @@ HWInterface::_DrawCursor(BRect area) const
|
|||||||
uint8* dst = buffer;
|
uint8* dst = buffer;
|
||||||
|
|
||||||
if (fCursorAreaBackup && fCursorAreaBackup->buffer) {
|
if (fCursorAreaBackup && fCursorAreaBackup->buffer) {
|
||||||
//printf("backup: BRect(%ld, %ld, %ld, %ld)\n", left, top, right, bottom);
|
|
||||||
fCursorAreaBackup->cursor_hidden = false;
|
fCursorAreaBackup->cursor_hidden = false;
|
||||||
// remember which area the backup contains
|
// remember which area the backup contains
|
||||||
fCursorAreaBackup->left = left;
|
fCursorAreaBackup->left = left;
|
||||||
@ -303,6 +298,7 @@ HWInterface::_DrawCursor(BRect area) const
|
|||||||
fCursorAreaBackup->bottom = bottom;
|
fCursorAreaBackup->bottom = bottom;
|
||||||
uint8* bup = fCursorAreaBackup->buffer;
|
uint8* bup = fCursorAreaBackup->buffer;
|
||||||
uint32 bupBPR = fCursorAreaBackup->bpr;
|
uint32 bupBPR = fCursorAreaBackup->bpr;
|
||||||
|
|
||||||
// blending and backup of drawing buffer
|
// blending and backup of drawing buffer
|
||||||
for (int32 y = top; y <= bottom; y++) {
|
for (int32 y = top; y <= bottom; y++) {
|
||||||
uint8* s = src;
|
uint8* s = src;
|
||||||
@ -310,18 +306,12 @@ HWInterface::_DrawCursor(BRect area) const
|
|||||||
uint8* d = dst;
|
uint8* d = dst;
|
||||||
uint8* b = bup;
|
uint8* b = bup;
|
||||||
for (int32 x = left; x <= right; x++) {
|
for (int32 x = left; x <= right; x++) {
|
||||||
|
*(uint32*)b = *(uint32*)s;
|
||||||
// assumes backbuffer alpha = 255
|
// assumes backbuffer alpha = 255
|
||||||
// TODO: it appears alpha in cursor is upside down
|
uint8 a = c[3];
|
||||||
uint8 a = 255 - c[3];
|
d[0] = (((c[0] - b[0]) * a) + (b[0] << 8)) >> 8;
|
||||||
b[0] = s[0];
|
d[1] = (((c[1] - b[1]) * a) + (b[1] << 8)) >> 8;
|
||||||
b[1] = s[1];
|
d[2] = (((c[2] - b[2]) * a) + (b[2] << 8)) >> 8;
|
||||||
b[2] = s[2];
|
|
||||||
// TODO: unnecessary?
|
|
||||||
b[3] = 255;
|
|
||||||
d[0] = (((s[0] - c[0]) * a) + (c[0] << 8)) >> 8;
|
|
||||||
d[1] = (((s[1] - c[1]) * a) + (c[1] << 8)) >> 8;
|
|
||||||
d[2] = (((s[2] - c[2]) * a) + (c[2] << 8)) >> 8;
|
|
||||||
d[3] = 255;
|
|
||||||
s += 4;
|
s += 4;
|
||||||
c += 4;
|
c += 4;
|
||||||
d += 4;
|
d += 4;
|
||||||
@ -340,12 +330,10 @@ HWInterface::_DrawCursor(BRect area) const
|
|||||||
uint8* d = dst;
|
uint8* d = dst;
|
||||||
for (int32 x = left; x <= right; x++) {
|
for (int32 x = left; x <= right; x++) {
|
||||||
// assumes backbuffer alpha = 255
|
// assumes backbuffer alpha = 255
|
||||||
// TODO: it appears alpha in cursor is upside down
|
uint8 a = c[3];
|
||||||
uint8 a = 255 - c[3];
|
d[0] = (((c[0] - s[0]) * a) + (s[0] << 8)) >> 8;
|
||||||
d[0] = (((s[0] - c[0]) * a) + (c[0] << 8)) >> 8;
|
d[1] = (((c[1] - s[1]) * a) + (s[1] << 8)) >> 8;
|
||||||
d[1] = (((s[1] - c[1]) * a) + (c[1] << 8)) >> 8;
|
d[2] = (((c[2] - s[2]) * a) + (s[2] << 8)) >> 8;
|
||||||
d[2] = (((s[2] - c[2]) * a) + (c[2] << 8)) >> 8;
|
|
||||||
d[3] = 255;
|
|
||||||
s += 4;
|
s += 4;
|
||||||
c += 4;
|
c += 4;
|
||||||
d += 4;
|
d += 4;
|
||||||
@ -614,7 +602,6 @@ void
|
|||||||
HWInterface::_RestoreCursorArea() const
|
HWInterface::_RestoreCursorArea() const
|
||||||
{
|
{
|
||||||
if (fCursorAreaBackup && !fCursorAreaBackup->cursor_hidden) {
|
if (fCursorAreaBackup && !fCursorAreaBackup->cursor_hidden) {
|
||||||
//printf("restore\n");
|
|
||||||
_CopyToFront(fCursorAreaBackup->buffer,
|
_CopyToFront(fCursorAreaBackup->buffer,
|
||||||
fCursorAreaBackup->bpr,
|
fCursorAreaBackup->bpr,
|
||||||
fCursorAreaBackup->left,
|
fCursorAreaBackup->left,
|
||||||
|
Loading…
Reference in New Issue
Block a user