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:
@@ -214,9 +214,9 @@ void AccelerantDriver::Shutdown(void)
|
|||||||
\param pensize The thickness of the lines
|
\param pensize The thickness of the lines
|
||||||
\param colors Array of colors for each respective line
|
\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;
|
return;
|
||||||
|
|
||||||
int x1, y1, x2, y2, dx, dy;
|
int x1, y1, x2, y2, dx, dy;
|
||||||
@@ -224,18 +224,22 @@ void AccelerantDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const
|
|||||||
double xInc, yInc;
|
double xInc, yInc;
|
||||||
double x,y;
|
double x,y;
|
||||||
int i;
|
int i;
|
||||||
|
const LineArrayData *data;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
fLineThickness = (int)d->pensize;
|
fLineThickness = (int)d->pensize;
|
||||||
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
|
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
|
||||||
for (i=0; i<numlines; i++)
|
for (i=0; i<numlines; i++)
|
||||||
{
|
{
|
||||||
|
data=(const LineArrayData *)&(linedata[i]);
|
||||||
|
|
||||||
//fDrawColor = colors[i];
|
//fDrawColor = colors[i];
|
||||||
fDrawPattern.SetColors(colors[i],colors[i]);
|
fDrawPattern.SetColors(data->color,data->color);
|
||||||
x1 = ROUND(pts[i*2].x);
|
|
||||||
y1 = ROUND(pts[i*2].y);
|
x1 = ROUND(data->pt1.x);
|
||||||
x2 = ROUND(pts[i*2+1].x);
|
y1 = ROUND(data->pt1.y);
|
||||||
y2 = ROUND(pts[i*2+1].y);
|
x2 = ROUND(data->pt2.x);
|
||||||
|
y2 = ROUND(data->pt2.y);
|
||||||
dx = x2-x1;
|
dx = x2-x1;
|
||||||
dy = y2-y1;
|
dy = y2-y1;
|
||||||
x = x1;
|
x = x1;
|
||||||
@@ -246,7 +250,7 @@ void AccelerantDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const
|
|||||||
steps = abs(dy);
|
steps = abs(dy);
|
||||||
xInc = dx / (double) steps;
|
xInc = dx / (double) steps;
|
||||||
yInc = dy / (double) steps;
|
yInc = dy / (double) steps;
|
||||||
|
|
||||||
SetThickPatternPixel(ROUND(x),ROUND(y));
|
SetThickPatternPixel(ROUND(x),ROUND(y));
|
||||||
for (k=0; k<steps; k++)
|
for (k=0; k<steps; k++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
virtual void SetMode(const int32 &mode);
|
virtual void SetMode(const int32 &mode);
|
||||||
virtual void SetMode(const display_mode &mode);
|
virtual void SetMode(const display_mode &mode);
|
||||||
virtual bool DumpToFile(const char *path);
|
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);
|
virtual status_t SetDPMSMode(const uint32 &state);
|
||||||
|
|||||||
@@ -79,13 +79,13 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
|
|||||||
// tab_highcol=_colors->window_tab;
|
// tab_highcol=_colors->window_tab;
|
||||||
// tab_lowcol=_colors->window_tab;
|
// tab_lowcol=_colors->window_tab;
|
||||||
|
|
||||||
STRACE(("DefaultDecorator:\n"));
|
STRACE(("DefaultDecorator:\n"));
|
||||||
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultDecorator::~DefaultDecorator(void)
|
DefaultDecorator::~DefaultDecorator(void)
|
||||||
{
|
{
|
||||||
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
|
STRACE(("DefaultDecorator: ~DefaultDecorator()\n"));
|
||||||
delete [] framecolors;
|
delete [] framecolors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ click_type DefaultDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
|||||||
|
|
||||||
void DefaultDecorator::_DoLayout(void)
|
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
|
// Here we determine the size of every rectangle that we use
|
||||||
// internally when we are given the size of the client rectangle.
|
// 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.right += pt.x;
|
||||||
_frame.bottom += pt.y;
|
_frame.bottom += pt.y;
|
||||||
|
|
||||||
// TODO: make bigger/smaller
|
// TODO: make bigger/smaller
|
||||||
// _tabrect.
|
// _tabrect.
|
||||||
|
|
||||||
_resizerect.OffsetBy(pt);
|
_resizerect.OffsetBy(pt);
|
||||||
// _zoomrect.OffsetBy(pt);
|
// _zoomrect.OffsetBy(pt);
|
||||||
|
|||||||
@@ -235,27 +235,23 @@ void DirectDriver::InvertRect(const BRect &r)
|
|||||||
Unlock();
|
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;
|
return;
|
||||||
|
|
||||||
|
const LineArrayData *data;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
drawview->SetPenSize(d->pensize);
|
drawview->SetPenSize(d->pensize);
|
||||||
drawview->SetDrawingMode(d->draw_mode);
|
drawview->SetDrawingMode(d->draw_mode);
|
||||||
|
|
||||||
int32 ptindex=0;
|
|
||||||
|
|
||||||
drawview->BeginLineArray(numlines);
|
drawview->BeginLineArray(numlines);
|
||||||
for(int32 i=0; i<numlines; i++)
|
for(int32 i=0; i<numlines; i++)
|
||||||
{
|
{
|
||||||
BPoint pt1=pts[ptindex++];
|
data=(const LineArrayData *)&linedata[i];
|
||||||
BPoint pt2=pts[ptindex++];
|
drawview->AddLine(data->pt1,data->pt2,data->color);
|
||||||
rgb_color col=colors[i].GetColor32();
|
|
||||||
|
|
||||||
drawview->AddLine(pt1,pt2,col);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
drawview->EndLineArray();
|
drawview->EndLineArray();
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public:
|
|||||||
|
|
||||||
virtual void InvertRect(const BRect &r);
|
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);
|
virtual void SetMode(const display_mode &mode);
|
||||||
|
|
||||||
|
|||||||
@@ -3599,32 +3599,58 @@ void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const DrawD
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Draws a series of lines - optimized for speed
|
\brief Draws a series of lines - optimized for speed
|
||||||
\param pts Array of BPoints pairs
|
|
||||||
\param numlines Number of lines to be drawn
|
\param numlines Number of lines to be drawn
|
||||||
\param pensize The thickness of the lines
|
\param linedata Array of LineArrayData objects
|
||||||
\param colors Array of colors for each respective line
|
\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;
|
if(!d || !linedata)
|
||||||
DrawData data;
|
return;
|
||||||
|
|
||||||
|
const LineArrayData *dataindex=linedata;
|
||||||
|
BRect r(0,0,0,0);
|
||||||
|
DrawData drawdata;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
BRect invalid=CalculatePolygonBounds(pts,numlines*2);
|
fCursorHandler->DriverHide();
|
||||||
|
|
||||||
if(fCursorHandler->IntersectsCursor(invalid))
|
drawdata = *d;
|
||||||
fCursorHandler->DriverHide();
|
|
||||||
|
|
||||||
data = *d;
|
r.Set(linedata->pt1.x,linedata->pt1.y,linedata->pt1.x,linedata->pt1.y);
|
||||||
for (i=0; i<numlines; i++)
|
|
||||||
|
for (int32 i=0; i<numlines; i++)
|
||||||
{
|
{
|
||||||
data.highcolor = colors[i];
|
dataindex=(const LineArrayData*) &linedata[i];
|
||||||
StrokeLine(pts[i<<1],pts[i<<1+1],&data);
|
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();
|
fCursorHandler->DriverShow();
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ protected:
|
|||||||
friend class AppServer;
|
friend class AppServer;
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
|
|
||||||
// void DispatchMessage(int32 code, BPortLink& msg);
|
|
||||||
void DispatchMessage(int32 code, LinkMsgReader &link);
|
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||||
|
|
||||||
port_id fClientAppPort,
|
port_id fClientAppPort,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,8 @@
|
|||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
#include <LinkMsgReader.h>
|
||||||
|
#include <LinkMsgSender.h>
|
||||||
#include "FMWList.h"
|
#include "FMWList.h"
|
||||||
|
|
||||||
class BString;
|
class BString;
|
||||||
@@ -120,12 +122,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// methods for retrieving and creating a tree strcture of Layers.
|
// methods for retrieving and creating a tree strcture of Layers.
|
||||||
Layer *CreateLayerTree(Layer *localRoot);
|
Layer *CreateLayerTree(Layer *localRoot, LinkMsgReader &link);
|
||||||
void SetLayerState(Layer *layer);
|
void SetLayerState(Layer *layer, LinkMsgReader &link);
|
||||||
void SetLayerFontState(Layer *layer);
|
void SetLayerFontState(Layer *layer, LinkMsgReader &link);
|
||||||
|
|
||||||
// message handle methods.
|
// message handle methods.
|
||||||
void DispatchMessage(int32 code);
|
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||||
static int32 MonitorWin(void *data);
|
static int32 MonitorWin(void *data);
|
||||||
|
|
||||||
|
|
||||||
@@ -156,7 +158,8 @@ protected:
|
|||||||
uint32 fToken;
|
uint32 fToken;
|
||||||
int32 fHandlerToken;
|
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 :-)
|
// cl is short for currentLayer. We'll use it a lot, that's why it's short :-)
|
||||||
Layer *cl;
|
Layer *cl;
|
||||||
|
|||||||
@@ -606,31 +606,28 @@ bool ViewDriver::DumpToFile(const char *path)
|
|||||||
\param pensize The thickness of the lines
|
\param pensize The thickness of the lines
|
||||||
\param colors Array of colors for each respective line
|
\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)
|
if(!is_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !numlines || !pts || !colors || !d)
|
if( !numlines || !linedata || !d)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const LineArrayData *data;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
screenwin->Lock();
|
screenwin->Lock();
|
||||||
framebuffer->Lock();
|
framebuffer->Lock();
|
||||||
drawview->SetPenSize(d->pensize);
|
drawview->SetPenSize(d->pensize);
|
||||||
drawview->SetDrawingMode(d->draw_mode);
|
drawview->SetDrawingMode(d->draw_mode);
|
||||||
|
|
||||||
int32 ptindex=0;
|
|
||||||
|
|
||||||
drawview->BeginLineArray(numlines);
|
drawview->BeginLineArray(numlines);
|
||||||
for(int32 i=0; i<numlines; i++)
|
for(int32 i=0; i<numlines; i++)
|
||||||
{
|
{
|
||||||
BPoint pt1=pts[ptindex++];
|
data=(const LineArrayData *)&linedata[i];
|
||||||
BPoint pt2=pts[ptindex++];
|
drawview->AddLine(data->pt1,data->pt2,data->color);
|
||||||
rgb_color col=colors[i].GetColor32();
|
|
||||||
|
|
||||||
drawview->AddLine(pt1,pt2,col);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
drawview->EndLineArray();
|
drawview->EndLineArray();
|
||||||
|
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ public:
|
|||||||
|
|
||||||
virtual void InvertRect(const BRect &r);
|
virtual void InvertRect(const BRect &r);
|
||||||
|
|
||||||
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines,
|
virtual void StrokeLineArray(const int32 &numlines, const LineArrayData *data,
|
||||||
const DrawData *d, RGBColor *colors);
|
const DrawData *d);
|
||||||
|
|
||||||
virtual void SetMode(const display_mode &mode);
|
virtual void SetMode(const display_mode &mode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user