Major overhaul of DisplayDriver API - fewer virtual functions and less duplicated code

Removed Clipper from build
Removed ScreenDriver from build for the moment


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6334 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-01-27 00:38:14 +00:00
parent e0dd08e80c
commit 06d841d5ea
13 changed files with 331 additions and 2802 deletions
+13 -874
View File
@@ -82,7 +82,7 @@ AccelerantDriver::~AccelerantDriver(void)
*/
bool AccelerantDriver::Initialize(void)
{
int i;
/* int i;
char signature[1024];
char path[PATH_MAX];
struct stat accelerant_stat;
@@ -186,6 +186,8 @@ bool AccelerantDriver::Initialize(void)
RGBColor blue(0,0,255,0);
FillRect(BRect(0,0,1024,768),blue);
#endif
*/
return true;
}
@@ -197,6 +199,7 @@ bool AccelerantDriver::Initialize(void)
*/
void AccelerantDriver::Shutdown(void)
{
/*
#ifdef RUN_UNDER_R5
set_display_mode SetDisplayMode = (set_display_mode)accelerant_hook(B_SET_DISPLAY_MODE, NULL);
if ( SetDisplayMode )
@@ -209,491 +212,7 @@ void AccelerantDriver::Shutdown(void)
unload_add_on(accelerant_image);
if (card_fd >= 0)
close(card_fd);
}
/*!
\brief Called for all BView::CopyBits calls
\param src Source rectangle.
\param rect Destination rectangle.
Bounds checking must be done in this call. If the destination is not the same size
as the source, the source should be scaled to fit.
*/
void AccelerantDriver::CopyBits(BRect src, BRect dest)
{
/* TODO: implement */
}
/*!
\brief Called for all BView::DrawBitmap calls
\param bmp Bitmap to be drawn. It will always be non-NULL and valid. The color
space is not guaranteed to match.
\param src Source rectangle
\param dest Destination rectangle. Source will be scaled to fit if not the same size.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
Bounds checking must be done in this call.
*/
void AccelerantDriver::DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d)
{
/* TODO: implement */
}
/*!
\brief Utilizes the font engine to draw a string to the frame buffer
\param string String to be drawn. Always non-NULL.
\param length Number of characters in the string to draw. Always greater than 0. If greater
than the number of characters in the string, draw the entire string.
\param pt Point at which the baseline starts. Characters are to be drawn 1 pixel above
this for backwards compatibility. While the point itself is guaranteed to be inside
the frame buffers coordinate range, the clipping of each individual glyph must be
performed by the driver itself.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
\param delta Extra character padding
*/
void AccelerantDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *edelta)
{
if(!string || !d)
return;
Lock();
pt.y--; // because of Be's backward compatibility hack
ServerFont *font=&(d->font);
FontStyle *style=font->Style();
if(!style)
{
Unlock();
return;
}
FT_Face face;
FT_GlyphSlot slot;
FT_Matrix rmatrix,smatrix;
FT_UInt glyph_index=0, previous=0;
FT_Vector pen,delta,space,nonspace;
int16 error=0;
int32 strlength,i;
Angle rotation(font->Rotation()), shear(font->Shear());
bool antialias=( (font->Size()<18 && font->Flags()& B_DISABLE_ANTIALIASING==0)
|| font->Flags()& B_FORCE_ANTIALIASING)?true:false;
// Originally, I thought to do this shear checking here, but it really should be
// done in BFont::SetShear()
float shearangle=shear.Value();
if(shearangle>135)
shearangle=135;
if(shearangle<45)
shearangle=45;
if(shearangle>90)
shear=90+((180-shearangle)*2);
else
shear=90-(90-shearangle)*2;
error=FT_New_Face(ftlib, style->GetPath(), 0, &face);
if(error)
{
printf("Couldn't create face object\n");
Unlock();
return;
}
slot=face->glyph;
bool use_kerning=FT_HAS_KERNING(face) && font->Spacing()==B_STRING_SPACING;
error=FT_Set_Char_Size(face, 0,int32(font->Size())*64,72,72);
if(error)
{
Unlock();
return;
}
// if we do any transformation, we do a call to FT_Set_Transform() here
// First, rotate
rmatrix.xx = (FT_Fixed)( rotation.Cosine()*0x10000);
rmatrix.xy = (FT_Fixed)( rotation.Sine()*0x10000);
rmatrix.yx = (FT_Fixed)(-rotation.Sine()*0x10000);
rmatrix.yy = (FT_Fixed)( rotation.Cosine()*0x10000);
// Next, shear
smatrix.xx = (FT_Fixed)(0x10000);
smatrix.xy = (FT_Fixed)(-shear.Cosine()*0x10000);
smatrix.yx = (FT_Fixed)(0);
smatrix.yy = (FT_Fixed)(0x10000);
//FT_Matrix_Multiply(&rmatrix,&smatrix);
FT_Matrix_Multiply(&smatrix,&rmatrix);
// Set up the increment value for escapement padding
space.x=int32(d->edelta.space * rotation.Cosine()*64);
space.y=int32(d->edelta.space * rotation.Sine()*64);
nonspace.x=int32(d->edelta.nonspace * rotation.Cosine()*64);
nonspace.y=int32(d->edelta.nonspace * rotation.Sine()*64);
// set the pen position in 26.6 cartesian space coordinates
pen.x=(int32)pt.x * 64;
pen.y=(int32)pt.y * 64;
slot=face->glyph;
strlength=strlen(string);
if(length<strlength)
strlength=length;
for(i=0;i<strlength;i++)
{
//FT_Set_Transform(face,&smatrix,&pen);
FT_Set_Transform(face,&rmatrix,&pen);
// Handle escapement padding option
if((uint8)string[i]<=0x20)
{
pen.x+=space.x;
pen.y+=space.y;
}
else
{
pen.x+=nonspace.x;
pen.y+=nonspace.y;
}
// get kerning and move pen
if(use_kerning && previous && glyph_index)
{
FT_Get_Kerning(face, previous, glyph_index,ft_kerning_default, &delta);
pen.x+=delta.x;
pen.y+=delta.y;
}
error=FT_Load_Char(face,string[i],
((antialias)?FT_LOAD_RENDER:FT_LOAD_RENDER | FT_LOAD_MONOCHROME) );
if(!error)
{
//TODO: Replace BlitGray2RGB32 and BlitMono2RGB32
/*
if(antialias)
BlitGray2RGB32(&slot->bitmap,
BPoint(slot->bitmap_left,pt.y-(slot->bitmap_top-pt.y)), d);
else
BlitMono2RGB32(&slot->bitmap,
BPoint(slot->bitmap_left,pt.y-(slot->bitmap_top-pt.y)), d);
*/
}
else
printf("Couldn't load character %c\n", string[i]);
// increment pen position
pen.x+=slot->advance.x;
pen.y+=slot->advance.y;
previous=glyph_index;
}
FT_Done_Face(face);
Unlock();
}
void AccelerantDriver::FillArc(const BRect r, float angle, float span, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillArc(r,angle,span,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillArc(r,angle,span,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillBezier(BPoint *pts, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillBezier(pts,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillBezier(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillBezier(pts,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillEllipse(BRect r, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillEllipse(r,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillEllipse(BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillEllipse(r,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillPolygon(ptlist,numpts,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillPolygon(ptlist,numpts,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillRect(const BRect r, RGBColor& color)
{
Lock();
fDrawColor = color;
FillSolidRect((int32)r.left,(int32)r.top,(int32)r.right,(int32)r.bottom);
Unlock();
}
/*!
\brief Called for all BView::FillRect calls
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
\param pattern The pattern to be used when filling the rectangle
\param high_color The high color of the pattern to fill
\param low_color The low color of the pattern to fill
*/
void AccelerantDriver::FillRect(const BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
FillPatternRect((int32)r.left,(int32)r.top,(int32)r.right,(int32)r.bottom);
Unlock();
}
void AccelerantDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
fDrawColor = color;
DisplayDriver::FillRoundRect(r,xrad,yrad,this,(SetRectangleFuncType)&AccelerantDriver::FillSolidRect,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillRoundRect(r,xrad,yrad,this,(SetRectangleFuncType)&AccelerantDriver::FillPatternRect,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillTriangle(BPoint *pts, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillTriangle(pts,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillTriangle(pts,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick);
Unlock();
}
void AccelerantDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeArc(r,angle,span,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeArc(r,angle,span,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeBezier(pts,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeBezier(pts,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeEllipse(BRect r, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeEllipse(r,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeEllipse(r,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeLine(start,end,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeLine(start,end,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokePoint(BPoint& pt, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
SetThickPatternPixel((int)pt.x,(int)pt.y);
Unlock();
}
void AccelerantDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor& color, bool is_closed)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokePolygon(ptlist,numpts,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel,is_closed);
Unlock();
}
void AccelerantDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color, bool is_closed)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokePolygon(ptlist,numpts,this,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeRect(BRect r, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeRect(r,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick,(SetVerticalLineFuncType)&AccelerantDriver::VLinePatternThick);
Unlock();
}
void AccelerantDriver::StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeRect(r,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick,(SetVerticalLineFuncType)&AccelerantDriver::VLinePatternThick);
Unlock();
}
void AccelerantDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeRoundRect(r,xrad,yrad,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick,(SetVerticalLineFuncType)&AccelerantDriver::VLinePatternThick,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
void AccelerantDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeRoundRect(r,xrad,yrad,this,(SetHorizontalLineFuncType)&AccelerantDriver::HLinePatternThick,(SetVerticalLineFuncType)&AccelerantDriver::VLinePatternThick,(SetPixelFuncType)&AccelerantDriver::SetThickPatternPixel);
Unlock();
}
/*!
@@ -703,8 +222,11 @@ void AccelerantDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pe
\param pensize The thickness of the lines
\param colors Array of colors for each respective line
*/
void AccelerantDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors)
void AccelerantDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
{
if(!d)
return;
int x1, y1, x2, y2, dx, dy;
int steps, k;
double xInc, yInc;
@@ -712,7 +234,7 @@ void AccelerantDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensiz
int i;
Lock();
fLineThickness = (int)pensize;
fLineThickness = (int)d->pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
for (i=0; i<numlines; i++)
{
@@ -745,66 +267,11 @@ void AccelerantDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensiz
}
/*!
\brief Hides the cursor.
Hide calls are not nestable, unlike that of the BApplication class. Subclasses should
call _SetCursorHidden(true) somewhere within this function to ensure that data is
maintained accurately.
*/
void AccelerantDriver::HideCursor(void)
{
Lock();
if(!IsCursorHidden())
{
if ( accShowCursor )
accShowCursor(false);
else
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
}
DisplayDriver::HideCursor();
Unlock();
}
/*!
\brief Moves the cursor to the given point.
\param x Cursor's new x coordinate
\param y Cursor's new y coordinate
The coordinates passed to MoveCursorTo are guaranteed to be within the frame buffer's
range, but the cursor data itself will need to be clipped. A check to see if the
cursor is obscured should be made and if so, a call to _SetCursorObscured(false)
should be made the cursor in addition to displaying at the passed coordinates.
*/
void AccelerantDriver::MoveCursorTo(float x, float y)
{
/* TODO: Add correct handling of obscured cursors */
Lock();
if ( accMoveCursor )
{
accMoveCursor((uint16)x,(uint16)y);
}
else
{
if(!IsCursorHidden())
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
cursorframe.OffsetTo(x,y);
ExtractToBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
if(!IsCursorHidden())
BlitBitmap(cursor,cursor->Bounds(),cursorframe, B_OP_OVER);
}
Unlock();
}
/*!
\brief Inverts the colors in the rectangle.
\param r Rectangle of the area to be inverted. Guaranteed to be within bounds.
*/
void AccelerantDriver::InvertRect(BRect r)
void AccelerantDriver::InvertRect(const BRect &r)
{
Lock();
if ( accInvertRect && AcquireEngine && (AcquireEngine(0,0,NULL,&mEngineToken) == B_OK) )
@@ -911,106 +378,6 @@ void AccelerantDriver::InvertRect(BRect r)
Unlock();
}
/*!
\brief Shows the cursor.
Show calls are not nestable, unlike that of the BApplication class. Subclasses should
call _SetCursorHidden(false) somewhere within this function to ensure that data is
maintained accurately.
*/
void AccelerantDriver::ShowCursor(void)
{
Lock();
if(IsCursorHidden())
{
if ( accShowCursor )
accShowCursor(true);
else
BlitBitmap(cursor,cursor->Bounds(),cursorframe, B_OP_OVER);
}
DisplayDriver::ShowCursor();
Unlock();
}
/*!
\brief Obscures the cursor.
Obscure calls are not nestable. Subclasses should call _SetCursorObscured(true)
somewhere within this function to ensure that data is maintained accurately. When the
next call to MoveCursorTo() is made, the cursor will be shown again.
*/
void AccelerantDriver::ObscureCursor(void)
{
Lock();
if (!IsCursorHidden() )
{
if ( accShowCursor )
accShowCursor(false);
else
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
}
DisplayDriver::ObscureCursor();
Unlock();
}
/*!
\brief Changes the cursor.
\param cursor The new cursor. Guaranteed to be non-NULL.
The driver does not take ownership of the given cursor. Subclasses should make
a copy of the cursor passed to it. The default version of this function hides the
cursor, replaces it, and shows the cursor if previously visible.
*/
void AccelerantDriver::SetCursor(ServerCursor *csr)
{
if(!csr)
return;
Lock();
if ( accSetCursorShape && (csr->BitsPerPixel() == 1) )
{
/* TODO: Need to fix transparency */
if(cursor)
delete cursor;
cursor=new ServerCursor(csr);
cursorframe.right=cursorframe.left+csr->Bounds().Width();
cursorframe.bottom=cursorframe.top+csr->Bounds().Height();
uint16 width = (uint16)cursor->Bounds().Width();
uint16 height = (uint16)cursor->Bounds().Height();
uint16 hot_x = (uint16)cursor->GetHotSpot().x;
uint16 hot_y = (uint16)cursor->GetHotSpot().y;
uint8 *andMask = new uint8[width*height/8];
//uint8 *xorMask = new uint8[width*height/8];
memset(andMask,(uint8)255,width*height/8);
accSetCursorShape(width,height,hot_x,hot_y,andMask,cursor->Bits());
delete[] andMask;
//delete[] xorMask;
}
else
{
// erase old if visible
if(!IsCursorHidden() && under_cursor)
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
if(cursor)
delete cursor;
if(under_cursor)
delete under_cursor;
cursor=new ServerCursor(csr);
under_cursor=new ServerCursor(csr);
cursorframe.right=cursorframe.left+csr->Bounds().Width();
cursorframe.bottom=cursorframe.top+csr->Bounds().Height();
ExtractToBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
if(!IsCursorHidden())
BlitBitmap(cursor,cursor->Bounds(),cursorframe, B_OP_OVER);
}
Unlock();
}
/*!
\brief Sets the screen mode to specified resolution and color depth.
@@ -1019,10 +386,10 @@ void AccelerantDriver::SetCursor(ServerCursor *csr)
Subclasses must include calls to _SetDepth, _SetHeight, _SetWidth, and _SetMode
to update the state variables kept internally by the DisplayDriver class.
*/
void AccelerantDriver::SetMode(int32 mode)
void AccelerantDriver::SetMode(const int32 &mode)
{
/* TODO: Still needs some work to fine tune color hassles in picking the mode */
set_display_mode SetDisplayMode = (set_display_mode)accelerant_hook(B_SET_DISPLAY_MODE, NULL);
/* set_display_mode SetDisplayMode = (set_display_mode)accelerant_hook(B_SET_DISPLAY_MODE, NULL);
int proposed_width, proposed_height, proposed_depth;
int i;
@@ -1054,6 +421,7 @@ void AccelerantDriver::SetMode(int32 mode)
}
Unlock();
*/
}
void AccelerantDriver::SetMode(const display_mode &mode)
@@ -1075,235 +443,6 @@ bool AccelerantDriver::DumpToFile(const char *path)
return false;
}
/*!
\brief Gets the width of a string in pixels
\param string Source null-terminated string
\param length Number of characters in the string
\param d Data structure containing any other data necessary for the call. Always non-NULL.
\return Width of the string in pixels
This corresponds to BView::StringWidth.
*/
float AccelerantDriver::StringWidth(const char *string, int32 length, LayerData *d)
{
if(!string || !d)
return 0.0;
Lock();
ServerFont *font=&(d->font);
FontStyle *style=font->Style();
if(!style)
{
Unlock();
return 0.0;
}
FT_Face face;
FT_GlyphSlot slot;
FT_UInt glyph_index=0, previous=0;
FT_Vector pen,delta;
int16 error=0;
int32 strlength,i;
float returnval;
error=FT_New_Face(ftlib, style->GetPath(), 0, &face);
if(error)
{
Unlock();
return 0.0;
}
slot=face->glyph;
bool use_kerning=FT_HAS_KERNING(face) && font->Spacing()==B_STRING_SPACING;
error=FT_Set_Char_Size(face, 0,int32(font->Size())*64,72,72);
if(error)
{
Unlock();
return 0.0;
}
// set the pen position in 26.6 cartesian space coordinates
pen.x=0;
slot=face->glyph;
strlength=strlen(string);
if(length<strlength)
strlength=length;
for(i=0;i<strlength;i++)
{
// get kerning and move pen
if(use_kerning && previous && glyph_index)
{
FT_Get_Kerning(face, previous, glyph_index,ft_kerning_default, &delta);
pen.x+=delta.x;
}
error=FT_Load_Char(face,string[i],FT_LOAD_MONOCHROME);
// increment pen position
pen.x+=slot->advance.x;
previous=glyph_index;
}
FT_Done_Face(face);
returnval=pen.x>>6;
Unlock();
return returnval;
}
/*!
\brief Gets the height of a string in pixels
\param string Source null-terminated string
\param length Number of characters in the string
\param d Data structure containing any other data necessary for the call. Always non-NULL.
\return Height of the string in pixels
The height calculated in this function does not include any padding - just the
precise maximum height of the characters within and does not necessarily equate
with a font's height, i.e. the strings 'case' and 'alps' will have different values
even when called with all other values equal.
*/
float AccelerantDriver::StringHeight(const char *string, int32 length, LayerData *d)
{
if(!string || !d)
return 0.0;
Lock();
ServerFont *font=&(d->font);
FontStyle *style=font->Style();
if(!style)
{
Unlock();
return 0.0;
}
FT_Face face;
FT_GlyphSlot slot;
int16 error=0;
int32 strlength,i;
float returnval=0.0,ascent=0.0,descent=0.0;
error=FT_New_Face(ftlib, style->GetPath(), 0, &face);
if(error)
{
Unlock();
return 0.0;
}
slot=face->glyph;
error=FT_Set_Char_Size(face, 0,int32(font->Size())*64,72,72);
if(error)
{
Unlock();
return 0.0;
}
slot=face->glyph;
strlength=strlen(string);
if(length<strlength)
strlength=length;
for(i=0;i<strlength;i++)
{
FT_Load_Char(face,string[i],FT_LOAD_RENDER);
if(slot->metrics.horiBearingY<slot->metrics.height)
descent=MAX((slot->metrics.height-slot->metrics.horiBearingY)>>6,descent);
else
ascent=MAX(slot->bitmap.rows,ascent);
}
Unlock();
FT_Done_Face(face);
returnval=ascent+descent;
Unlock();
return returnval;
}
/*!
\brief Retrieves the bounding box each character in the string
\param string Source null-terminated string
\param count Number of characters in the string
\param mode Metrics mode for either screen or printing
\param delta Optional glyph padding. This value may be NULL.
\param rectarray Array of BRect objects which will have at least count elements
\param d Data structure containing any other data necessary for the call. Always non-NULL.
See BFont::GetBoundingBoxes for more details on this function.
*/
void AccelerantDriver::GetBoundingBoxes(const char *string, int32 count,
font_metric_mode mode, escapement_delta *delta, BRect *rectarray, LayerData *d)
{
}
/*!
\brief Retrieves the escapements for each character in the string
\param string Source null-terminated string
\param charcount Number of characters in the string
\param delta Optional glyph padding. This value may be NULL.
\param escapements Array of escapement_delta objects which will have at least charcount elements
\param offsets Actual offset values when iterating over the string. This array will also
have at least charcount elements and the values placed therein will reflect
the current kerning/spacing mode.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
See BFont::GetEscapements for more details on this function.
*/
void AccelerantDriver::GetEscapements(const char *string, int32 charcount,
escapement_delta *delta, escapement_delta *escapements, escapement_delta *offsets, LayerData *d)
{
}
/*!
\brief Retrieves the inset values of each glyph from its escapement values
\param string Source null-terminated string
\param charcount Number of characters in the string
\param edgearray Array of edge_info objects which will have at least charcount elements
\param d Data structure containing any other data necessary for the call. Always non-NULL.
See BFont::GetEdges for more details on this function.
*/
void AccelerantDriver::GetEdges(const char *string, int32 charcount, edge_info *edgearray, LayerData *d)
{
}
/*!
\brief Determines whether a font contains a certain string of characters
\param string Source null-terminated string
\param charcount Number of characters in the string
\param hasarray Array of booleans which will have at least charcount elements
See BFont::GetHasGlyphs for more details on this function.
*/
void AccelerantDriver::GetHasGlyphs(const char *string, int32 charcount, bool *hasarray)
{
}
/*!
\brief Truncates an array of strings to a certain width
\param instrings Array of null-terminated strings
\param stringcount Number of strings passed to the function
\param mode Truncation mode
\param maxwidth Maximum width for all strings
\param outstrings String array provided by the caller into which the truncated strings are
to be placed.
See BFont::GetTruncatedStrings for more details on this function.
*/
void AccelerantDriver::GetTruncatedStrings( const char **instrings, int32 stringcount,
uint32 mode, float maxwidth, char **outstrings)
{
}
/*!
\brief Draws a pixel in the specified color
\param x The x coordinate (guaranteed to be in bounds)
+17 -62
View File
@@ -32,6 +32,8 @@
#include "DisplayDriver.h"
#include "PatternHandler.h"
#include "FontServer.h"
#include "LayerData.h"
class ServerBitmap;
class ServerCursor;
@@ -44,71 +46,24 @@ public:
bool Initialize(void);
void Shutdown(void);
// Settings functions
virtual void CopyBits(BRect src, BRect dest);
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
virtual void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *edelta=NULL);
virtual void FillArc(const BRect r, float angle, float span, RGBColor& color);
virtual void FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillBezier(BPoint *pts, RGBColor& color);
virtual void FillBezier(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillEllipse(BRect r, RGBColor& color);
virtual void FillEllipse(BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillRect(const BRect r, RGBColor& color);
virtual void FillRect(const BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color);
virtual void FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
// virtual void FillShape(SShape *sh, LayerData *d, const Pattern &pat);
virtual void FillTriangle(BPoint *pts, RGBColor& color);
virtual void FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color);
virtual void StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeBezier(BPoint *pts, float pensize, RGBColor& color);
virtual void StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeEllipse(BRect r, float pensize, RGBColor& color);
virtual void StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color);
virtual void StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokePoint(BPoint& pt, RGBColor& color);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor& color, bool is_closed=true);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color, bool is_closed=true);
virtual void StrokeRect(BRect r, float pensize, RGBColor& color);
virtual void StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
// virtual void StrokeShape(SShape *sh, LayerData *d, const Pattern &pat);
virtual void StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors);
virtual void HideCursor(void);
virtual void MoveCursorTo(float x, float y);
virtual void InvertRect(BRect r);
virtual void ShowCursor(void);
virtual void ObscureCursor(void);
virtual void SetCursor(ServerCursor *csr);
virtual void SetMode(int32 mode);
virtual void InvertRect(const BRect &r);
virtual void SetMode(const int32 &mode);
virtual void SetMode(const display_mode &mode);
virtual bool DumpToFile(const char *path);
float StringWidth(const char *string, int32 length, LayerData *d);
float StringHeight(const char *string, int32 length, LayerData *d);
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors);
/*
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode(void) const;
virtual uint32 DPMSCapabilities(void) const;
virtual status_t GetDeviceInfo(accelerant_device_info *info);
virtual status_t GetModeList(display_mode **mode_list, uint32 *count);
virtual status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
virtual status_t GetTimingConstraints(display_timing_constraints *dtc);
virtual status_t ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high);
virtual status_t WaitForRetrace(bigtime_t timeout=B_INFINITE_TIMEOUT);
*/
virtual void GetBoundingBoxes(const char *string, int32 count,
font_metric_mode mode, escapement_delta *delta,
BRect *rectarray, LayerData *d);
virtual void GetEscapements(const char *string, int32 charcount,
escapement_delta *delta, escapement_delta *escapements,
escapement_delta *offsets, LayerData *d);
virtual void GetEdges(const char *string, int32 charcount,
edge_info *edgearray, LayerData *dw);
virtual void GetHasGlyphs(const char *string, int32 charcount, bool *hasarray);
virtual void GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode, float maxwidth, char **outstrings);
protected:
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY);
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
+8 -2
View File
@@ -25,6 +25,7 @@
//
//------------------------------------------------------------------------------
#include <AppDefs.h>
#include <Accelerant.h>
#include <PortMessage.h>
#include <Entry.h>
#include <Path.h>
@@ -664,13 +665,18 @@ void AppServer::DispatchMessage(PortMessage *msg)
// 2) int32 height
// 3) int depth
display_mode dmode;
fDriver->GetMode(&dmode);
port_id replyport;
msg->Read<port_id>(&replyport);
PortLink replylink(replyport);
replylink.SetOpCode(AS_GET_SCREEN_MODE);
replylink.Attach<int16>(fDriver->GetWidth());
replylink.Attach<int16>(fDriver->GetHeight());
replylink.Attach<int16>(dmode.virtual_width);
replylink.Attach<int16>(dmode.virtual_height);
// Eventually, GetDepth() will get replaced
replylink.Attach<int16>(fDriver->GetDepth());
replylink.Flush();
break;
+16 -715
View File
@@ -54,11 +54,6 @@ extern RGBColor workspace_default_color; // defined in AppServer.cpp
*/
BitmapDriver::BitmapDriver(void) : DisplayDriver()
{
_SetMode(B_8_BIT_640x480);
_SetWidth(640);
_SetHeight(480);
_SetDepth(8);
_SetBytesPerRow(640);
_target=NULL;
}
@@ -102,399 +97,18 @@ void BitmapDriver::SetTarget(ServerBitmap *target)
if(target)
{
_SetWidth(target->Width());
_SetHeight(target->Height());
_SetDepth(target->BitsPerPixel());
_SetBytesPerRow(target->BytesPerRow());
_buffer_depth=target->Width();
_buffer_height=target->Height();
_buffer_depth=target->BitsPerPixel();
_bytes_per_row=target->BytesPerRow();
// Setting mode not necessary. Can get color space stuff via ServerBitmap->ColorSpace
}
Unlock();
}
/*!
\brief Called for all BView::CopyBits calls
\param src Source rectangle.
\param dest Destination rectangle.
Bounds checking must be done in this call. If the destination is not the same size
as the source, the source should be scaled to fit.
*/
void BitmapDriver::CopyBits(BRect src, BRect dest)
{
printf("BitmapDriver::CopyBits unimplemented\n");
}
/*!
\brief Called for all BView::DrawBitmap calls
\param bmp Bitmap to be drawn. It will always be non-NULL and valid. The color
space is not guaranteed to match.
\param src Source rectangle
\param dest Destination rectangle. Source will be scaled to fit if not the same size.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
Bounds checking must be done in this call.
*/
void BitmapDriver::DrawBitmap(ServerBitmap *bitmap, BRect source, BRect dest, LayerData *d)
{
Lock();
//TODO: Implement
Unlock();
}
void BitmapDriver::FillArc(const BRect r, float angle, float span, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillArc(r,angle,span,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillArc(r,angle,span,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillBezier(BPoint *pts, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillBezier(pts,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillBezier(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillBezier(pts,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillEllipse(BRect r, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillEllipse(r,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillEllipse(BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillEllipse(r,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillPolygon(ptlist,numpts,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillPolygon(ptlist,numpts,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
/*!
\brief Called for all BView::FillRect calls
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
\param color The color used when filling the rectangle
*/
void BitmapDriver::FillRect(const BRect r, RGBColor& color)
{
Lock();
fDrawColor = color;
FillSolidRect((int32)r.left,(int32)r.top,(int32)r.right,(int32)r.bottom);
Unlock();
}
/*!
\brief Called for all BView::FillRect calls
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
\param pattern The pattern to be used when filling the rectangle
\param high_color The high color of the pattern to fill
\param low_color The low color of the pattern to fill
*/
void BitmapDriver::FillRect(const BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
FillPatternRect((int32)r.left,(int32)r.top,(int32)r.right,(int32)r.bottom);
Unlock();
}
void BitmapDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
fDrawColor = color;
DisplayDriver::FillRoundRect(r,xrad,yrad,this,(SetRectangleFuncType)&BitmapDriver::FillSolidRect,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillRoundRect(r,xrad,yrad,this,(SetRectangleFuncType)&BitmapDriver::FillPatternRect,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillTriangle(BPoint *pts, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::FillTriangle(pts,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::FillTriangle(pts,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick);
Unlock();
}
void BitmapDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeArc(r,angle,span,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeArc(r,angle,span,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeBezier(pts,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeBezier(pts,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeEllipse(BRect r, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeEllipse(r,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeEllipse(r,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeLine(start,end,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeLine(start,end,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokePoint(BPoint& pt, RGBColor& color)
{
Lock();
fLineThickness = 1;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
SetThickPatternPixel((int)pt.x,(int)pt.y);
Unlock();
}
void BitmapDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor& color, bool is_closed)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokePolygon(ptlist,numpts,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel,is_closed);
Unlock();
}
void BitmapDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color, bool is_closed)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokePolygon(ptlist,numpts,this,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeRect(BRect r, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeRect(r,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick,(SetVerticalLineFuncType)&BitmapDriver::VLinePatternThick);
Unlock();
}
void BitmapDriver::StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeRect(r,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick,(SetVerticalLineFuncType)&BitmapDriver::VLinePatternThick);
Unlock();
}
void BitmapDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
fDrawPattern.SetColors(color,color);
DisplayDriver::StrokeRoundRect(r,xrad,yrad,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick,(SetVerticalLineFuncType)&BitmapDriver::VLinePatternThick,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
void BitmapDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color)
{
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget(pattern);
fDrawPattern.SetColors(high_color,low_color);
DisplayDriver::StrokeRoundRect(r,xrad,yrad,this,(SetHorizontalLineFuncType)&BitmapDriver::HLinePatternThick,(SetVerticalLineFuncType)&BitmapDriver::VLinePatternThick,(SetPixelFuncType)&BitmapDriver::SetThickPatternPixel);
Unlock();
}
/*!
\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
*/
void BitmapDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors)
{
int x1, y1, x2, y2, dx, dy;
int steps, k;
double xInc, yInc;
double x,y;
int i;
Lock();
fLineThickness = (int)pensize;
fDrawPattern.SetTarget((int8*)&B_SOLID_HIGH);
for (i=0; i<numlines; 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);
dx = x2-x1;
dy = y2-y1;
x = x1;
y = y1;
if ( abs(dx) > abs(dy) )
steps = abs(dx);
else
steps = abs(dy);
xInc = dx / (double) steps;
yInc = dy / (double) steps;
SetThickPatternPixel(ROUND(x),ROUND(y));
for (k=0; k<steps; k++)
{
x += xInc;
y += yInc;
SetThickPatternPixel(ROUND(x),ROUND(y));
}
}
Unlock();
}
//! Empty
void BitmapDriver::SetMode(int32 space)
void BitmapDriver::SetMode(const int32 &space)
{
// No need to reset a bitmap's color space
}
@@ -505,37 +119,6 @@ void BitmapDriver::SetMode(const display_mode &mode)
// No need to reset a bitmap's color space
}
//! Empty
void BitmapDriver::HideCursor(void)
{
// Nothing is done with cursor for this, so even the inherited versions need not be called.
}
//! Empty
void BitmapDriver::MoveCursorTo(float x, float y)
{
// Nothing is done with cursor for this, so even the inherited versions need not be called.
}
//! Empty
void BitmapDriver::ShowCursor(void)
{
// Nothing is done with cursor for this, so even the inherited versions need not be called.
}
//! Empty
void BitmapDriver::ObscureCursor(void)
{
// Nothing is done with cursor for this, so even the inherited versions need not be called.
}
//! Empty
void BitmapDriver::SetCursor(ServerCursor *csr)
{
// Nothing is done with cursor for this, so even the inherited versions need not be called.
}
// This function is intended to eventually take care of most of the heavy lifting for
// DrawBitmap in 32-bit mode, with others coming later. Right now, it is *just* used for
// the
@@ -742,7 +325,7 @@ void BitmapDriver::ExtractToBitmap(ServerBitmap *destbmp,BRect destrect, BRect s
}
}
void BitmapDriver::InvertRect(BRect r)
void BitmapDriver::InvertRect(const BRect &r)
{
Lock();
if(_target)
@@ -792,297 +375,7 @@ void BitmapDriver::InvertRect(BRect r)
Unlock();
}
float BitmapDriver::StringWidth(const char *string, int32 length, LayerData *d)
{
if(!string || !d )
return 0.0;
Lock();
ServerFont *font=&(d->font);
FontStyle *style=font->Style();
if(!style)
{
Unlock();
return 0.0;
}
FT_Face face;
FT_GlyphSlot slot;
FT_UInt glyph_index=0, previous=0;
FT_Vector pen,delta;
int16 error=0;
int32 strlength,i;
float returnval;
error=FT_New_Face(ftlib, style->GetPath(), 0, &face);
if(error)
{
Unlock();
return 0.0;
}
slot=face->glyph;
bool use_kerning=FT_HAS_KERNING(face) && font->Spacing()==B_STRING_SPACING;
error=FT_Set_Char_Size(face, 0,int32(font->Size())*64,72,72);
if(error)
{
Unlock();
return 0.0;
}
// set the pen position in 26.6 cartesian space coordinates
pen.x=0;
slot=face->glyph;
strlength=strlen(string);
if(length<strlength)
strlength=length;
for(i=0;i<strlength;i++)
{
// get kerning and move pen
if(use_kerning && previous && glyph_index)
{
FT_Get_Kerning(face, previous, glyph_index,ft_kerning_default, &delta);
pen.x+=delta.x;
}
error=FT_Load_Char(face,string[i],FT_LOAD_MONOCHROME);
// increment pen position
pen.x+=slot->advance.x;
previous=glyph_index;
}
FT_Done_Face(face);
returnval=pen.x>>6;
Unlock();
return returnval;
}
float BitmapDriver::StringHeight(const char *string, int32 length, LayerData *d)
{
if(!string || !d)
return 0.0;
Lock();
ServerFont *font=&(d->font);
FontStyle *style=font->Style();
if(!style)
{
Unlock();
return 0.0;
}
FT_Face face;
FT_GlyphSlot slot;
int16 error=0;
int32 strlength,i;
float returnval=0.0,ascent=0.0,descent=0.0;
error=FT_New_Face(ftlib, style->GetPath(), 0, &face);
if(error)
{
Unlock();
return 0.0;
}
slot=face->glyph;
error=FT_Set_Char_Size(face, 0,int32(font->Size())*64,72,72);
if(error)
{
Unlock();
return 0.0;
}
slot=face->glyph;
strlength=strlen(string);
if(length<strlength)
strlength=length;
for(i=0;i<strlength;i++)
{
FT_Load_Char(face,string[i],FT_LOAD_RENDER);
if(slot->metrics.horiBearingY<slot->metrics.height)
descent=MAX((slot->metrics.height-slot->metrics.horiBearingY)>>6,descent);
else
ascent=MAX(slot->bitmap.rows,ascent);
}
Unlock();
FT_Done_Face(face);
returnval=ascent+descent;
Unlock();
return returnval;
}
/*!
\brief Utilizes the font engine to draw a string to the frame buffer
\param string String to be drawn. Always non-NULL.
\param length Number of characters in the string to draw. Always greater than 0. If greater
than the number of characters in the string, draw the entire string.
\param pt Point at which the baseline starts. Characters are to be drawn 1 pixel above
this for backwards compatibility. While the point itself is guaranteed to be inside
the frame buffers coordinate range, the clipping of each individual glyph must be
performed by the driver itself.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
*/
void BitmapDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *edelta)
{
if(!string || !d)
return;
Lock();
pt.y--; // because of Be's backward compatibility hack
ServerFont *font=&(d->font);
FontStyle *style=font->Style();
if(!style)
{
Unlock();
return;
}
FT_Face face;
FT_GlyphSlot slot;
FT_Matrix rmatrix,smatrix;
FT_UInt glyph_index=0, previous=0;
FT_Vector pen,delta,space,nonspace;
int16 error=0;
int32 strlength,i;
Angle rotation(font->Rotation()), shear(font->Shear());
bool antialias=( (font->Size()<18 && font->Flags()& B_DISABLE_ANTIALIASING==0)
|| font->Flags()& B_FORCE_ANTIALIASING)?true:false;
// Originally, I thought to do this shear checking here, but it really should be
// done in BFont::SetShear()
float shearangle=shear.Value();
if(shearangle>135)
shearangle=135;
if(shearangle<45)
shearangle=45;
if(shearangle>90)
shear=90+((180-shearangle)*2);
else
shear=90-(90-shearangle)*2;
error=FT_New_Face(ftlib, style->GetPath(), 0, &face);
if(error)
{
printf("Couldn't create face object\n");
Unlock();
return;
}
slot=face->glyph;
bool use_kerning=FT_HAS_KERNING(face) && font->Spacing()==B_STRING_SPACING;
error=FT_Set_Char_Size(face, 0,int32(font->Size())*64,72,72);
if(error)
{
Unlock();
return;
}
// if we do any transformation, we do a call to FT_Set_Transform() here
// First, rotate
rmatrix.xx = (FT_Fixed)( rotation.Cosine()*0x10000);
rmatrix.xy = (FT_Fixed)( rotation.Sine()*0x10000);
rmatrix.yx = (FT_Fixed)(-rotation.Sine()*0x10000);
rmatrix.yy = (FT_Fixed)( rotation.Cosine()*0x10000);
// Next, shear
smatrix.xx = (FT_Fixed)(0x10000);
smatrix.xy = (FT_Fixed)(-shear.Cosine()*0x10000);
smatrix.yx = (FT_Fixed)(0);
smatrix.yy = (FT_Fixed)(0x10000);
//FT_Matrix_Multiply(&rmatrix,&smatrix);
FT_Matrix_Multiply(&smatrix,&rmatrix);
// Set up the increment value for escapement padding
space.x=int32(d->edelta.space * rotation.Cosine()*64);
space.y=int32(d->edelta.space * rotation.Sine()*64);
nonspace.x=int32(d->edelta.nonspace * rotation.Cosine()*64);
nonspace.y=int32(d->edelta.nonspace * rotation.Sine()*64);
// set the pen position in 26.6 cartesian space coordinates
pen.x=(int32)pt.x * 64;
pen.y=(int32)pt.y * 64;
slot=face->glyph;
strlength=strlen(string);
if(length<strlength)
strlength=length;
for(i=0;i<strlength;i++)
{
//FT_Set_Transform(face,&smatrix,&pen);
FT_Set_Transform(face,&rmatrix,&pen);
// Handle escapement padding option
if((uint8)string[i]<=0x20)
{
pen.x+=space.x;
pen.y+=space.y;
}
else
{
pen.x+=nonspace.x;
pen.y+=nonspace.y;
}
// get kerning and move pen
if(use_kerning && previous && glyph_index)
{
FT_Get_Kerning(face, previous, glyph_index,ft_kerning_default, &delta);
pen.x+=delta.x;
pen.y+=delta.y;
}
error=FT_Load_Char(face,string[i],
((antialias)?FT_LOAD_RENDER:FT_LOAD_RENDER | FT_LOAD_MONOCHROME) );
if(!error)
{
if(antialias)
BlitGray2RGB32(&slot->bitmap,
BPoint(slot->bitmap_left,pt.y-(slot->bitmap_top-pt.y)), d);
else
BlitMono2RGB32(&slot->bitmap,
BPoint(slot->bitmap_left,pt.y-(slot->bitmap_top-pt.y)), d);
}
else
printf("Couldn't load character %c\n", string[i]);
// increment pen position
pen.x+=slot->advance.x;
pen.y+=slot->advance.y;
previous=glyph_index;
}
FT_Done_Face(face);
Unlock();
}
/*
void BitmapDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
{
rgb_color color=d->highcolor.GetColor32();
@@ -1281,8 +574,9 @@ void BitmapDriver::BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
destindex+=destinc;
}
}
*/
rgb_color BitmapDriver::GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high)
rgb_color BitmapDriver::GetBlitColor(rgb_color src, rgb_color dest, DrawData *d, bool use_high)
{
rgb_color returncolor={0,0,0,0};
int16 value;
@@ -1596,6 +890,7 @@ void BitmapDriver::VLinePatternThick(int32 x, int32 y1, int32 y2)
}
}
/*
void BitmapDriver::FillSolidRect(int32 left, int32 top, int32 right, int32 bottom)
{
int bytes_per_row = _target->BytesPerRow();
@@ -1714,3 +1009,9 @@ void BitmapDriver::FillPatternRect(int32 left, int32 top, int32 right, int32 bot
printf("Error: Unknown color space\n");
}
}
*/
void BitmapDriver::DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, DrawData *d)
{
}
+6 -58
View File
@@ -38,9 +38,6 @@
#include <Bitmap.h>
#include <OS.h>
#include "DisplayDriver.h"
//#include <ft2build.h>
//#include FT_FREETYPE_H
//#include FT_GLYPH_H
#include "FontServer.h"
class ServerCursor;
@@ -74,68 +71,19 @@ public:
ServerBitmap *GetTarget(void) const { return _target; }
// Settings functions
virtual void CopyBits(BRect src, BRect dest);
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
// virtual void DrawPicture(SPicture *pic, BPoint pt);
virtual void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
virtual void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, DrawData *d);
virtual void FillArc(const BRect r, float angle, float span, RGBColor& color);
virtual void FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillBezier(BPoint *pts, RGBColor& color);
virtual void FillBezier(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillEllipse(BRect r, RGBColor& color);
virtual void FillEllipse(BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillRect(const BRect r, RGBColor& color);
virtual void FillRect(const BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color);
virtual void FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
// virtual void FillShape(SShape *sh, LayerData *d, const Pattern &pat);
virtual void FillTriangle(BPoint *pts, RGBColor& color);
virtual void FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color);
virtual void StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeBezier(BPoint *pts, float pensize, RGBColor& color);
virtual void StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeEllipse(BRect r, float pensize, RGBColor& color);
virtual void StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color);
virtual void StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokePoint(BPoint& pt, RGBColor& color);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor& color, bool is_closed=true);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color, bool is_closed=true);
virtual void StrokeRect(BRect r, float pensize, RGBColor& color);
virtual void StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
// virtual void StrokeShape(SShape *sh, LayerData *d, const Pattern &pat);
virtual void StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors);
virtual void HideCursor(void);
virtual void MoveCursorTo(float x, float y);
virtual void InvertRect(BRect r);
virtual void ShowCursor(void);
virtual void ObscureCursor(void);
virtual void SetCursor(ServerCursor *cursor);
virtual void SetMode(int32 mode);
virtual void SetMode(const int32 &mode);
virtual void SetMode(const display_mode &mode);
float StringWidth(const char *string, int32 length, LayerData *d);
float StringHeight(const char *string, int32 length, LayerData *d);
// virtual bool DumpToFile(const char *path);
virtual void InvertRect(const BRect &rect);
protected:
void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
void BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY);
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
rgb_color GetBlitColor(rgb_color src, rgb_color dest, LayerData *d, bool use_high=true);
rgb_color GetBlitColor(rgb_color src, rgb_color dest, DrawData *d, bool use_high=true);
void HLinePatternThick(int32 x1, int32 x2, int32 y);
void VLinePatternThick(int32 x, int32 y1, int32 y2);
void FillSolidRect(int32 left, int32 top, int32 right, int32 bottom);
void FillPatternRect(int32 left, int32 top, int32 right, int32 bottom);
// void FillSolidRect(int32 left, int32 top, int32 right, int32 bottom);
// void FillPatternRect(int32 left, int32 top, int32 right, int32 bottom);
void SetThickPatternPixel(int x, int y);
ServerBitmap *_target;
};
+43 -44
View File
@@ -423,18 +423,16 @@ void DefaultDecorator::_DrawTab(BRect r)
if(_look == B_NO_BORDER_WINDOW_LOOK || _look == B_BORDERED_WINDOW_LOOK)
return;
_layerdata.highcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
_driver->FillRect(_tabrect,_layerdata.highcolor);
_driver->FillRect(_tabrect,(GetFocus())?_colors->window_tab:_colors->inactive_window_tab);
_layerdata.highcolor=framecolors[2];
_driver->StrokeLine(_tabrect.LeftTop(),_tabrect.LeftBottom(),_layerdata.pensize,_layerdata.highcolor);
_driver->StrokeLine(_tabrect.LeftTop(),_tabrect.RightTop(),_layerdata.pensize,_layerdata.highcolor);
_layerdata.highcolor=framecolors[4];
_driver->StrokeLine(_tabrect.RightTop(),_tabrect.RightBottom(),_layerdata.pensize,_layerdata.highcolor);
_layerdata.highcolor=framecolors[1];
_driver->StrokeLine(_tabrect.LeftTop(),_tabrect.LeftBottom(),framecolors[2]);
_driver->StrokeLine(_tabrect.LeftTop(),_tabrect.RightTop(),framecolors[2]);
_driver->StrokeLine(_tabrect.RightTop(),_tabrect.RightBottom(),framecolors[4]);
_driver->StrokeLine( BPoint( _tabrect.left + 2, _tabrect.bottom ),
BPoint( _tabrect.right - 2, _tabrect.bottom ),
_layerdata.pensize,_layerdata.highcolor);
framecolors[1]);
_DrawTitle(_tabrect);
@@ -456,34 +454,32 @@ void DefaultDecorator::DrawBlendedRect(BRect r, bool down)
// Note that it is not part of the Decorator API - it's specific
// to just the DefaultDecorator. Called by DrawZoom and DrawClose
// TODO: Fix this function so that the close button on inactive window tabs
// is drawn correctly. Currently, a yellow "halo" appears around them.
_layerdata.highcolor = RGBColor( 175, 123, 0 );
RGBColor temprgbcol(175,123,0);
_driver->StrokeLine( r.LeftTop(),
BPoint( r.left, r.bottom - 1 ),
_layerdata.pensize,_layerdata.highcolor);
temprgbcol);
_driver->StrokeLine( r.LeftTop(),
BPoint( r.right - 1, r.top ),
_layerdata.pensize,_layerdata.highcolor);
temprgbcol);
_driver->StrokeLine( BPoint( r.right - 1, r.top + 2),
BPoint( r.right - 1, r.bottom - 1),
_layerdata.pensize,_layerdata.highcolor);
temprgbcol);
_driver->StrokeLine( BPoint( r.left + 2, r.bottom -1),
BPoint( r.right - 2, r.bottom - 1),
_layerdata.pensize,_layerdata.highcolor);
temprgbcol);
_layerdata.highcolor = RGBColor( 255, 255, 0 );
temprgbcol.SetColor(255,255,0);
_driver->StrokeRect( BRect( r.left + 1, r.top + 1,
r.right, r.bottom),
_layerdata.pensize,_layerdata.highcolor);
temprgbcol);
r.InsetBy( 2, 2 );
int32 w=r.IntegerWidth(), h=r.IntegerHeight();
rgb_color tmpcol,halfcol, startcol, endcol;
rgb_color halfcol, startcol, endcol;
// rgb_color tmpcol;
float rstep,gstep,bstep,i;
int steps=(w<h)?w:h;
@@ -507,20 +503,29 @@ void DefaultDecorator::DrawBlendedRect(BRect r, bool down)
for(i=0;i<=steps; i++)
{
SetRGBColor(&tmpcol, uint8(startcol.red-(i*rstep)),
/* SetRGBColor(&tmpcol, uint8(startcol.red-(i*rstep)),
uint8(startcol.green-(i*gstep)),
uint8(startcol.blue-(i*bstep)));
_layerdata.highcolor=tmpcol;
*/
temprgbcol.SetColor(uint8(startcol.red-(i*rstep)),
uint8(startcol.green-(i*gstep)),
uint8(startcol.blue-(i*bstep)));
_driver->StrokeLine(BPoint(r.left,r.top+i),
BPoint(r.left+i,r.top),_layerdata.pensize,_layerdata.highcolor);
BPoint(r.left+i,r.top),temprgbcol);
SetRGBColor(&tmpcol, uint8(halfcol.red-(i*rstep)),
/* SetRGBColor(&tmpcol, uint8(halfcol.red-(i*rstep)),
uint8(halfcol.green-(i*gstep)),
uint8(halfcol.blue-(i*bstep)));
_layerdata.highcolor=tmpcol;
*/
temprgbcol.SetColor(uint8(halfcol.red-(i*rstep)),
uint8(halfcol.green-(i*gstep)),
uint8(halfcol.blue-(i*bstep)));
_layerdata.highcolor=tmpcol;
_driver->StrokeLine(BPoint(r.left+steps,r.top+i),
BPoint(r.left+i,r.top+steps),_layerdata.pensize,_layerdata.highcolor);
BPoint(r.left+i,r.top+steps),temprgbcol);
}
}
@@ -546,7 +551,7 @@ STRACE(("_DrawFrame(%f,%f,%f,%f)\n", invalid.left, invalid.top,
int32 numlines=0, maxlines=20;
BPoint points[maxlines*2];
RGBColor colors[maxlines];
RGBColor colors[maxlines],temprgbcol;
// For quick calculation of gradients for each side. Top is same as left, right is same as
// bottom
@@ -805,7 +810,7 @@ STRACE(("_DrawFrame(%f,%f,%f,%f)\n", invalid.left, invalid.top,
//do(draw) nothing!
}
else{
_driver->StrokeLineArray(points,numlines,_layerdata.pensize,colors);
_driver->StrokeLineArray(points,numlines,&_layerdata,colors);
}
delete rightindices;
@@ -822,19 +827,16 @@ STRACE(("_DrawFrame(%f,%f,%f,%f)\n", invalid.left, invalid.top,
case B_DOCUMENT_WINDOW_LOOK:{
r.right-=4;
r.bottom-=4;
_layerdata.highcolor=framecolors[2];
_driver->StrokeLine(r.LeftTop(),r.RightTop(),_layerdata.pensize,_layerdata.highcolor);
_driver->StrokeLine(r.LeftTop(),r.LeftBottom(),_layerdata.pensize,_layerdata.highcolor);
_driver->StrokeLine(r.LeftTop(),r.RightTop(),framecolors[2]);
_driver->StrokeLine(r.LeftTop(),r.LeftBottom(),framecolors[2]);
r.OffsetBy(1,1);
_layerdata.highcolor=framecolors[0];
_driver->StrokeLine(r.LeftTop(),r.RightTop(),_layerdata.pensize,_layerdata.highcolor);
_driver->StrokeLine(r.LeftTop(),r.LeftBottom(),_layerdata.pensize,_layerdata.highcolor);
_driver->StrokeLine(r.LeftTop(),r.RightTop(),framecolors[0]);
_driver->StrokeLine(r.LeftTop(),r.LeftBottom(),framecolors[0]);
r.OffsetBy(1,1);
_layerdata.highcolor=framecolors[1];
_driver->FillRect(r,_layerdata.highcolor);
_driver->FillRect(r,framecolors[1]);
/* r.left+=2;
r.top+=2;
@@ -865,32 +867,29 @@ STRACE(("_DrawFrame(%f,%f,%f,%f)\n", invalid.left, invalid.top,
_driver->Lock();
for(i=0;i<=steps; i++)
{
_layerdata.highcolor.SetColor(uint8(startcol.red-(i*rstep)),
temprgbcol.SetColor(uint8(startcol.red-(i*rstep)),
uint8(startcol.green-(i*gstep)),
uint8(startcol.blue-(i*bstep)));
_driver->StrokeLine(BPoint(r.left,r.top+i),
BPoint(r.left+i,r.top),_layerdata.pensize,_layerdata.highcolor);
BPoint(r.left+i,r.top),temprgbcol);
_layerdata.highcolor.SetColor(uint8(halfcol.red-(i*rstep)),
temprgbcol.SetColor(uint8(halfcol.red-(i*rstep)),
uint8(halfcol.green-(i*gstep)),
uint8(halfcol.blue-(i*bstep)));
_driver->StrokeLine(BPoint(r.left+steps,r.top+i),
BPoint(r.left+i,r.top+steps),_layerdata.pensize,_layerdata.highcolor);
BPoint(r.left+i,r.top+steps),temprgbcol);
}
_driver->Unlock();
// _layerdata.highcolor=framecolors[4];
// _driver->StrokeRect(r,_layerdata.pensize,_layerdata.highcolor);
break;
}
case B_TITLED_WINDOW_LOOK:
case B_FLOATING_WINDOW_LOOK:{
_layerdata.highcolor=framecolors[2];
_driver->StrokeLine(BPoint(r.right-4,r.top),BPoint(r.right-2,r.top),
_layerdata.pensize,_layerdata.highcolor);
framecolors[2]);
_driver->StrokeLine(BPoint(r.left,r.bottom-4),BPoint(r.left,r.bottom-2),
_layerdata.pensize,_layerdata.highcolor);
framecolors[2]);
break;
}
+171 -183
View File
@@ -29,7 +29,6 @@
#include <Accelerant.h>
#include <stdio.h>
#include "DisplayDriver.h"
#include "LayerData.h"
#include "ServerCursor.h"
// TODO: Major cleanup is left. Public functions should be repsonsible for locking.
@@ -293,7 +292,7 @@ void DisplayDriver::Shutdown(void)
If the destination is not the same size as the source, the source should be scaled to fit.
*/
void DisplayDriver::CopyBits(BRect src, BRect dest)
void DisplayDriver::CopyBits(const BRect &src, const BRect &dest)
{
}
@@ -314,7 +313,7 @@ void DisplayDriver::CopyRegion(BRegion *src, const BPoint &lefttop)
\param dest Destination rectangle. Source will be scaled to fit if not the same size.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
*/
void DisplayDriver::DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d)
void DisplayDriver::DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d)
{
}
@@ -329,15 +328,16 @@ void DisplayDriver::DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerDa
performed by the driver itself.
\param d Data structure containing any other data necessary for the call. Always non-NULL.
*/
void DisplayDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta)
void DisplayDriver::DrawString(const char *string, const int32 &length, const BPoint &pt, const DrawData *d)
{
}
void DisplayDriver::FillArc(const BRect r, float angle, float span, RGBColor &color)
void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, RGBColor &color)
{
}
void DisplayDriver::FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span,
const DrawData *d, const Pattern& pattern)
{
}
@@ -349,7 +349,8 @@ void DisplayDriver::FillArc(const BRect r, float angle, float span, const Patter
\param setLIne The horizontal line drawing function which handles needed things like pattern,
color, and line thickness
*/
void DisplayDriver::FillArc(const BRect r, float angle, float span, DisplayDriver* driver, SetHorizontalLineFuncType setLine)
void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span,
DisplayDriver* driver, SetHorizontalLineFuncType setLine)
{
float xc = (r.left+r.right)/2;
float yc = (r.top+r.bottom)/2;
@@ -720,7 +721,7 @@ void DisplayDriver::FillBezier(BPoint *pts, RGBColor &color)
{
}
void DisplayDriver::FillBezier(BPoint *pts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillBezier(BPoint *pts, const DrawData *d, const Pattern &pattern)
{
}
@@ -804,11 +805,11 @@ void DisplayDriver::FillBezier(BPoint *pts, DisplayDriver* driver, SetHorizontal
*/
}
void DisplayDriver::FillEllipse(BRect r, RGBColor &color)
void DisplayDriver::FillEllipse(const BRect &r, RGBColor &color)
{
}
void DisplayDriver::FillEllipse(BRect r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillEllipse(const BRect &r, const DrawData *d, const Pattern &pattern)
{
}
@@ -817,7 +818,7 @@ void DisplayDriver::FillEllipse(BRect r, const Pattern& pattern, RGBColor &high_
\param r BRect enclosing the ellipse to be drawn.
\param setLine Horizontal line drawing routine which handles things like color and pattern.
*/
void DisplayDriver::FillEllipse(BRect r, DisplayDriver* driver, SetHorizontalLineFuncType setLine)
void DisplayDriver::FillEllipse(const BRect &r, DisplayDriver* driver, SetHorizontalLineFuncType setLine)
{
float xc = (r.left+r.right)/2;
float yc = (r.top+r.bottom)/2;
@@ -882,7 +883,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor &color)
{
}
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const DrawData *d, const Pattern &pattern)
{
}
@@ -1019,7 +1020,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, DisplayDriver* dri
\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
*/
void DisplayDriver::FillRect(const BRect r, RGBColor &color)
void DisplayDriver::FillRect(const BRect &r, RGBColor &color)
{
}
@@ -1030,7 +1031,7 @@ void DisplayDriver::FillRect(const BRect r, RGBColor &color)
\param high_color The high color of the pattern
\param low_color The low color of the pattern
*/
void DisplayDriver::FillRect(const BRect r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillRect(const BRect &r, const DrawData *d, const Pattern &pattern)
{
}
@@ -1056,21 +1057,24 @@ void DisplayDriver::FillRegion(BRegion& r, RGBColor &color)
\param high_color The high color of the pattern
\param low_color The low color of the pattern
*/
void DisplayDriver::FillRegion(BRegion& r, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillRegion(BRegion& r, const DrawData *d, const Pattern &pattern)
{
if(!d)
return;
Lock();
for(int32 i=0; i<r.CountRects();i++)
FillRect(r.RectAt(i),pattern, high_color, low_color);
FillRect(r.RectAt(i),d, pattern);
Unlock();
}
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor &color)
void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float &yrad, RGBColor &color)
{
}
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float &yrad, const DrawData *d, const Pattern &pattern)
{
}
@@ -1082,7 +1086,7 @@ void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern
\param setRect Rectangle filling routine which handles things like color and pattern
\param setLine Horizontal line drawing function which handles things like color and pattern
*/
void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, DisplayDriver* driver, SetRectangleFuncType setRect, SetHorizontalLineFuncType setLine)
void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float &yrad, DisplayDriver* driver, SetRectangleFuncType setRect, SetHorizontalLineFuncType setLine)
{
float arc_x;
float yrad2 = yrad*yrad;
@@ -1099,7 +1103,7 @@ void DisplayDriver::FillRoundRect(BRect r, float xrad, float yrad, DisplayDriver
(driver->*setRect)((int)(r.left),(int)(r.top+yrad),(int)(r.right),(int)(r.bottom-yrad));
}
//void DisplayDriver::FillShape(SShape *sh, LayerData *d, const Pattern &pat)
//void DisplayDriver::FillShape(SShape *sh, const DrawData *d, const Pattern &pat)
//{
//}
@@ -1107,7 +1111,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, RGBColor &color)
{
}
void DisplayDriver::FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::FillTriangle(BPoint *pts, const DrawData *d, const Pattern &pattern)
{
}
@@ -1217,7 +1221,26 @@ void DisplayDriver::FillTriangle(BPoint *pts, DisplayDriver* driver, SetHorizont
*/
void DisplayDriver::HideCursor(void)
{
Lock();
if(_is_cursor_hidden)
{
Unlock();
return;
}
_is_cursor_hidden=true;
if(_cursorsave)
{
CopyBitmap(_cursorsave,_cursorsave->Bounds(),cursorframe, &_drawdata);
delete _cursorsave;
_cursorsave=NULL;
}
Unlock();
}
/*!
@@ -1244,15 +1267,16 @@ bool DisplayDriver::IsCursorHidden(void)
cursor is obscured should be made and if so, a call to _SetCursorObscured(false)
should be made the cursor in addition to displaying at the passed coordinates.
*/
void DisplayDriver::MoveCursorTo(float x, float y)
void DisplayDriver::MoveCursorTo(const float &x, const float &y)
{
}
/*!
\brief Inverts the colors in the rectangle.
\param r Rectangle of the area to be inverted. Guaranteed to be within bounds.
*/
void DisplayDriver::InvertRect(BRect r)
void DisplayDriver::InvertRect(const BRect &r)
{
}
@@ -1266,8 +1290,17 @@ void DisplayDriver::InvertRect(BRect r)
*/
void DisplayDriver::ShowCursor(void)
{
Lock();
_is_cursor_hidden=false;
_is_cursor_obscured=false;
CopyToBitmap(_cursorsave,cursorframe);
saveframe=cursorframe;
CopyBitmap(_cursor,_cursor->Bounds(),cursorframe,&_drawdata);
Unlock();
}
/*!
@@ -1280,7 +1313,26 @@ void DisplayDriver::ShowCursor(void)
*/
void DisplayDriver::ObscureCursor(void)
{
Lock();
if(_is_cursor_obscured)
{
Unlock();
return;
}
_is_cursor_obscured=true;
if(_cursorsave)
{
CopyBitmap(_cursorsave,_cursorsave->Bounds(),cursorframe, &_drawdata);
delete _cursorsave;
_cursorsave=NULL;
}
Unlock();
}
/*!
@@ -1294,24 +1346,44 @@ void DisplayDriver::ObscureCursor(void)
void DisplayDriver::SetCursor(ServerCursor *cursor)
{
Lock();
bool hidden=_is_cursor_hidden;
bool obscured=_is_cursor_obscured;
bool visible=false;
if(!_is_cursor_hidden && !_is_cursor_obscured)
visible=true;
if(_cursor)
{
// We need to restore the stuff because the cursor very well may not be the same size
if(visible)
CopyBitmap(_cursorsave,_cursorsave->Bounds(),cursorframe, &_drawdata);
delete _cursor;
delete _cursorsave;
_cursorsave=NULL;
}
_cursor=new ServerCursor(cursor);
if(!hidden && !obscured)
ShowCursor();
if(visible)
_cursorsave=new ServerBitmap((ServerBitmap*)cursor);
// TODO: make this take the hotspot into account -- too tired to bother right now...
saveframe=_cursor->Bounds().OffsetToCopy(cursorframe.LeftTop());
cursorframe=saveframe;
if(visible)
{
CopyToBitmap(_cursorsave, cursorframe);
CopyBitmap(_cursor, _cursor->Bounds(), cursorframe, &_drawdata);
}
Unlock();
}
void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor &color)
void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &span, RGBColor &color)
{
}
void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &span, const DrawData *d, const Pattern &pattern)
{
}
@@ -1322,7 +1394,7 @@ void DisplayDriver::StrokeArc(BRect r, float angle, float span, float pensize, c
\param span Span of the arc in degrees. Ending angle = angle+span.
\param setPixel Pixel drawing function which handles things like size and pattern.
*/
void DisplayDriver::StrokeArc(BRect r, float angle, float span, DisplayDriver* driver, SetPixelFuncType setPixel)
void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &span, DisplayDriver* driver, SetPixelFuncType setPixel)
{
float xc = (r.left+r.right)/2;
float yc = (r.top+r.bottom)/2;
@@ -1473,11 +1545,11 @@ void DisplayDriver::StrokeArc(BRect r, float angle, float span, DisplayDriver* d
}
void DisplayDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor &color)
void DisplayDriver::StrokeBezier(BPoint *pts, RGBColor &color)
{
}
void DisplayDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeBezier(BPoint *pts, const DrawData *d, const Pattern &pattern)
{
}
@@ -1540,11 +1612,11 @@ void DisplayDriver::StrokeBezier(BPoint *pts, DisplayDriver* driver, SetPixelFun
}
}
void DisplayDriver::StrokeEllipse(BRect r, float pensize, RGBColor &color)
void DisplayDriver::StrokeEllipse(const BRect &r, RGBColor &color)
{
}
void DisplayDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeEllipse(const BRect &r, const DrawData *d, const Pattern &pattern)
{
}
@@ -1553,7 +1625,7 @@ void DisplayDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pattern
\param r BRect enclosing the ellipse to be drawn.
\param setPixel Pixel drawing function which handles things like size and pattern.
*/
void DisplayDriver::StrokeEllipse(BRect r, DisplayDriver* driver, SetPixelFuncType setPixel)
void DisplayDriver::StrokeEllipse(const BRect &r, DisplayDriver* driver, SetPixelFuncType setPixel)
{
float xc = (r.left+r.right)/2;
float yc = (r.top+r.bottom)/2;
@@ -1615,11 +1687,11 @@ void DisplayDriver::StrokeEllipse(BRect r, DisplayDriver* driver, SetPixelFuncTy
}
}
void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor &color)
void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, RGBColor &color)
{
}
void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const DrawData *d, const Pattern &pattern)
{
}
@@ -1629,7 +1701,7 @@ void DisplayDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pa
\param end Ending point
\param setPixel Pixel drawing function which handles things like size and pattern.
*/
void DisplayDriver::StrokeLine(BPoint start, BPoint end, DisplayDriver* driver, SetPixelFuncType setPixel)
void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, DisplayDriver* driver, SetPixelFuncType setPixel)
{
int x1 = ROUND(start.x);
int y1 = ROUND(start.y);
@@ -1662,11 +1734,11 @@ void DisplayDriver::StrokePoint(BPoint& pt, RGBColor &color)
{
}
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor &color, bool is_closed)
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, RGBColor &color, bool is_closed)
{
}
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color, bool is_closed)
void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const DrawData *d, const Pattern& pattern, bool is_closed)
{
}
@@ -1690,15 +1762,15 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, DisplayDriver* d
\param pensize Thickness of the lines
\param color The color of the rectangle
*/
void DisplayDriver::StrokeRect(BRect r, float pensize, RGBColor &color)
void DisplayDriver::StrokeRect(const BRect &r, RGBColor &color)
{
}
void DisplayDriver::StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeRect(const BRect &r, const DrawData *d, const Pattern &pattern)
{
}
void DisplayDriver::StrokeRect(BRect r, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine)
void DisplayDriver::StrokeRect(const BRect &r, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine)
{
(driver->*setHLine)((int)ROUND(r.left), (int)ROUND(r.right), (int)ROUND(r.top));
(driver->*setVLine)((int)ROUND(r.right), (int)ROUND(r.top), (int)ROUND(r.bottom));
@@ -1713,31 +1785,31 @@ void DisplayDriver::StrokeRect(BRect r, DisplayDriver* driver, SetHorizontalLine
\param pat 8-byte array containing the const Pattern &to use. Always non-NULL.
*/
void DisplayDriver::StrokeRegion(BRegion& r, float pensize, RGBColor &color)
void DisplayDriver::StrokeRegion(BRegion& r, RGBColor &color)
{
Lock();
for(int32 i=0; i<r.CountRects();i++)
StrokeRect(r.RectAt(i),pensize,color);
StrokeRect(r.RectAt(i),color);
Unlock();
}
void DisplayDriver::StrokeRegion(BRegion& r, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeRegion(BRegion& r, const DrawData *d, const Pattern &pattern)
{
Lock();
for(int32 i=0; i<r.CountRects();i++)
StrokeRect(r.RectAt(i),pensize,pattern,high_color,low_color);
StrokeRect(r.RectAt(i),d,pattern);
Unlock();
}
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor &color)
void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, RGBColor &color)
{
}
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, const DrawData *d, const Pattern &pattern)
{
}
@@ -1750,7 +1822,7 @@ void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensi
\param setVLine Vertical line drawing function
\param setPixel Pixel drawing function
*/
void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine, SetPixelFuncType setPixel)
void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const float &yrad, DisplayDriver* driver, SetHorizontalLineFuncType setHLine, SetVerticalLineFuncType setVLine, SetPixelFuncType setPixel)
{
int hLeft, hRight;
int vTop, vBottom;
@@ -1777,7 +1849,7 @@ void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, DisplayDriv
(driver->*setVLine)((int)ROUND(r.right),vBottom,vTop);
}
//void DisplayDriver::StrokeShape(SShape *sh, LayerData *d, const Pattern &pat)
//void DisplayDriver::StrokeShape(SShape *sh, const DrawData *d, const Pattern &pat)
//{
//}
@@ -1787,21 +1859,21 @@ void DisplayDriver::StrokeRoundRect(BRect r, float xrad, float yrad, DisplayDriv
\param pensize The line thickness
\param color The color of the lines
*/
void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, RGBColor &color)
void DisplayDriver::StrokeTriangle(BPoint *pts, RGBColor &color)
{
Lock();
StrokeLine(pts[0],pts[1],pensize,color);
StrokeLine(pts[1],pts[2],pensize,color);
StrokeLine(pts[2],pts[0],pensize,color);
StrokeLine(pts[0],pts[1],color);
StrokeLine(pts[1],pts[2],color);
StrokeLine(pts[2],pts[0],color);
Unlock();
}
void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, const Pattern& pattern, RGBColor &high_color, RGBColor &low_color)
void DisplayDriver::StrokeTriangle(BPoint *pts, const DrawData *d, const Pattern &pattern)
{
Lock();
StrokeLine(pts[0],pts[1],pensize,pattern,high_color,low_color);
StrokeLine(pts[1],pts[2],pensize,pattern,high_color,low_color);
StrokeLine(pts[2],pts[0],pensize,pattern,high_color,low_color);
StrokeLine(pts[0],pts[1],d,pattern);
StrokeLine(pts[1],pts[2],d,pattern);
StrokeLine(pts[2],pts[0],d,pattern);
Unlock();
}
@@ -1812,7 +1884,7 @@ void DisplayDriver::StrokeTriangle(BPoint *pts, float pensize, const Pattern& pa
\param pensize The thickness of the lines
\param colors Array of colors for each respective line
*/
void DisplayDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors)
void DisplayDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
{
}
@@ -1823,7 +1895,7 @@ void DisplayDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize,
Subclasses must include calls to _SetDepth, _SetHeight, _SetWidth, and _SetMode
to update the state variables kept internally by the DisplayDriver class.
*/
void DisplayDriver::SetMode(int32 mode)
void DisplayDriver::SetMode(const int32 &mode)
{
}
@@ -1876,7 +1948,7 @@ ServerBitmap *DisplayDriver::DumpToBitmap(void)
This corresponds to BView::StringWidth.
*/
float DisplayDriver::StringWidth(const char *string, int32 length, LayerData *d)
float DisplayDriver::StringWidth(const char *string, int32 length, const DrawData *d)
{
return 0.0;
}
@@ -1893,7 +1965,7 @@ float DisplayDriver::StringWidth(const char *string, int32 length, LayerData *d)
with a font's height, i.e. the strings 'case' and 'alps' will have different values
even when called with all other values equal.
*/
float DisplayDriver::StringHeight(const char *string, int32 length, LayerData *d)
float DisplayDriver::StringHeight(const char *string, int32 length, const DrawData *d)
{
return 0.0;
}
@@ -1910,7 +1982,7 @@ float DisplayDriver::StringHeight(const char *string, int32 length, LayerData *d
See BFont::GetBoundingBoxes for more details on this function.
*/
void DisplayDriver::GetBoundingBoxes(const char *string, int32 count,
font_metric_mode mode, escapement_delta *delta, BRect *rectarray, LayerData *d)
font_metric_mode mode, escapement_delta *delta, BRect *rectarray, const DrawData *d)
{
}
@@ -1928,7 +2000,7 @@ void DisplayDriver::GetBoundingBoxes(const char *string, int32 count,
See BFont::GetEscapements for more details on this function.
*/
void DisplayDriver::GetEscapements(const char *string, int32 charcount,
escapement_delta *delta, escapement_delta *escapements, escapement_delta *offsets, LayerData *d)
escapement_delta *delta, escapement_delta *escapements, escapement_delta *offsets, const DrawData *d)
{
}
@@ -1941,7 +2013,7 @@ void DisplayDriver::GetEscapements(const char *string, int32 charcount,
See BFont::GetEdges for more details on this function.
*/
void DisplayDriver::GetEdges(const char *string, int32 charcount, edge_info *edgearray, LayerData *d)
void DisplayDriver::GetEdges(const char *string, int32 charcount, edge_info *edgearray, const DrawData *d)
{
}
@@ -1968,8 +2040,8 @@ void DisplayDriver::GetHasGlyphs(const char *string, int32 charcount, bool *hasa
See BFont::GetTruncatedStrings for more details on this function.
*/
void DisplayDriver::GetTruncatedStrings( const char **instrings, int32 stringcount,
uint32 mode, float maxwidth, char **outstrings)
void DisplayDriver::GetTruncatedStrings(const char **instrings,const int32 &stringcount,
const uint32 &mode, const float &maxwidth, char **outstrings)
{
}
@@ -1982,24 +2054,6 @@ uint8 DisplayDriver::GetDepth(void)
return _buffer_depth;
}
/*!
\brief Returns the height for the current screen mode
\return Height of the screen
*/
uint16 DisplayDriver::GetHeight(void)
{
return _buffer_height;
}
/*!
\brief Returns the width for the current screen mode
\return Width of the screen
*/
uint16 DisplayDriver::GetWidth(void)
{
return _buffer_width;
}
/*!
\brief Returns the number of bytes used in each row of the frame buffer
\return The number of bytes used in each row of the frame buffer
@@ -2196,101 +2250,6 @@ status_t DisplayDriver::WaitForRetrace(bigtime_t timeout)
}
/*!
\brief Internal depth-setting function
\param d Number of bits per pixel in use
_SetDepth must be called from within any implementation of SetMode
*/
void DisplayDriver::_SetDepth(uint8 d)
{
_buffer_depth=d;
}
/*!
\brief Internal height-setting function
\param h Height of the frame buffer
_SetHeight must be called from within any implementation of SetMode
*/
void DisplayDriver::_SetHeight(uint16 h)
{
_buffer_height=h;
}
/*!
\brief Internal width-setting function
\param w Width of the frame buffer
_SetWidth must be called from within any implementation of SetMode
*/
void DisplayDriver::_SetWidth(uint16 w)
{
_buffer_width=w;
}
/*!
\brief Internal mode-setting function.
\param m Screen mode in use as defined in GraphicsDefs.h
_SetMode must be called from within any implementation of SetMode. Note that this
does not actually change the screen mode; it just updates the state variable used
to talk with the outside world.
*/
void DisplayDriver::_SetMode(int32 m)
{
_buffer_mode=m;
}
/*!
\brief Internal row size-setting function
\param bpr Number of bytes per row in the frame buffer
_SetBytesPerRow must be called from within any implementation of SetMode. Note that this
does not actually change the size of the row; it just updates the state variable used
to talk with the outside world.
*/
void DisplayDriver::_SetBytesPerRow(uint32 bpr)
{
_bytes_per_row=bpr;
}
/*!
\brief Internal DPMS value-setting function
\param state The new capabilities of the driver
_SetDPMSState must be called from within any implementation of SetDPMSState. Note that this
does not actually change the state itself; it just updates the state variable used
to talk with the outside world.
*/
void DisplayDriver::_SetDPMSState(uint32 state)
{
_dpms_caps=state;
}
/*!
\brief Internal DPMS value-setting function
\param state The new capabilities of the driver
_SetDPMSCapabilities must be called at the initialization of the driver so that
GetDPMSCapabilities returns the proper values.
*/
void DisplayDriver::_SetDPMSCapabilities(uint32 caps)
{
_dpms_caps=caps;
}
/*!
\brief Internal device info value-setting function
\param state The new capabilities of the driver
_SetDeviceInfo must be called at the initialization of the driver so that
GetDeviceInfo returns the proper values.
*/
void _SetDeviceInfo(const accelerant_device_info &infO)
{
}
/*!
\brief Obtains the current cursor for the driver.
\return Pointer to the current cursor object.
@@ -2377,3 +2336,32 @@ void DisplayDriver::FillSolidRect(int32 left, int32 top, int32 right, int32 bott
void DisplayDriver::FillPatternRect(int32 left, int32 top, int32 right, int32 bottom)
{
}
void DisplayDriver::Blit(const BRect &src, const BRect &dest, const DrawData *d)
{
}
void DisplayDriver::FillSolidRect(const BRect &rect, RGBColor &color)
{
}
void DisplayDriver::FillPatternRect(const BRect &rect, const DrawData *d)
{
}
void DisplayDriver::StrokeSolidLine(const BPoint &start, const BPoint &end, RGBColor &color)
{
}
void DisplayDriver::StrokeSolidRect(const BRect &rect, RGBColor &color)
{
}
void DisplayDriver::CopyBitmap(ServerBitmap *bitmap, const BRect &source, const BRect &dest, const DrawData *d)
{
}
void DisplayDriver::CopyToBitmap(ServerBitmap *target, const BRect &source)
{
}
+5 -2
View File
@@ -16,6 +16,7 @@ SharedLibrary appserver :
Decorator.cpp
DisplayDriver.cpp
FontFamily.cpp
LayerData.cpp
PatternHandler.cpp
RectUtils.cpp
RGBColor.cpp
@@ -51,9 +52,11 @@ Server app_server :
ServerWindow.cpp
# Display Classes
Clipper.cpp
# Clipper.cpp
AccelerantDriver.cpp
ScreenDriver.cpp
# We'll just remove this from the build for a little while...
#ScreenDriver.cpp
ViewDriver.cpp
DefaultDecorator.cpp
Layer.cpp
+2 -2
View File
@@ -510,7 +510,7 @@ void Layer::RequestClientUpdate(const BRect &rect){
RGBColor tempColor(B_TRANSPARENT_COLOR);
//_layerdata->lowcolor.SetColor( B_TRANSPARENT_COLOR );
fDriver->StrokeRect(rect, _layerdata->pensize, tempColor);
fDriver->StrokeRect(rect, tempColor);
}
BMessage msg;
@@ -535,7 +535,7 @@ void Layer::RequestDraw(const BRect &r)
RGBColor tempColor(B_TRANSPARENT_COLOR);
//_layerdata->lowcolor.SetColor( B_TRANSPARENT_COLOR );
fDriver->StrokeRect(r, _layerdata->pensize, tempColor);
fDriver->StrokeRect(r, tempColor);
// draw itself.
Draw(r);
+14 -14
View File
@@ -153,47 +153,47 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
{
BPoint start = GetCoord();
BPoint end = GetCoord();
fdriver->StrokeLine(start,end,fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->StrokeLine(start,end,&fldata,stipplepat);
break;
}
case B_PIC_STROKE_RECT:
{
BRect rect = GetRect();
fdriver->StrokeRect(rect,fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->StrokeRect(rect,&fldata,stipplepat);
break;
}
case B_PIC_FILL_RECT:
{
BRect rect = GetRect();
fdriver->FillRect(rect,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->FillRect(rect,&fldata,stipplepat);
break;
}
case B_PIC_STROKE_ROUND_RECT:
{
BRect rect = GetRect();
BPoint radii = GetCoord();
fdriver->StrokeRoundRect(rect,radii.x,radii.y,fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->StrokeRoundRect(rect,radii.x,radii.y,&fldata,stipplepat);
break;
}
case B_PIC_FILL_ROUND_RECT:
{
BRect rect = GetRect();
BPoint radii = GetCoord();
fdriver->FillRoundRect(rect,radii.x,radii.y,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->FillRoundRect(rect,radii.x,radii.y,&fldata,stipplepat);
break;
}
case B_PIC_STROKE_BEZIER:
{
BPoint control[4];
GetData(control, sizeof(control));
fdriver->StrokeBezier(control,fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->StrokeBezier(control,&fldata,stipplepat);
break;
}
case B_PIC_FILL_BEZIER:
{
BPoint control[4];
GetData(control, sizeof(control));
fdriver->FillBezier(control,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->FillBezier(control,&fldata,stipplepat);
break;
}
case B_PIC_STROKE_POLYGON:
@@ -202,7 +202,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
BPoint *points = new BPoint[numPoints];
GetData(points, numPoints * sizeof(BPoint));
bool isClosed = GetBool();
fdriver->StrokePolygon(points,numPoints,fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor,isClosed);
fdriver->StrokePolygon(points,numPoints,&fldata,stipplepat,isClosed);
delete points;
break;
}
@@ -211,7 +211,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
int32 numPoints = GetInt32();
BPoint *points = new BPoint[numPoints];
GetData(points, numPoints * sizeof(BPoint));
fdriver->FillPolygon(points,numPoints,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->FillPolygon(points,numPoints,&fldata,stipplepat);
delete points;
break;
}
@@ -230,7 +230,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
// TODO: The deltas given are escapements. Find out how they translate into
// escapement_delta units.
fdriver->DrawString(string,len,fldata.penlocation,&fldata,NULL);
fdriver->DrawString(string,len,fldata.penlocation,&fldata);
delete string;
break;
}
@@ -268,7 +268,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
float startTheta = GetFloat();
float arcTheta = GetFloat();
fdriver->StrokeArc(BRect(center.x-radii.x,center.y-radii.y,center.x+radii.x,
center.y+radii.y),startTheta, arcTheta, fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor);
center.y+radii.y),startTheta, arcTheta, &fldata,stipplepat);
break;
}
case B_PIC_FILL_ARC:
@@ -278,7 +278,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
float startTheta = GetFloat();
float arcTheta = GetFloat();
fdriver->FillArc(BRect(center.x-radii.x,center.y-radii.y,center.x+radii.x,
center.y+radii.y),startTheta, arcTheta, stipplepat, fldata.highcolor, fldata.lowcolor);
center.y+radii.y),startTheta, arcTheta, &fldata, stipplepat);
break;
}
case B_PIC_STROKE_ELLIPSE:
@@ -287,7 +287,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
BPoint center;
BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f);
center = rect.LeftTop() + radii;
fdriver->StrokeEllipse(rect,fldata.pensize,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->StrokeEllipse(rect,&fldata,stipplepat);
break;
}
case B_PIC_FILL_ELLIPSE:
@@ -296,7 +296,7 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
BPoint center;
BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f);
center = rect.LeftTop() + radii;
fdriver->FillEllipse(rect,stipplepat,fldata.highcolor,fldata.lowcolor);
fdriver->FillEllipse(rect,&fldata,stipplepat);
break;
}
case B_PIC_ENTER_STATE_CHANGE:
+1 -4
View File
@@ -89,10 +89,7 @@ bool Screen::SetResolution(BPoint res, uint32 colorspace){
BPoint Screen::Resolution() const{
display_mode mode;
// fDDriver->GetMode(&mode);
//TODO: remove!
return BPoint(fDDriver->GetWidth(), fDDriver->GetHeight());
//------------
fDDriver->GetMode(&mode);
return BPoint(mode.virtual_width, mode.virtual_height);
}
+30 -788
View File
@@ -537,11 +537,12 @@ ViewDriver::ViewDriver(void)
framebuffer=screenwin->view->viewbmp;
serverlink=screenwin->view->serverlink;
hide_cursor=0;
_SetWidth(640);
_SetHeight(480);
_SetDepth(8);
_SetMode(B_8_BIT_640x480);
_SetBytesPerRow(framebuffer->BytesPerRow());
_buffer_width=640;
_buffer_height=480;
_buffer_depth=8;
_buffer_mode=B_8_BIT_640x480;
_bytes_per_row=framebuffer->BytesPerRow();
// We add this because if we see the default workspace color, then we have at least
// a reasonable idea that everything is kosher.
@@ -612,9 +613,9 @@ void ViewDriver::SetMode(const display_mode &mode)
delete framebuffer;
// don't forget to update the internal vars!
_SetWidth(mode.virtual_width);
_SetHeight(mode.virtual_height);
_SetMode(mode.space);
_buffer_width=mode.virtual_width;
_buffer_height=mode.virtual_height;
_buffer_mode=mode.space;
screenwin->view->viewbmp=tempbmp;
framebuffer=screenwin->view->viewbmp;
@@ -627,12 +628,12 @@ void ViewDriver::SetMode(const display_mode &mode)
drawview->Sync();
framebuffer->Unlock();
_SetBytesPerRow(framebuffer->BytesPerRow());
_bytes_per_row=framebuffer->BytesPerRow();
screenwin->view->Invalidate();
screenwin->Unlock();
}
void ViewDriver::SetMode(int32 space)
void ViewDriver::SetMode(const int32 &space)
{
if(!is_initialized)
return;
@@ -668,22 +669,22 @@ void ViewDriver::SetMode(int32 space)
case B_32_BIT_800x600:
case B_32_BIT_1024x768:
s=B_RGBA32;
_SetDepth(32);
_buffer_depth=32;
break;
case B_16_BIT_640x480:
case B_16_BIT_800x600:
case B_16_BIT_1024x768:
s=B_RGBA15;
_SetDepth(15);
_buffer_depth=15;
break;
case B_8_BIT_640x480:
case B_8_BIT_800x600:
case B_8_BIT_1024x768:
s=B_CMAP8;
_SetDepth(8);
_buffer_depth=8;
break;
default:
_SetDepth(8);
_buffer_depth=8;
break;
}
@@ -691,9 +692,9 @@ void ViewDriver::SetMode(int32 space)
delete framebuffer;
// don't forget to update the internal vars!
_SetWidth(w);
_SetHeight(h);
_SetMode(space);
_buffer_width=w;
_buffer_height=h;
_buffer_mode=space;
screenwin->view->viewbmp=new BBitmap(BRect(0,0,w-1,h-1),s,true);
framebuffer=screenwin->view->viewbmp;
@@ -706,26 +707,12 @@ void ViewDriver::SetMode(int32 space)
drawview->Sync();
framebuffer->Unlock();
_SetBytesPerRow(framebuffer->BytesPerRow());
_bytes_per_row=framebuffer->BytesPerRow();
screenwin->view->Invalidate();
screenwin->Unlock();
}
void ViewDriver::CopyBits(BRect src, BRect dest)
{
if(!is_initialized)
return;
screenwin->Lock();
framebuffer->Lock();
drawview->CopyBits(src,dest);
drawview->Sync();
screenwin->view->Invalidate(src);
screenwin->view->Invalidate(dest);
framebuffer->Unlock();
screenwin->Unlock();
}
/*
void ViewDriver::CopyRegion(BRegion *src, const BPoint &lefttop)
{
if(!is_initialized)
@@ -821,8 +808,9 @@ printf("Overlap\n");
framebuffer->Unlock();
screenwin->Unlock();
}
*/
void ViewDriver::DrawBitmap(ServerBitmap *bitmap, BRect src, BRect dest)
void ViewDriver::DrawBitmap(ServerBitmap *bitmap, const BRect &src, const BRect &dest, const DrawData *d)
{
if(!is_initialized)
return;
@@ -830,52 +818,6 @@ void ViewDriver::DrawBitmap(ServerBitmap *bitmap, BRect src, BRect dest)
STRACE(("ViewDriver:: DrawBitmap unimplemented()\n"));
}
void ViewDriver::DrawChar(char c, BPoint pt, LayerData *d)
{
if(!is_initialized)
return;
char str[2];
str[0]=c;
str[1]='\0';
DrawString(str, 1, pt, d);
}
void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
{
if(!is_initialized)
return;
STRACE(("ViewDriver:: DrawString(\"%s\",%ld,BPoint(%f,%f))\n",string,length,pt.x,pt.y));
if(!d)
return;
BRect r;
screenwin->Lock();
framebuffer->Lock();
SetLayerData(d,true); // set all layer data and additionally set the font-related data
drawview->DrawString(string,length,pt,delta);
drawview->Sync();
// calculate the invalid rectangle
font_height fh;
BFont font;
drawview->GetFont(&font);
drawview->GetFontHeight(&fh);
r.left=pt.x;
r.right=pt.x+font.StringWidth(string);
r.top=pt.y-fh.ascent;
r.bottom=pt.y+fh.descent;
screenwin->view->Invalidate(r);
framebuffer->Unlock();
screenwin->Unlock();
}
bool ViewDriver::DumpToFile(const char *path)
{
if(!is_initialized)
@@ -891,614 +833,6 @@ bool ViewDriver::DumpToFile(const char *path)
}
void ViewDriver::FillArc(const BRect r, float angle, float span, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->FillArc(r,angle,span,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate(r);
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillArc(const BRect r, float angle, float span, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->FillArc(r,angle,span,*((pattern*)pat.GetInt8()) );
drawview->Sync();
screenwin->view->Invalidate(r);
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillBezier(BPoint *pts, RGBColor& color)
{
if(!is_initialized)
return;
if(!pts)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->FillBezier(pts,B_SOLID_HIGH);
drawview->Sync();
// Invalidate the whole view until I get around to adding in the invalid rect calc code
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillBezier(BPoint *pts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
if(!pts)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->FillBezier(pts,*((pattern*)pat.GetInt8()));
drawview->Sync();
// Invalidate the whole view until I get around to adding in the invalid rect calc code
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillEllipse(BRect r, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->FillEllipse(r,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillEllipse(BRect r, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->FillEllipse(r,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->FillPolygon(ptlist,numpts,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->FillPolygon(ptlist,numpts,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillRect(const BRect r, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->FillRect(r,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
/*!
\brief Called for all BView::FillRect calls
\param r BRect to be filled. Guaranteed to be in the frame buffer's coordinate space
\param pat The pattern to be used when filling the rectangle
\param high_color The high color of the pattern to fill
\param low_color The low color of the pattern to fill
*/
void ViewDriver::FillRect(const BRect r, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->FillRect(r,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->FillRoundRect(r,xrad,yrad,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->FillRoundRect(r,xrad,yrad,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillTriangle(BPoint *pts, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
BRect r(pts[0],pts[0]);
int i;
for (i=1; i<3; i++)
{
if ( pts[i].x < r.left )
r.left = pts[i].x;
if ( pts[i].x > r.right )
r.right = pts[i].x;
if ( pts[i].y < r.top )
r.top = pts[i].y;
if ( pts[i].y > r.bottom )
r.bottom = pts[i].y;
}
drawview->FillTriangle(pts[0],pts[1],pts[2],r,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::FillTriangle(BPoint *pts, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
BRect r(pts[0],pts[0]);
int i;
for (i=1; i<3; i++)
{
if ( pts[i].x < r.left )
r.left = pts[i].x;
if ( pts[i].x > r.right )
r.right = pts[i].x;
if ( pts[i].y < r.top )
r.top = pts[i].y;
if ( pts[i].y > r.bottom )
r.bottom = pts[i].y;
}
drawview->FillTriangle(pts[0],pts[1],pts[2],r,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->StrokeArc(r,angle,span,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->StrokeArc(r,angle,span,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeBezier(BPoint *pts, float pensize, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->StrokeBezier(pts,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeBezier(BPoint *pts, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->StrokeBezier(pts,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeEllipse(BRect r, float pensize, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->StrokeEllipse(r,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeEllipse(BRect r, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->StrokeEllipse(r,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->StrokeLine(start,end,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->StrokeLine(start,end,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokePoint(BPoint& pt, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
Unlock();
}
void ViewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor& color, bool is_closed)
{
if(!ptlist)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
BRegion invalid;
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->BeginLineArray(numpts+2);
for(int i=1;i<numpts;i++)
{
drawview->AddLine(ptlist[i-1],ptlist[i],color.GetColor32());
invalid.Include(BRect(ptlist[i-1],ptlist[i]));
}
if(is_closed)
{
drawview->AddLine(ptlist[numpts-1],ptlist[0],color.GetColor32());
invalid.Include(BRect(ptlist[numpts-1],ptlist[0]));
}
drawview->EndLineArray();
drawview->Sync();
screenwin->view->Invalidate(invalid.Frame());
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color, bool is_closed)
{
if(!is_initialized)
return;
StrokePolygon(ptlist,numpts,pensize,high_color,is_closed);
}
void ViewDriver::StrokeRect(BRect r, float pensize, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->StrokeRect(r,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeRect(BRect r, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->StrokeRect(r,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(color.GetColor32());
drawview->SetLowColor(color.GetColor32());
drawview->StrokeRoundRect(r,xrad,yrad,B_SOLID_HIGH);
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pat, RGBColor& high_color, RGBColor& low_color)
{
if(!is_initialized)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetHighColor(high_color.GetColor32());
drawview->SetLowColor(low_color.GetColor32());
drawview->StrokeRoundRect(r,xrad,yrad,*((pattern*)pat.GetInt8()));
drawview->Sync();
screenwin->view->Invalidate();
framebuffer->Unlock();
screenwin->Unlock();
Unlock();
}
/*!
\brief Draws a series of lines - optimized for speed
\param pts Array of BPoints pairs
@@ -1506,19 +840,19 @@ void ViewDriver::StrokeRoundRect(BRect r, float xrad, float yrad, float pensize,
\param pensize The thickness of the lines
\param colors Array of colors for each respective line
*/
void ViewDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors)
void ViewDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors)
{
if(!is_initialized)
return;
if( !numlines || !pts || !colors)
if( !numlines || !pts || !colors || !d)
return;
Lock();
screenwin->Lock();
framebuffer->Lock();
drawview->SetPenSize(pensize);
drawview->SetDrawingMode(B_OP_COPY);
drawview->SetPenSize(d->pensize);
drawview->SetDrawingMode(d->draw_mode);
int32 ptindex=0;
@@ -1543,25 +877,7 @@ void ViewDriver::StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGB
}
void ViewDriver::HideCursor(void)
{
if(!is_initialized)
return;
screenwin->Lock();
Lock();
hide_cursor++;
screenwin->PostMessage(VDWIN_HIDECURSOR);
Unlock();
screenwin->Unlock();
}
void ViewDriver::InvertRect(BRect r)
void ViewDriver::InvertRect(const BRect &r)
{
if(!is_initialized)
return;
@@ -1575,83 +891,6 @@ void ViewDriver::InvertRect(BRect r)
screenwin->Unlock();
}
bool ViewDriver::IsCursorHidden(void)
{
if(!is_initialized)
return false;
screenwin->Lock();
bool value=(hide_cursor>0)?true:false;
screenwin->Unlock();
return value;
}
void ViewDriver::ObscureCursor(void)
{
if(!is_initialized)
return;
screenwin->Lock();
screenwin->PostMessage(VDWIN_OBSCURECURSOR);
screenwin->Unlock();
}
void ViewDriver::MoveCursorTo(float x, float y)
{
if(!is_initialized)
return;
screenwin->Lock();
BMessage *msg=new BMessage(VDWIN_MOVECURSOR);
msg->AddFloat("x",x);
msg->AddFloat("y",y);
screenwin->PostMessage(msg);
screenwin->Unlock();
}
void ViewDriver::SetCursor(ServerCursor *cursor)
{
if(!is_initialized)
return;
if(cursor!=NULL)
{
screenwin->Lock();
BBitmap *bmp=new BBitmap(cursor->Bounds(),B_RGBA32);
// Copy the server bitmap in the cursor to a BBitmap
uint8 *sbmppos=(uint8*)cursor->Bits(),
*bbmppos=(uint8*)bmp->Bits();
int32 bytes=cursor->BytesPerRow(),
bbytes=bmp->BytesPerRow();
for(int i=0;i<=cursor->Bounds().IntegerHeight();i++)
memcpy(bbmppos+(i*bbytes), sbmppos+(i*bytes), bytes);
// Replace the bitmap
delete screenwin->view->cursor;
screenwin->view->cursor=bmp;
screenwin->view->Invalidate(screenwin->view->cursorframe);
screenwin->Unlock();
}
}
void ViewDriver::ShowCursor(void)
{
if(!is_initialized)
return;
screenwin->Lock();
if(hide_cursor>0)
{
hide_cursor--;
screenwin->PostMessage(VDWIN_SHOWCURSOR);
}
screenwin->Unlock();
}
void ViewDriver::SetLayerData(LayerData *d, bool set_font_data)
{
if(!is_initialized)
@@ -1696,6 +935,7 @@ void ViewDriver::SetLayerData(LayerData *d, bool set_font_data)
}
}
/*
float ViewDriver::StringWidth(const char *string, int32 length, LayerData *d)
{
if(!string || !d || !is_initialized)
@@ -1821,6 +1061,7 @@ float ViewDriver::StringHeight(const char *string, int32 length, LayerData *d)
returnval=ascent+descent;
return returnval;
}
*/
/*
void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *edelta)
{
@@ -1969,6 +1210,7 @@ void ViewDriver::DrawString(const char *string, int32 length, BPoint pt, LayerDa
FT_Done_Face(face);
}
*/
void ViewDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
{
if(!is_initialized)
+5 -54
View File
@@ -106,67 +106,18 @@ public:
void Shutdown(void); // You never know when you'll need this
// Drawing functions
void CopyBits(BRect src, BRect dest);
void CopyRegion(BRegion *src, const BPoint &lefttop);
void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest);
void DrawChar(char c, BPoint pt, LayerData *d);
// virtual void DrawPicture(SPicture *pic, BPoint pt);
void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
void DrawBitmap(ServerBitmap *bmp, const BRect &src, const BRect &dest, const DrawData *d);
void HideCursor(void);
void InvertRect(BRect r);
bool IsCursorHidden(void);
void MoveCursorTo(float x, float y);
// void MovePenTo(BPoint pt);
void ObscureCursor(void);
// BPoint PenPosition(void);
// float PenSize(void);
void SetCursor(ServerCursor *cursor);
// drawing_mode GetDrawingMode(void);
// void SetDrawingMode(drawing_mode mode);
void ShowCursor(void);
void InvertRect(const BRect &r);
virtual void FillArc(const BRect r, float angle, float span, RGBColor& color);
virtual void FillArc(const BRect r, float angle, float span, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillBezier(BPoint *pts, RGBColor& color);
virtual void FillBezier(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillEllipse(BRect r, RGBColor& color);
virtual void FillEllipse(BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, RGBColor& color);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillRect(const BRect r, RGBColor& color);
virtual void FillRect(const BRect r, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void FillRoundRect(BRect r, float xrad, float yrad, RGBColor& color);
virtual void FillRoundRect(BRect r, float xrad, float yrad, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
// virtual void FillShape(SShape *sh, LayerData *d, const Pattern &pat);
virtual void FillTriangle(BPoint *pts, RGBColor& color);
virtual void FillTriangle(BPoint *pts, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeArc(BRect r, float angle, float span, float pensize, RGBColor& color);
virtual void StrokeArc(BRect r, float angle, float span, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeBezier(BPoint *pts, float pensize, RGBColor& color);
virtual void StrokeBezier(BPoint *pts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeEllipse(BRect r, float pensize, RGBColor& color);
virtual void StrokeEllipse(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeLine(BPoint start, BPoint end, float pensize, RGBColor& color);
virtual void StrokeLine(BPoint start, BPoint end, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokePoint(BPoint& pt, RGBColor& color);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, RGBColor& color, bool is_closed=true);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color, bool is_closed=true);
virtual void StrokeRect(BRect r, float pensize, RGBColor& color);
virtual void StrokeRect(BRect r, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, RGBColor& color);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, float pensize, const Pattern& pattern, RGBColor& high_color, RGBColor& low_color);
// virtual void StrokeShape(SShape *sh, LayerData *d, const Pattern &pat);
virtual void StrokeLineArray(BPoint *pts, int32 numlines, float pensize, RGBColor *colors);
virtual void StrokeLineArray(BPoint *pts, const int32 &numlines, const DrawData *d, RGBColor *colors);
void SetMode(int32 mode);
void SetMode(const int32 &mode);
void SetMode(const display_mode &mode);
float StringWidth(const char *string, int32 length, LayerData *d);
float StringHeight(const char *string, int32 length, LayerData *d);
bool DumpToFile(const char *path);
VDWindow *screenwin;
virtual status_t SetDPMSMode(const uint32 &state);