* added a version of SetFont() that takes a DrawState* to DrawingEngine and

Painter, that is needed to be able to tell if anti-aliasing is to be used,
  since the flags in the font can be overruled by the flags in the view...
* fixes aliased fonts reliably, tested with FontDemo


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21869 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2007-08-09 09:48:28 +00:00
parent 98eadf4b9d
commit fe914c98b4
5 changed files with 31 additions and 14 deletions
+1 -2
View File
@@ -1271,9 +1271,8 @@ ServerWindow::_DispatchViewMessage(int32 code,
{
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
fCurrentLayer->CurrentState()->ReadFontFromLink(link);
// _UpdateDrawState(fCurrentLayer);
fWindowLayer->GetDrawingEngine()->SetFont(
fCurrentLayer->CurrentState()->Font());
fCurrentLayer->CurrentState());
break;
}
case AS_LAYER_GET_STATE:
+16 -9
View File
@@ -185,28 +185,28 @@ DrawingEngine::ConstrainClippingRegion(const BRegion* region)
void
DrawingEngine::SetDrawState(const DrawState* state, int32 xOffset, int32 yOffset)
{
fPainter->SetDrawState(state, xOffset, yOffset);
fPainter->SetDrawState(state, xOffset, yOffset);
}
void
DrawingEngine::SetHighColor(const rgb_color& color)
{
fPainter->SetHighColor(color);
fPainter->SetHighColor(color);
}
void
DrawingEngine::SetLowColor(const rgb_color& color)
{
fPainter->SetLowColor(color);
fPainter->SetLowColor(color);
}
void
DrawingEngine::SetPenSize(float size)
{
fPainter->SetPenSize(size);
fPainter->SetPenSize(size);
}
@@ -214,35 +214,42 @@ void
DrawingEngine::SetStrokeMode(cap_mode lineCap, join_mode joinMode,
float miterLimit)
{
fPainter->SetStrokeMode(lineCap, joinMode, miterLimit);
fPainter->SetStrokeMode(lineCap, joinMode, miterLimit);
}
void
DrawingEngine::SetBlendingMode(source_alpha srcAlpha, alpha_function alphaFunc)
{
fPainter->SetBlendingMode(srcAlpha, alphaFunc);
fPainter->SetBlendingMode(srcAlpha, alphaFunc);
}
void
DrawingEngine::SetPattern(const struct pattern& pattern)
{
fPainter->SetPattern(pattern, false);
fPainter->SetPattern(pattern, false);
}
void
DrawingEngine::SetDrawingMode(drawing_mode mode)
{
fPainter->SetDrawingMode(mode);
fPainter->SetDrawingMode(mode);
}
void
DrawingEngine::SetFont(const ServerFont& font)
{
fPainter->SetFont(font);
fPainter->SetFont(font);
}
void
DrawingEngine::SetFont(const DrawState* state)
{
fPainter->SetFont(state);
}
+1
View File
@@ -79,6 +79,7 @@ public:
void SetBlendingMode(source_alpha srcAlpha,
alpha_function alphaFunc);
void SetFont(const ServerFont& font);
void SetFont(const DrawState* state);
void SuspendAutoSync();
void Sync();
+12 -3
View File
@@ -130,9 +130,7 @@ Painter::SetDrawState(const DrawState* data, int32 xOffset, int32 yOffset)
// but for now...
SetPenSize(data->PenSize());
SetFont(data->Font());
fTextRenderer.SetAntialiasing(!(data->ForceFontAliasing()
|| data->Font().Flags() & B_DISABLE_ANTIALIASING));
SetFont(data);
fSubpixelPrecise = data->SubPixelPrecise();
@@ -260,6 +258,17 @@ void
Painter::SetFont(const ServerFont& font)
{
fTextRenderer.SetFont(font);
fTextRenderer.SetAntialiasing(
!(font.Flags() & B_DISABLE_ANTIALIASING));
}
// SetFont
void
Painter::SetFont(const DrawState* state)
{
fTextRenderer.SetFont(state->Font());
fTextRenderer.SetAntialiasing(!(state->ForceFontAliasing()
|| state->Font().Flags() & B_DISABLE_ANTIALIASING));
}
// #pragma mark - drawing
@@ -85,6 +85,7 @@ class Painter {
alpha_function alphaFunc);
void SetFont(const ServerFont& font);
void SetFont(const DrawState* state);
inline const ServerFont& Font() const
{ return fTextRenderer.Font(); }