consted a few parameters

modified line functions - made them work


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7145 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2004-04-03 15:00:16 +00:00
parent 7a71a81c84
commit 51adcc8405
5 changed files with 48 additions and 138 deletions
+3 -3
View File
@@ -750,7 +750,7 @@ void BitmapDriver::Blit(const BRect &src, const BRect &dest, const DrawData *d)
{ {
} }
void BitmapDriver::FillSolidRect(const BRect &rect, RGBColor &color) void BitmapDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
{ {
} }
@@ -758,7 +758,7 @@ void BitmapDriver::FillPatternRect(const BRect &rect, const DrawData *d)
{ {
} }
void BitmapDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColor &color) void BitmapDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color)
{ {
} }
@@ -766,7 +766,7 @@ void BitmapDriver::StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, con
{ {
} }
void BitmapDriver::StrokeSolidRect(const BRect &rect, RGBColor &color) void BitmapDriver::StrokeSolidRect(const BRect &rect, const RGBColor &color)
{ {
} }
+3 -3
View File
@@ -81,11 +81,11 @@ protected:
virtual void ReleaseBuffer(void); virtual void ReleaseBuffer(void);
virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d); virtual void Blit(const BRect &src, const BRect &dest, const DrawData *d);
virtual void FillSolidRect(const BRect &rect, RGBColor &color); virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
virtual void FillPatternRect(const BRect &rect, const DrawData *d); virtual void FillPatternRect(const BRect &rect, const DrawData *d);
virtual void StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColor &color); virtual void StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color);
virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d); virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d);
virtual void StrokeSolidRect(const BRect &rect, RGBColor &color); virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d); virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d);
virtual void CopyToBitmap(ServerBitmap *target, const BRect &source); virtual void CopyToBitmap(ServerBitmap *target, const BRect &source);
+31 -24
View File
@@ -440,7 +440,7 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
// ConstrainClippingRegion(NULL); // ConstrainClippingRegion(NULL);
} }
void DisplayDriver::DrawString(const char *string, const int32 &length, const BPoint &pt, RGBColor &color, escapement_delta *delta) void DisplayDriver::DrawString(const char *string, const int32 &length, const BPoint &pt, const RGBColor &color, escapement_delta *delta)
{ {
DrawData d; DrawData d;
d.highcolor=color; d.highcolor=color;
@@ -843,7 +843,7 @@ void DisplayDriver::Invalidate(const BRect &r)
{ {
} }
void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, RGBColor &color) void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, const RGBColor &color)
{ {
} }
@@ -1208,7 +1208,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
} }
void DisplayDriver::FillBezier(BPoint *pts, RGBColor &color) void DisplayDriver::FillBezier(BPoint *pts, const RGBColor &color)
{ {
} }
@@ -1296,7 +1296,7 @@ void DisplayDriver::FillBezier(BPoint *pts, DisplayDriver* driver, SetHorizontal
*/ */
} }
void DisplayDriver::FillEllipse(const BRect &r, RGBColor &color) void DisplayDriver::FillEllipse(const BRect &r, const RGBColor &color)
{ {
} }
@@ -1365,7 +1365,7 @@ void DisplayDriver::FillEllipse(const BRect &r, const DrawData *d)
Unlock(); Unlock();
} }
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor &color) void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const RGBColor &color)
{ {
} }
@@ -1498,7 +1498,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const DrawData *d)
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space \param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
\param color The color used to fill the rectangle \param color The color used to fill the rectangle
*/ */
void DisplayDriver::FillRect(const BRect &r, RGBColor &color) void DisplayDriver::FillRect(const BRect &r, const RGBColor &color)
{ {
Lock(); Lock();
FillSolidRect(r,color); FillSolidRect(r,color);
@@ -1524,7 +1524,7 @@ void DisplayDriver::FillRect(const BRect &r, const DrawData *d)
\param r BRegion to be filled \param r BRegion to be filled
\param color The color used to fill the region \param color The color used to fill the region
*/ */
void DisplayDriver::FillRegion(BRegion& r, RGBColor &color) void DisplayDriver::FillRegion(BRegion& r, const RGBColor &color)
{ {
Lock(); Lock();
@@ -1554,7 +1554,7 @@ void DisplayDriver::FillRegion(BRegion& r, const DrawData *d)
Unlock(); Unlock();
} }
void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float &yrad, RGBColor &color) void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float &yrad, const RGBColor &color)
{ {
} }
@@ -1587,7 +1587,7 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float
//{ //{
//} //}
void DisplayDriver::FillTriangle(BPoint *pts, RGBColor &color) void DisplayDriver::FillTriangle(BPoint *pts, const RGBColor &color)
{ {
} }
@@ -1885,7 +1885,7 @@ void DisplayDriver::SetCursor(ServerCursor *cursor)
Unlock(); Unlock();
} }
void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &span, RGBColor &color) void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &span, const RGBColor &color)
{ {
} }
@@ -2051,7 +2051,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
} }
void DisplayDriver::StrokeBezier(BPoint *pts, RGBColor &color) void DisplayDriver::StrokeBezier(BPoint *pts, const RGBColor &color)
{ {
} }
@@ -2118,7 +2118,7 @@ void DisplayDriver::StrokeBezier(BPoint *pts, DisplayDriver* driver, SetPixelFun
} }
} }
void DisplayDriver::StrokeEllipse(const BRect &r, RGBColor &color) void DisplayDriver::StrokeEllipse(const BRect &r, const RGBColor &color)
{ {
} }
@@ -2193,16 +2193,22 @@ void DisplayDriver::StrokeEllipse(const BRect &r, DisplayDriver* driver, SetPixe
} }
} }
void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, RGBColor &color) void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const RGBColor &color)
{ {
Lock(); Lock();
//Not quite that simple bub //Not quite that simple bub - REDO!!!
//StrokeSolidLine(start,end,color); StrokeSolidLine(start,end,color);
Unlock(); Unlock();
} }
void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const DrawData *d) void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const DrawData *d)
{ {
// IMPLEMENT!!! This is TEMPORALY!!!
Lock();
//Not quite that simple bub - REDO!!!
RGBColor c = d->highcolor;
StrokeSolidLine(start,end,c);
Unlock();
} }
/*! /*!
@@ -2240,12 +2246,12 @@ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, DisplayDr
} }
} }
void DisplayDriver::StrokePoint(BPoint& pt, RGBColor &color) void DisplayDriver::StrokePoint(BPoint& pt, const RGBColor &color)
{ {
StrokeLine(pt, pt, color); StrokeLine(pt, pt, color);
} }
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, RGBColor &color, bool is_closed) void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const RGBColor &color, bool is_closed)
{ {
if(!ptlist) if(!ptlist)
return; return;
@@ -2285,7 +2291,7 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const DrawData *
\param pensize Thickness of the lines \param pensize Thickness of the lines
\param color The color of the rectangle \param color The color of the rectangle
*/ */
void DisplayDriver::StrokeRect(const BRect &r, RGBColor &color) void DisplayDriver::StrokeRect(const BRect &r, const RGBColor &color)
{ {
Lock(); Lock();
StrokeSolidRect(r,color); StrokeSolidRect(r,color);
@@ -2309,7 +2315,7 @@ void DisplayDriver::StrokeRect(const BRect &r, const DrawData *d)
\param pat 8-byte array containing the const Pattern &to use. Always non-NULL. \param pat 8-byte array containing the const Pattern &to use. Always non-NULL.
*/ */
void DisplayDriver::StrokeRegion(BRegion& r, RGBColor &color) void DisplayDriver::StrokeRegion(BRegion& r, const RGBColor &color)
{ {
Lock(); Lock();
@@ -2329,7 +2335,7 @@ void DisplayDriver::StrokeRegion(BRegion& r, const DrawData *d)
Unlock(); Unlock();
} }
void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, RGBColor &color) void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, const RGBColor &color)
{ {
} }
@@ -2380,7 +2386,7 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo
\param pensize The line thickness \param pensize The line thickness
\param color The color of the lines \param color The color of the lines
*/ */
void DisplayDriver::StrokeTriangle(BPoint *pts, RGBColor &color) void DisplayDriver::StrokeTriangle(BPoint *pts, const RGBColor &color)
{ {
Lock(); Lock();
StrokeLine(pts[0],pts[1],color); StrokeLine(pts[0],pts[1],color);
@@ -2950,7 +2956,7 @@ void DisplayDriver::Blit(const BRect &src, const BRect &dest, const DrawData *d)
{ {
} }
void DisplayDriver::FillSolidRect(const BRect &rect, RGBColor &color) void DisplayDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
{ {
} }
@@ -2959,8 +2965,9 @@ void DisplayDriver::FillPatternRect(const BRect &rect, const DrawData *d)
} }
/* Draws a line with pensize 1. Coordinates are guarenteed to be in bounds */ /* Draws a line with pensize 1. Coordinates are guarenteed to be in bounds */
void DisplayDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColor &color) void DisplayDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color)
{ {
debugger("DD:StrokeSolidLine()\n");
} }
/* Draws a line with pensize 1. Coordinates are guarenteed to be in bounds */ /* Draws a line with pensize 1. Coordinates are guarenteed to be in bounds */
@@ -2968,7 +2975,7 @@ void DisplayDriver::StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, co
{ {
} }
void DisplayDriver::StrokeSolidRect(const BRect &rect, RGBColor &color) void DisplayDriver::StrokeSolidRect(const BRect &rect, const RGBColor &color)
{ {
} }
+6 -103
View File
@@ -553,103 +553,6 @@ void ViewDriver::SetMode(const display_mode &mode)
screenwin->Unlock(); screenwin->Unlock();
} }
/*
void ViewDriver::CopyRegion(BRegion *src, const BPoint &lefttop)
{
if(!is_initialized)
return;
STRACE(("ViewDriver:: CopyRegion not completely tested\n"));
screenwin->Lock();
framebuffer->Lock();
// Check for cases where the region is only 1 rectangle and call CopyBits in
// such a case. While in this particular case CopyBits is not HW-accelerated,
// other DisplayDriver derivatives, like AccelerantDriver, can take advantage of
// such things, cutting speed significantly in such cases
if(src->CountRects()==1)
{
BRect srect(src->RectAt(0)),drect(src->RectAt(0).OffsetToCopy(lefttop));
drawview->CopyBits(srect,drect);
drawview->Sync();
screenwin->view->Invalidate(srect);
screenwin->view->Invalidate(drect);
framebuffer->Unlock();
screenwin->Unlock();
return;
}
// Check for overlap
bool overlap=false;
BRect regframe=src->Frame();
regframe.OffsetTo(lefttop);
BRegion inverse;
int8 *savebuffer=NULL,*srcindex=NULL,*destindex=NULL,
*framebufferstart=NULL;
int32 buffer_row_size=0,i;
if(TestRectIntersection(regframe,src->Frame()) && src->CountRects()>1)
overlap=true;
if(overlap)
{
printf("Overlap\n");
// If overlap, get the inverse of the region passed to us and save the
// inverse region's frame
inverse=src->Frame();
inverse.Exclude(src);
buffer_row_size=inverse.Frame().IntegerWidth() * 4;
destindex=savebuffer=new int8[ buffer_row_size * inverse.Frame().IntegerHeight()];
framebufferstart=srcindex=(int8*)framebuffer->Bits()+
(framebuffer->BytesPerRow()* int32(inverse.Frame().top));
srcindex+=int32(inverse.Frame().left)*4;
for(i=int32(inverse.Frame().top);i<int32(inverse.Frame().bottom); i++)
{
memcpy(destindex,srcindex,buffer_row_size);
srcindex+=framebuffer->BytesPerRow();
destindex+=buffer_row_size;
}
}
// Copy all rectangles in the region to the new offset
BRect srcrect,destrect;
for(i=0; i<src->CountRects(); i++)
{
srcrect=destrect=src->RectAt(i);
destrect.OffsetTo(lefttop);
drawview->CopyBits(srcrect,destrect);
}
drawview->Sync();
if(overlap)
{
// Copy all saved rectangles back to the screen and clean up
srcindex=savebuffer;
destindex=framebufferstart;
for(i=int32(inverse.Frame().top);i<int32(inverse.Frame().bottom); i++)
{
memcpy(destindex,srcindex,buffer_row_size);
srcindex+=framebuffer->BytesPerRow();
destindex+=buffer_row_size;
}
delete savebuffer;
}
screenwin->view->Invalidate(src->Frame());
screenwin->view->Invalidate(regframe);
framebuffer->Unlock();
screenwin->Unlock();
}
*/
void ViewDriver::DrawBitmap(ServerBitmap *bitmap, const BRect &src, const BRect &dest, const DrawData *d) void ViewDriver::DrawBitmap(ServerBitmap *bitmap, const BRect &src, const BRect &dest, const DrawData *d)
{ {
@@ -732,7 +635,7 @@ void ViewDriver::InvertRect(const BRect &r)
screenwin->Unlock(); screenwin->Unlock();
} }
void ViewDriver::FillSolidRect(const BRect &rect, RGBColor &color) void ViewDriver::FillSolidRect(const BRect &rect, const RGBColor &color)
{ {
if(!is_initialized) if(!is_initialized)
return; return;
@@ -766,7 +669,7 @@ void ViewDriver::FillPatternRect(const BRect &rect, const DrawData *d)
screenwin->Unlock(); screenwin->Unlock();
} }
void ViewDriver::StrokePatternLine(const BPoint &start, const BPoint &end, const DrawData *d) void ViewDriver::StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2, const DrawData *d)
{ {
if(!d) if(!d)
return; return;
@@ -778,14 +681,14 @@ void ViewDriver::StrokePatternLine(const BPoint &start, const BPoint &end, const
framebuffer->Lock(); framebuffer->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->StrokeLine(start,end,*((pattern*)d->patt.GetInt8())); drawview->StrokeLine(BPoint(x1,y1),BPoint(x2,y2),*((pattern*)d->patt.GetInt8()));
drawview->Sync(); drawview->Sync();
screenwin->view->Invalidate(BRect(start,end)); screenwin->view->Invalidate(BRect(x1, y1, x2, y2));
framebuffer->Unlock(); framebuffer->Unlock();
screenwin->Unlock(); screenwin->Unlock();
} }
void ViewDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColor &color) void ViewDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, const RGBColor &color)
{ {
if(!is_initialized) if(!is_initialized)
return; return;
@@ -800,7 +703,7 @@ void ViewDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColo
screenwin->Unlock(); screenwin->Unlock();
} }
void ViewDriver::StrokeSolidRect(const BRect &rect, RGBColor &color) void ViewDriver::StrokeSolidRect(const BRect &rect, const RGBColor &color)
{ {
if(!is_initialized) if(!is_initialized)
return; return;
+5 -5
View File
@@ -130,13 +130,13 @@ public:
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT); virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
protected: protected:
virtual void FillSolidRect(const BRect &rect, RGBColor &color); virtual void FillSolidRect(const BRect &rect, const RGBColor &color);
virtual void FillPatternRect(const BRect &rect, const DrawData *d); virtual void FillPatternRect(const BRect &rect, const DrawData *d);
virtual void StrokeSolidRect(const BRect &rect, RGBColor &color); virtual void StrokeSolidRect(const BRect &rect, const RGBColor &color);
virtual void StrokeSolidLine(const BPoint &start, const BPoint &end, virtual void StrokeSolidLine(const BPoint &start, const BPoint &end,
RGBColor &color); const RGBColor &color);
virtual void SetDrawData(const DrawData *d, bool set_font_data=false); virtual void SetDrawData(const DrawData *d, bool set_font_data=false);
virtual void StrokePatternLine(const BPoint &start, const BPoint &end, virtual void StrokePatternLine(int32 x1, int32 y1, int32 x2, int32 y2,
const DrawData *d); const DrawData *d);
virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source, virtual void CopyBitmap(ServerBitmap *bitmap, const BRect &source,
const BRect &dest, const DrawData *d); const BRect &dest, const DrawData *d);