Updated to new pattern-passing system

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4122 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2003-07-29 04:09:18 +00:00
parent c3ba6ec990
commit 652f7b9bbc
2 changed files with 47 additions and 47 deletions

View File

@ -183,7 +183,7 @@ void PreviewDriver::InvertRect(BRect r)
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::StrokeBezier(BPoint *pts, LayerData *d, int8 *pat) void PreviewDriver::StrokeBezier(BPoint *pts, LayerData *d, const Pattern &pat)
{ {
BPoint points[4]; BPoint points[4];
for(uint8 i=0;i<4;i++) for(uint8 i=0;i<4;i++)
@ -193,13 +193,13 @@ void PreviewDriver::StrokeBezier(BPoint *pts, LayerData *d, int8 *pat)
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeBezier(points,*((pattern *)pat)); drawview->StrokeBezier(points,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(); view->Invalidate();
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::FillBezier(BPoint *pts, LayerData *d, int8 *pat) void PreviewDriver::FillBezier(BPoint *pts, LayerData *d, const Pattern &pat)
{ {
BPoint points[4]; BPoint points[4];
for(uint8 i=0;i<4;i++) for(uint8 i=0;i<4;i++)
@ -209,159 +209,159 @@ void PreviewDriver::FillBezier(BPoint *pts, LayerData *d, int8 *pat)
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeBezier(points,*((pattern *)pat)); drawview->StrokeBezier(points,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(); view->Invalidate();
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::StrokeEllipse(BRect r, LayerData *d, int8 *pat) void PreviewDriver::StrokeEllipse(BRect r, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeEllipse(r,*((pattern *)pat)); drawview->StrokeEllipse(r,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::FillEllipse(BRect r, LayerData *d, int8 *pat) void PreviewDriver::FillEllipse(BRect r, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->FillEllipse(r,*((pattern *)pat)); drawview->FillEllipse(r,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat) void PreviewDriver::StrokeArc(BRect r, float angle, float span, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeArc(r,angle,span,*((pattern *)pat)); drawview->StrokeArc(r,angle,span,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat) void PreviewDriver::FillArc(BRect r, float angle, float span, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->FillArc(r,angle,span,*((pattern *)pat)); drawview->FillArc(r,angle,span,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat) void PreviewDriver::StrokeLine(BPoint start, BPoint end, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeLine(start,end,*((pattern *)pat)); drawview->StrokeLine(start,end,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(); view->Invalidate();
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true) void PreviewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, const Pattern &pat, bool is_closed=true)
{ {
} }
void PreviewDriver::FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat) void PreviewDriver::FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, const Pattern &pat)
{ {
} }
void PreviewDriver::StrokeRect(BRect r, LayerData *d, int8 *pat) void PreviewDriver::StrokeRect(BRect r, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeRect(r,*((pattern *)pat)); drawview->StrokeRect(r,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::FillRect(BRect r, LayerData *d, int8 *pat) void PreviewDriver::FillRect(BRect r, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->FillRect(r,*((pattern *)pat)); drawview->FillRect(r,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat) void PreviewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeRoundRect(r,xrad,yrad,*((pattern *)pat)); drawview->StrokeRoundRect(r,xrad,yrad,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat) void PreviewDriver::FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->FillRoundRect(r,xrad,yrad,*((pattern *)pat)); drawview->FillRoundRect(r,xrad,yrad,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
/* /*
void StrokeShape(SShape *sh, LayerData *d, int8 *pat) void StrokeShape(SShape *sh, LayerData *d, const Pattern &pat)
{ {
} }
void FillShape(SShape *sh, LayerData *d, int8 *pat) void FillShape(SShape *sh, LayerData *d, const Pattern &pat)
{ {
} }
*/ */
void PreviewDriver::StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat) void PreviewDriver::StrokeTriangle(BPoint *pts, BRect r, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->StrokeTriangle(pts[0],pts[1], drawview->StrokeTriangle(pts[0],pts[1],
pts[2],r,*((pattern *)pat)); pts[2],r,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();
} }
void PreviewDriver::FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat) void PreviewDriver::FillTriangle(BPoint *pts, BRect r, LayerData *d, const Pattern &pat)
{ {
view->viewbmp->Lock(); view->viewbmp->Lock();
drawview->SetHighColor(d->highcolor.GetColor32()); drawview->SetHighColor(d->highcolor.GetColor32());
drawview->SetLowColor(d->lowcolor.GetColor32()); drawview->SetLowColor(d->lowcolor.GetColor32());
drawview->SetPenSize(d->pensize); drawview->SetPenSize(d->pensize);
drawview->FillTriangle(pts[0],pts[1], drawview->FillTriangle(pts[0],pts[1],
pts[2],r,*((pattern *)pat)); pts[2],r,*((pattern *)pat.GetInt8()));
drawview->Sync(); drawview->Sync();
view->Invalidate(r); view->Invalidate(r);
view->viewbmp->Unlock(); view->viewbmp->Unlock();

View File

@ -69,23 +69,23 @@ public:
// void DrawPicture(SPicture *pic, BPoint pt); // void DrawPicture(SPicture *pic, BPoint pt);
void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL); void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
void InvertRect(BRect r); void InvertRect(BRect r);
void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat); void StrokeBezier(BPoint *pts, LayerData *d, const Pattern &pat);
void FillBezier(BPoint *pts, LayerData *d, int8 *pat); void FillBezier(BPoint *pts, LayerData *d, const Pattern &pat);
void StrokeEllipse(BRect r, LayerData *d, int8 *pat); void StrokeEllipse(BRect r, LayerData *d, const Pattern &pat);
void FillEllipse(BRect r, LayerData *d, int8 *pat); void FillEllipse(BRect r, LayerData *d, const Pattern &pat);
void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat); void StrokeArc(BRect r, float angle, float span, LayerData *d, const Pattern &pat);
void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat); void FillArc(BRect r, float angle, float span, LayerData *d, const Pattern &pat);
void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat); void StrokeLine(BPoint start, BPoint end, LayerData *d, const Pattern &pat);
void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true); void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, const Pattern &pat, bool is_closed=true);
void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat); void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, const Pattern &pat);
void StrokeRect(BRect r, LayerData *d, int8 *pat); void StrokeRect(BRect r, LayerData *d, const Pattern &pat);
void FillRect(BRect r, LayerData *d, int8 *pat); void FillRect(BRect r, LayerData *d, const Pattern &pat);
void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat); void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, const Pattern &pat);
void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat); void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, const Pattern &pat);
// void StrokeShape(SShape *sh, LayerData *d, int8 *pat); // void StrokeShape(SShape *sh, LayerData *d, const Pattern &pat);
// void FillShape(SShape *sh, LayerData *d, int8 *pat); // void FillShape(SShape *sh, LayerData *d, const Pattern &pat);
void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat); void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, const Pattern &pat);
void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat); void FillTriangle(BPoint *pts, BRect r, LayerData *d, const Pattern &pat);
void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d); void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
void SetMode(int32 mode); void SetMode(int32 mode);
float StringWidth(const char *string, int32 length, LayerData *d); float StringWidth(const char *string, int32 length, LayerData *d);