Making some headway on the cursor redraw problems when moving windows. Not quite fixed yet, though

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9027 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-09-21 23:10:23 +00:00
parent 130b146f78
commit e841a5da12
3 changed files with 123 additions and 99 deletions
+36 -13
View File
@@ -310,6 +310,8 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
return; return;
} }
fCursorHandler->DriverHide();
uint32 bytesPerPixel = bmp->BytesPerRow() / bmp->Bounds().IntegerWidth(); uint32 bytesPerPixel = bmp->BytesPerRow() / bmp->Bounds().IntegerWidth();
BList rectList; BList rectList;
@@ -323,7 +325,8 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
BRegion *reg = (BRegion*)list->ItemAt(k); BRegion *reg = (BRegion*)list->ItemAt(k);
int32 rectCount = reg->CountRects(); int32 rectCount = reg->CountRects();
for(i=0; i < rectCount; i++){ for(i=0; i < rectCount; i++)
{
BRect r = reg->RectAt(i); BRect r = reg->RectAt(i);
uint8 *rectCopy; uint8 *rectCopy;
uint8 *srcAddress; uint8 *srcAddress;
@@ -342,11 +345,11 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
rectCopy = (uint8*)malloc(copyLength * copyRows * bytesPerPixel); rectCopy = (uint8*)malloc(copyLength * copyRows * bytesPerPixel);
srcAddress = bitmapBits srcAddress = bitmapBits + (((firstRow) * Bwidth + firstCol) * bytesPerPixel);
+ (((firstRow) * Bwidth + firstCol) * bytesPerPixel);
destAddress = rectCopy; destAddress = rectCopy;
for (int32 j = 0; j < copyRows; j++){ for (int32 j = 0; j < copyRows; j++)
{
uint8 *destRowAddress = destAddress + (j * copyLength * bytesPerPixel); uint8 *destRowAddress = destAddress + (j * copyLength * bytesPerPixel);
uint8 *srcRowAddress = srcAddress + (j * Bwidth * bytesPerPixel); uint8 *srcRowAddress = srcAddress + (j * Bwidth * bytesPerPixel);
memcpy(destRowAddress, srcRowAddress, copyLength * bytesPerPixel ); memcpy(destRowAddress, srcRowAddress, copyLength * bytesPerPixel );
@@ -362,7 +365,8 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
BRegion *reg = (BRegion*)list->ItemAt(k); BRegion *reg = (BRegion*)list->ItemAt(k);
int32 rectCount = reg->CountRects(); int32 rectCount = reg->CountRects();
for(i=0; i < rectCount; i++){ for(i=0; i < rectCount; i++)
{
BRect r = reg->RectAt(i); BRect r = reg->RectAt(i);
uint8 *rectCopy; uint8 *rectCopy;
uint8 *srcAddress; uint8 *srcAddress;
@@ -392,13 +396,13 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
copyLength2 = (lastCol - firstCol + 1) < 0? 0: (lastCol - firstCol + 1); copyLength2 = (lastCol - firstCol + 1) < 0? 0: (lastCol - firstCol + 1);
copyRows2 = (lastRow - firstRow + 1) < 0? 0: (lastRow - firstRow + 1); copyRows2 = (lastRow - firstRow + 1) < 0? 0: (lastRow - firstRow + 1);
destAddress = bitmapBits destAddress = bitmapBits + (((firstRow) * Bwidth + firstCol) * bytesPerPixel);
+ (((firstRow) * Bwidth + firstCol) * bytesPerPixel);
int32 minLength = copyLength < copyLength2? copyLength: copyLength2; int32 minLength = copyLength < copyLength2? copyLength: copyLength2;
int32 minRows = copyRows < copyRows2? copyRows: copyRows2; int32 minRows = copyRows < copyRows2? copyRows: copyRows2;
for (int32 j = 0; j < minRows; j++){ for (int32 j = 0; j < minRows; j++)
{
uint8 *destRowAddress = destAddress + (j * Bwidth * bytesPerPixel); uint8 *destRowAddress = destAddress + (j * Bwidth * bytesPerPixel);
uint8 *srcRowAddress = srcAddress + (j * copyLength * bytesPerPixel); uint8 *srcRowAddress = srcAddress + (j * copyLength * bytesPerPixel);
memcpy(destRowAddress, srcRowAddress, minLength * bytesPerPixel ); memcpy(destRowAddress, srcRowAddress, minLength * bytesPerPixel );
@@ -406,7 +410,8 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
} }
} }
for(i=0; i < rectList.CountItems(); i++){ for(i=0; i < rectList.CountItems(); i++)
{
void *rectCopy; void *rectCopy;
rectCopy = rectList.ItemAt(i); rectCopy = rectList.ItemAt(i);
if (rectCopy) if (rectCopy)
@@ -414,6 +419,8 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
} }
rectList.MakeEmpty(); rectList.MakeEmpty();
fCursorHandler->DriverShow();
BRect inval(bmp->Bounds()); BRect inval(bmp->Bounds());
ReleaseBuffer(); ReleaseBuffer();
Unlock(); Unlock();
@@ -451,7 +458,13 @@ void DisplayDriver::DrawString(const char *string, const int32 &length, const BP
Lock(); Lock();
// TODO: Test for cursor intersection in DisplayDriver::DrawString // TODO: properly calculate intersecting rectangle with cursor in DisplayDriver::DrawString
// Rough guesstimate for size
BRect intersection(pt.x,pt.x,pt.y,pt.y);
intersection.top-=d->font.Size()*1.5;
intersection.right+=d->font.Size()*1.5*length;
if(fCursorHandler->IntersectsCursor(intersection))
fCursorHandler->DriverHide(); fCursorHandler->DriverHide();
BPoint point(pt); BPoint point(pt);
@@ -865,6 +878,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
FillEllipse(r,color); FillEllipse(r,color);
fCursorHandler->DriverShow();
return; return;
} }
@@ -1230,6 +1244,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
FillEllipse(r,d); FillEllipse(r,d);
fCursorHandler->DriverShow();
return; return;
} }
@@ -1932,6 +1947,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
{ {
printf("ERROR: Insufficient memory allocated to segment array\n"); printf("ERROR: Insufficient memory allocated to segment array\n");
delete[] segmentArray; delete[] segmentArray;
fCursorHandler->DriverShow();
Unlock(); Unlock();
return; return;
} }
@@ -2110,10 +2126,8 @@ void DisplayDriver::FillRect(const BRect &r, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler->IntersectsCursor(r))
{
debugger("");
fCursorHandler->DriverHide(); fCursorHandler->DriverHide();
}
FillSolidRect(r,color); FillSolidRect(r,color);
fCursorHandler->DriverShow(); fCursorHandler->DriverShow();
Unlock(); Unlock();
@@ -2364,6 +2378,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
start.x=MIN(first.x,MIN(second.x,third.x)); start.x=MIN(first.x,MIN(second.x,third.x));
end.x=MAX(first.x,MAX(second.x,third.x)); end.x=MAX(first.x,MAX(second.x,third.x));
StrokeSolidLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), color); StrokeSolidLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), color);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2378,6 +2393,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
StrokeSolidLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), color); StrokeSolidLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), color);
for(i=(int32)first.y+1; i<=third.y; i++) for(i=(int32)first.y+1; i<=third.y; i++)
StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2390,6 +2406,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
StrokeSolidLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), color); StrokeSolidLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), color);
for(i=(int32)first.y; i<third.y; i++) for(i=(int32)first.y; i<third.y; i++)
StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2430,6 +2447,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
// For now, cop out and use FillPolygon // For now, cop out and use FillPolygon
// Need to investigate if Triangle specific code would save processing time // Need to investigate if Triangle specific code would save processing time
FillPolygon(pts,3,bounds,d); FillPolygon(pts,3,bounds,d);
fCursorHandler->DriverShow();
} }
else else
{ {
@@ -2478,6 +2496,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
start.x=MIN(first.x,MIN(second.x,third.x)); start.x=MIN(first.x,MIN(second.x,third.x));
end.x=MAX(first.x,MAX(second.x,third.x)); end.x=MAX(first.x,MAX(second.x,third.x));
StrokePatternLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), d); StrokePatternLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), d);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2492,6 +2511,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
StrokePatternLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), d); StrokePatternLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), d);
for(i=(int32)first.y+1; i<=third.y; i++) for(i=(int32)first.y+1; i<=third.y; i++)
StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2504,6 +2524,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
StrokePatternLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), d); StrokePatternLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), d);
for(i=(int32)first.y; i<third.y; i++) for(i=(int32)first.y; i<third.y; i++)
StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2661,6 +2682,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
StrokeEllipse(r,color); StrokeEllipse(r,color);
fCursorHandler->DriverShow();
return; return;
} }
@@ -2828,6 +2850,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
StrokeEllipse(r,d); StrokeEllipse(r,d);
fCursorHandler->DriverShow();
return; return;
} }
+1
View File
@@ -13,6 +13,7 @@ SharedLibrary appserver :
BGet++.cpp BGet++.cpp
BitmapManager.cpp BitmapManager.cpp
ColorSet.cpp ColorSet.cpp
CursorHandler.cpp
Decorator.cpp Decorator.cpp
DisplayDriver.cpp DisplayDriver.cpp
DisplaySupport.cpp DisplaySupport.cpp