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
+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)
{
}