Updated the various drivers to match the DisplayDriver::StrokeLineArray changes

Removed dead code from ServerApp.h
Added to ServerWindow support for area-based messages and implemented code for AS_STROKE_LINEARRAY


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9378 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2004-10-16 02:02:27 +00:00
parent 11620a7e4c
commit 37aec728fa
11 changed files with 408 additions and 302 deletions

View File

@ -214,9 +214,9 @@ void AccelerantDriver::Shutdown(void)
\param pensize The thickness of the lines
\param colors Array of colors for each respective line
*/
void AccelerantDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
void AccelerantDriver::StrokeLineArray(const int32 &numlines, const LineArrayData *linedata,const DrawData *d)
{
if(!d)
if(!d || !linedata)
return;
int x1, y1, x2, y2, dx, dy;
@ -224,18 +224,22 @@ void AccelerantDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const
double xInc, yInc;
double x,y;
int i;
const LineArrayData *data;
Lock();
fLineThickness = (int)d->pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
for (i=0; i<numlines; i++)
{
data=(const LineArrayData *)&(linedata[i]);
//fDrawColor = colors[i];
fDrawPattern.SetColors(colors[i],colors[i]);
x1 = ROUND(pts[i*2].x);
y1 = ROUND(pts[i*2].y);
x2 = ROUND(pts[i*2+1].x);
y2 = ROUND(pts[i*2+1].y);
fDrawPattern.SetColors(data->color,data->color);
x1 = ROUND(data->pt1.x);
y1 = ROUND(data->pt1.y);
x2 = ROUND(data->pt2.x);
y2 = ROUND(data->pt2.y);
dx = x2-x1;
dy = y2-y1;
x = x1;
@ -246,7 +250,7 @@ void AccelerantDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const
steps = abs(dy);
xInc = dx / (double) steps;
yInc = dy / (double) steps;
SetThickPatternPixel(ROUND(x),ROUND(y));
for (k=0; k<steps; k++)
{

View File

@ -50,7 +50,7 @@ public:
virtual void SetMode(const int32 &mode);
virtual void SetMode(const display_mode &mode);
virtual bool DumpToFile(const char *path);
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors);
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *linedata,const DrawData *d);
/*
virtual status_t SetDPMSMode(const uint32 &state);

View File

@ -79,13 +79,13 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
// tab_highcol=_colors->window_tab;
// tab_lowcol=_colors->window_tab;
STRACE(("DefaultDecorator:\n"));
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
STRACE(("DefaultDecorator:\n"));
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
}
DefaultDecorator::~DefaultDecorator(void)
{
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
delete [] framecolors;
}
@ -176,7 +176,7 @@ click_type DefaultDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
void DefaultDecorator::_DoLayout(void)
{
STRACE(("DefaultDecorator: Do Layout\n"));
STRACE(("DefaultDecorator: Do Layout\n"));
// Here we determine the size of every rectangle that we use
// internally when we are given the size of the client rectangle.
@ -302,8 +302,8 @@ void DefaultDecorator::ResizeBy(BPoint pt)
_frame.right += pt.x;
_frame.bottom += pt.y;
// TODO: make bigger/smaller
// _tabrect.
// TODO: make bigger/smaller
// _tabrect.
_resizerect.OffsetBy(pt);
// _zoomrect.OffsetBy(pt);

View File

@ -235,27 +235,23 @@ void DirectDriver::InvertRect(const BRect &r)
Unlock();
}
void DirectDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
void DirectDriver::StrokeLineArray(const int32 &numlines, const LineArrayData *linedata, const DrawData *d)
{
if( !numlines || !pts || !colors || !d)
if( !numlines || !linedata || !d)
return;
const LineArrayData *data;
Lock();
framebuffer->Lock();
drawview->SetPenSize(d->pensize);
drawview->SetDrawingMode(d->draw_mode);
int32 ptindex=0;
drawview->BeginLineArray(numlines);
for(int32 i=0; i<numlines; i++)
{
BPoint pt1=pts[ptindex++];
BPoint pt2=pts[ptindex++];
rgb_color col=colors[i].GetColor32();
drawview->AddLine(pt1,pt2,col);
data=(const LineArrayData *)&linedata[i];
drawview->AddLine(data->pt1,data->pt2,data->color);
}
drawview->EndLineArray();

View File

@ -125,7 +125,7 @@ public:
virtual void InvertRect(const BRect &r);
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors);
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *linedata, const DrawData *d);
virtual void SetMode(const display_mode &mode);

View File

@ -3599,32 +3599,58 @@ void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const DrawD
/*!
\brief Draws a series of lines - optimized for speed
\param pts Array of BPoints pairs
\param numlines Number of lines to be drawn
\param pensize The thickness of the lines
\param colors Array of colors for each respective line
\param linedata Array of LineArrayData objects
\param d current DrawData settings
*/
void DisplayDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
void DisplayDriver::StrokeLineArray(const int32 &numlines, const LineArrayData *linedata,const DrawData *d)
{
int i;
DrawData data;
if(!d || !linedata)
return;
const LineArrayData *dataindex=linedata;
BRect r(0,0,0,0);
DrawData drawdata;
Lock();
BRect invalid=CalculatePolygonBounds(pts,numlines*2);
fCursorHandler->DriverHide();
if(fCursorHandler->IntersectsCursor(invalid))
fCursorHandler->DriverHide();
drawdata = *d;
data = *d;
for (i=0; i<numlines; i++)
r.Set(linedata->pt1.x,linedata->pt1.y,linedata->pt1.x,linedata->pt1.y);
for (int32 i=0; i<numlines; i++)
{
data.highcolor = colors[i];
StrokeLine(pts[i<<1],pts[i<<1+1],&data);
dataindex=(const LineArrayData*) &linedata[i];
drawdata.highcolor = dataindex->color;
// Keep track of the invalid region
if (dataindex->pt1.x < r.left)
r.left = dataindex->pt1.x;
if (dataindex->pt1.y < r.top)
r.top = dataindex->pt1.y;
if (dataindex->pt1.x > r.right)
r.right = dataindex->pt1.x;
if (dataindex->pt1.y > r.bottom)
r.bottom = dataindex->pt1.y;
if (dataindex->pt2.x < r.left)
r.left = dataindex->pt2.x;
if (dataindex->pt2.y < r.top)
r.top = dataindex->pt2.y;
if (dataindex->pt2.x > r.right)
r.right = dataindex->pt2.x;
if (dataindex->pt2.y > r.bottom)
r.bottom = dataindex->pt2.y;
StrokeLine(dataindex->pt1,dataindex->pt2,&drawdata);
}
Invalidate(r);
fCursorHandler->DriverShow();
Unlock();
}

View File

@ -83,7 +83,6 @@ protected:
friend class AppServer;
friend class ServerWindow;
// void DispatchMessage(int32 code, BPortLink& msg);
void DispatchMessage(int32 code, LinkMsgReader &link);
port_id fClientAppPort,

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,8 @@
#include <Rect.h>
#include <String.h>
#include <Window.h>
#include <LinkMsgReader.h>
#include <LinkMsgSender.h>
#include "FMWList.h"
class BString;
@ -120,12 +122,12 @@ public:
private:
// methods for retrieving and creating a tree strcture of Layers.
Layer *CreateLayerTree(Layer *localRoot);
void SetLayerState(Layer *layer);
void SetLayerFontState(Layer *layer);
Layer *CreateLayerTree(Layer *localRoot, LinkMsgReader &link);
void SetLayerState(Layer *layer, LinkMsgReader &link);
void SetLayerFontState(Layer *layer, LinkMsgReader &link);
// message handle methods.
void DispatchMessage(int32 code);
void DispatchMessage(int32 code, LinkMsgReader &link);
static int32 MonitorWin(void *data);
@ -156,7 +158,8 @@ protected:
uint32 fToken;
int32 fHandlerToken;
BPortLink *fSession;
LinkMsgReader *fMsgReader;
LinkMsgSender *fMsgSender;
// cl is short for currentLayer. We'll use it a lot, that's why it's short :-)
Layer *cl;

View File

@ -606,31 +606,28 @@ bool ViewDriver::DumpToFile(const char *path)
\param pensize The thickness of the lines
\param colors Array of colors for each respective line
*/
void ViewDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
void ViewDriver::StrokeLineArray(const int32 &numlines, const LineArrayData *linedata,
const DrawData *d)
{
if(!is_initialized)
return;
if( !numlines || !pts || !colors || !d)
if( !numlines || !linedata || !d)
return;
const LineArrayData *data;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(d->pensize);
drawview->SetDrawingMode(d->draw_mode);
int32 ptindex=0;
drawview->BeginLineArray(numlines);
for(int32 i=0; i<numlines; i++)
{
BPoint pt1=pts[ptindex++];
BPoint pt2=pts[ptindex++];
rgb_color col=colors[i].GetColor32();
drawview->AddLine(pt1,pt2,col);
data=(const LineArrayData *)&linedata[i];
drawview->AddLine(data->pt1,data->pt2,data->color);
}
drawview->EndLineArray();

View File

@ -110,8 +110,8 @@ public:
virtual void InvertRect(const BRect &r);
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines,
const DrawData *d, RGBColor *colors);
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *data,
const DrawData *d);
virtual void SetMode(const display_mode &mode);