Style fixes.

This commit is contained in:
Adrien Destugues
2014-01-21 13:59:35 +01:00
parent 2585a0c5c9
commit 77bf4d8d51
5 changed files with 173 additions and 167 deletions
+24 -10
View File
@@ -34,22 +34,30 @@ DrawingContext::DrawingContext()
status_t
DrawingContext::InitCheck() const
{
if (fDrawState == NULL)
return B_NO_MEMORY;
return B_OK;
}
void
DrawingContext::PushState()
{
DrawState* newState = fDrawState->PushState();
if (newState) {
if (newState)
fDrawState = newState;
}
}
void
DrawingContext::PopState()
{
if (fDrawState->PreviousState() == NULL) {
if (fDrawState->PreviousState() == NULL)
return;
}
bool rebuildClipping = fDrawState->HasAdditionalClipping();
@@ -152,7 +160,8 @@ void
DrawingContext::ConvertToScreenForDrawing(BGradient* gradient) const
{
switch(gradient->GetType()) {
case BGradient::TYPE_LINEAR: {
case BGradient::TYPE_LINEAR:
{
BGradientLinear* linear = (BGradientLinear*) gradient;
BPoint start = linear->Start();
BPoint end = linear->End();
@@ -165,7 +174,8 @@ DrawingContext::ConvertToScreenForDrawing(BGradient* gradient) const
linear->SortColorStopsByOffset();
break;
}
case BGradient::TYPE_RADIAL: {
case BGradient::TYPE_RADIAL:
{
BGradientRadial* radial = (BGradientRadial*) gradient;
BPoint center = radial->Center();
fDrawState->Transform(&center);
@@ -174,7 +184,8 @@ DrawingContext::ConvertToScreenForDrawing(BGradient* gradient) const
radial->SortColorStopsByOffset();
break;
}
case BGradient::TYPE_RADIAL_FOCUS: {
case BGradient::TYPE_RADIAL_FOCUS:
{
BGradientRadialFocus* radialFocus = (BGradientRadialFocus*) gradient;
BPoint center = radialFocus->Center();
BPoint focal = radialFocus->Focal();
@@ -187,7 +198,8 @@ DrawingContext::ConvertToScreenForDrawing(BGradient* gradient) const
radialFocus->SortColorStopsByOffset();
break;
}
case BGradient::TYPE_DIAMOND: {
case BGradient::TYPE_DIAMOND:
{
BGradientDiamond* diamond = (BGradientDiamond*) gradient;
BPoint center = diamond->Center();
fDrawState->Transform(&center);
@@ -196,7 +208,8 @@ DrawingContext::ConvertToScreenForDrawing(BGradient* gradient) const
diamond->SortColorStopsByOffset();
break;
}
case BGradient::TYPE_CONIC: {
case BGradient::TYPE_CONIC:
{
BGradientConic* conic = (BGradientConic*) gradient;
BPoint center = conic->Center();
fDrawState->Transform(&center);
@@ -205,7 +218,8 @@ DrawingContext::ConvertToScreenForDrawing(BGradient* gradient) const
conic->SortColorStopsByOffset();
break;
}
case BGradient::TYPE_NONE: {
case BGradient::TYPE_NONE:
{
break;
}
}
+3 -2
View File
@@ -10,8 +10,8 @@
* Marcus Overhagen <[email protected]>
* Adrien Destugues <[email protected]>
*/
#ifndef DRAWINGCONTEXT_H
#define DRAWINGCONTEXT_H
#ifndef DRAWING_CONTEXT_H
#define DRAWING_CONTEXT_H
#include <Point.h>
@@ -29,6 +29,7 @@ class ServerPicture;
class DrawingContext {
public:
DrawingContext();
status_t InitCheck() const;
virtual void PushState();
virtual void PopState();
+146 -144
View File
@@ -44,7 +44,7 @@ using std::stack;
class ShapePainter : public BShapeIterator {
public:
ShapePainter(DrawingContext* view);
ShapePainter(DrawingContext* context);
virtual ~ShapePainter();
status_t Iterate(const BShape* shape);
@@ -59,15 +59,15 @@ public:
void Draw(BRect frame, bool filled);
private:
DrawingContext* fView;
DrawingContext* fContext;
stack<uint32> fOpStack;
stack<BPoint> fPtStack;
};
ShapePainter::ShapePainter(DrawingContext* view)
ShapePainter::ShapePainter(DrawingContext* context)
:
fView(view)
fContext(context)
{
}
@@ -203,10 +203,10 @@ ShapePainter::Draw(BRect frame, bool filled)
fPtStack.pop();
}
BPoint offset(fView->CurrentState()->PenLocation());
fView->ConvertToScreenForDrawing(&offset);
fView->GetDrawingEngine()->DrawShape(frame, opCount, opList, ptCount,
ptList, filled, offset, fView->Scale());
BPoint offset(fContext->CurrentState()->PenLocation());
fContext->ConvertToScreenForDrawing(&offset);
fContext->GetDrawingEngine()->DrawShape(frame, opCount, opList,
ptCount, ptList, filled, offset, fContext->Scale());
delete[] opList;
delete[] ptList;
@@ -253,23 +253,23 @@ nop()
static void
move_pen_by(DrawingContext* view, BPoint delta)
move_pen_by(DrawingContext* context, BPoint delta)
{
view->CurrentState()->SetPenLocation(
view->CurrentState()->PenLocation() + delta);
context->CurrentState()->SetPenLocation(
context->CurrentState()->PenLocation() + delta);
}
static void
stroke_line(DrawingContext* view, BPoint start, BPoint end)
stroke_line(DrawingContext* context, BPoint start, BPoint end)
{
BPoint penPos = end;
view->ConvertToScreenForDrawing(&start);
view->ConvertToScreenForDrawing(&end);
view->GetDrawingEngine()->StrokeLine(start, end);
context->ConvertToScreenForDrawing(&start);
context->ConvertToScreenForDrawing(&end);
context->GetDrawingEngine()->StrokeLine(start, end);
view->CurrentState()->SetPenLocation(penPos);
context->CurrentState()->SetPenLocation(penPos);
// the DrawingEngine/Painter does not need to be updated, since this
// effects only the view->screen coord conversion, which is handled
// by the view only
@@ -277,104 +277,103 @@ stroke_line(DrawingContext* view, BPoint start, BPoint end)
static void
stroke_rect(DrawingContext* view, BRect rect)
stroke_rect(DrawingContext* context, BRect rect)
{
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->StrokeRect(rect);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->StrokeRect(rect);
}
static void
fill_rect(DrawingContext* view, BRect rect)
fill_rect(DrawingContext* context, BRect rect)
{
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->FillRect(rect);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->FillRect(rect);
}
static void
stroke_round_rect(DrawingContext* view, BRect rect, BPoint radii)
stroke_round_rect(DrawingContext* context, BRect rect, BPoint radii)
{
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->DrawRoundRect(rect, radii.x,
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawRoundRect(rect, radii.x,
radii.y, false);
}
static void
fill_round_rect(DrawingContext* view, BRect rect, BPoint radii)
fill_round_rect(DrawingContext* context, BRect rect, BPoint radii)
{
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y, true);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y, true);
}
static void
stroke_bezier(DrawingContext* view, const BPoint* viewPoints)
stroke_bezier(DrawingContext* context, const BPoint* viewPoints)
{
BPoint points[4];
view->ConvertToScreenForDrawing(points, viewPoints, 4);
context->ConvertToScreenForDrawing(points, viewPoints, 4);
view->GetDrawingEngine()->DrawBezier(points, false);
context->GetDrawingEngine()->DrawBezier(points, false);
}
static void
fill_bezier(DrawingContext* view, const BPoint* viewPoints)
fill_bezier(DrawingContext* context, const BPoint* viewPoints)
{
BPoint points[4];
view->ConvertToScreenForDrawing(points, viewPoints, 4);
context->ConvertToScreenForDrawing(points, viewPoints, 4);
view->GetDrawingEngine()->DrawBezier(points, true);
context->GetDrawingEngine()->DrawBezier(points, true);
}
static void
stroke_arc(DrawingContext* view, BPoint center, BPoint radii, float startTheta,
float arcTheta)
stroke_arc(DrawingContext* context, BPoint center, BPoint radii,
float startTheta, float arcTheta)
{
BRect rect(center.x - radii.x, center.y - radii.y,
center.x + radii.x - 1, center.y + radii.y - 1);
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, false);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, false);
}
static void
fill_arc(DrawingContext* view, BPoint center, BPoint radii, float startTheta,
float arcTheta)
fill_arc(DrawingContext* context, BPoint center, BPoint radii,
float startTheta, float arcTheta)
{
BRect rect(center.x - radii.x, center.y - radii.y,
center.x + radii.x - 1, center.y + radii.y - 1);
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->DrawArc(rect, startTheta,
arcTheta, true);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, true);
}
static void
stroke_ellipse(DrawingContext* view, BPoint center, BPoint radii)
stroke_ellipse(DrawingContext* context, BPoint center, BPoint radii)
{
BRect rect(center.x - radii.x, center.y - radii.y,
center.x + radii.x - 1, center.y + radii.y - 1);
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->DrawEllipse(rect, false);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawEllipse(rect, false);
}
static void
fill_ellipse(DrawingContext* view, BPoint center, BPoint radii)
fill_ellipse(DrawingContext* context, BPoint center, BPoint radii)
{
BRect rect(center.x - radii.x, center.y - radii.y,
center.x + radii.x - 1, center.y + radii.y - 1);
view->ConvertToScreenForDrawing(&rect);
view->GetDrawingEngine()->DrawEllipse(rect, true);
context->ConvertToScreenForDrawing(&rect);
context->GetDrawingEngine()->DrawEllipse(rect, true);
}
static void
stroke_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints,
bool isClosed)
stroke_polygon(DrawingContext* context, int32 numPoints,
const BPoint* viewPoints, bool isClosed)
{
if (numPoints <= 0)
return;
@@ -385,12 +384,12 @@ stroke_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints,
char data[200 * sizeof(BPoint)];
BPoint* points = (BPoint*)data;
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
context->ConvertToScreenForDrawing(points, viewPoints, numPoints);
BRect polyFrame;
get_polygon_frame(points, numPoints, &polyFrame);
view->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
context->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
false, isClosed && numPoints > 2);
} else {
// avoid constructor/destructor calls by
@@ -399,12 +398,12 @@ stroke_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints,
if (points == NULL)
return;
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
context->ConvertToScreenForDrawing(points, viewPoints, numPoints);
BRect polyFrame;
get_polygon_frame(points, numPoints, &polyFrame);
view->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
context->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
false, isClosed && numPoints > 2);
free(points);
}
@@ -412,7 +411,8 @@ stroke_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints,
static void
fill_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints)
fill_polygon(DrawingContext* context, int32 numPoints,
const BPoint* viewPoints)
{
if (numPoints <= 0)
return;
@@ -423,12 +423,12 @@ fill_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints)
char data[200 * sizeof(BPoint)];
BPoint* points = (BPoint*)data;
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
context->ConvertToScreenForDrawing(points, viewPoints, numPoints);
BRect polyFrame;
get_polygon_frame(points, numPoints, &polyFrame);
view->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
context->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
true, true);
} else {
// avoid constructor/destructor calls by
@@ -437,12 +437,12 @@ fill_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints)
if (points == NULL)
return;
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
context->ConvertToScreenForDrawing(points, viewPoints, numPoints);
BRect polyFrame;
get_polygon_frame(points, numPoints, &polyFrame);
view->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
context->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
true, true);
free(points);
}
@@ -450,9 +450,9 @@ fill_polygon(DrawingContext* view, int32 numPoints, const BPoint* viewPoints)
static void
stroke_shape(DrawingContext* view, const BShape* shape)
stroke_shape(DrawingContext* context, const BShape* shape)
{
ShapePainter drawShape(view);
ShapePainter drawShape(context);
drawShape.Iterate(shape);
drawShape.Draw(shape->Bounds(), false);
@@ -460,9 +460,9 @@ stroke_shape(DrawingContext* view, const BShape* shape)
static void
fill_shape(DrawingContext* view, const BShape* shape)
fill_shape(DrawingContext* context, const BShape* shape)
{
ShapePainter drawShape(view);
ShapePainter drawShape(context);
drawShape.Iterate(shape);
drawShape.Draw(shape->Bounds(), true);
@@ -470,21 +470,21 @@ fill_shape(DrawingContext* view, const BShape* shape)
static void
draw_string(DrawingContext* view, const char* string, float deltaSpace,
draw_string(DrawingContext* context, const char* string, float deltaSpace,
float deltaNonSpace)
{
// NOTE: the picture data was recorded with a "set pen location"
// command inserted before the "draw string" command, so we can
// use PenLocation()
BPoint location = view->CurrentState()->PenLocation();
BPoint location = context->CurrentState()->PenLocation();
escapement_delta delta = {deltaSpace, deltaNonSpace };
view->ConvertToScreenForDrawing(&location);
view->GetDrawingEngine()->DrawString(string, strlen(string), location,
context->ConvertToScreenForDrawing(&location);
context->GetDrawingEngine()->DrawString(string, strlen(string), location,
&delta);
view->ConvertFromScreenForDrawing(&location);
view->CurrentState()->SetPenLocation(location);
context->ConvertFromScreenForDrawing(&location);
context->CurrentState()->SetPenLocation(location);
// the DrawingEngine/Painter does not need to be updated, since this
// effects only the view->screen coord conversion, which is handled
// by the view only
@@ -492,7 +492,7 @@ draw_string(DrawingContext* view, const char* string, float deltaSpace,
static void
draw_pixels(DrawingContext* view, BRect src, BRect dest, int32 width,
draw_pixels(DrawingContext* context, BRect src, BRect dest, int32 width,
int32 height, int32 bytesPerRow, int32 pixelFormat, int32 options,
const void* data)
{
@@ -504,44 +504,45 @@ draw_pixels(DrawingContext* view, BRect src, BRect dest, int32 width,
memcpy(bitmap.Bits(), data, height * bytesPerRow);
view->ConvertToScreenForDrawing(&dest);
view->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest, options);
context->ConvertToScreenForDrawing(&dest);
context->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest, options);
}
static void
draw_picture(DrawingContext* view, BPoint where, int32 token)
draw_picture(DrawingContext* context, BPoint where, int32 token)
{
ServerPicture* picture = view->GetPicture(token);
ServerPicture* picture = context->GetPicture(token);
if (picture != NULL) {
view->PushState();
view->SetDrawingOrigin(where);
context->PushState();
context->SetDrawingOrigin(where);
view->PushState();
picture->Play(view);
view->PopState();
context->PushState();
picture->Play(context);
context->PopState();
view->PopState();
context->PopState();
picture->ReleaseReference();
}
}
static void
set_clipping_rects(DrawingContext* view, const BRect* rects, uint32 numRects)
set_clipping_rects(DrawingContext* context, const BRect* rects,
uint32 numRects)
{
// TODO: This might be too slow, we should copy the rects
// directly to BRegion's internal data
BRegion region;
for (uint32 c = 0; c < numRects; c++)
region.Include(rects[c]);
view->SetUserClipping(&region);
view->UpdateCurrentDrawingRegion();
context->SetUserClipping(&region);
context->UpdateCurrentDrawingRegion();
}
static void
clip_to_picture(DrawingContext* view, BPicture* picture, BPoint pt,
clip_to_picture(DrawingContext* context, BPicture* picture, BPoint pt,
bool clipToInverse)
{
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n",
@@ -550,63 +551,63 @@ clip_to_picture(DrawingContext* view, BPicture* picture, BPoint pt,
static void
push_state(DrawingContext* view)
push_state(DrawingContext* context)
{
view->PushState();
context->PushState();
}
static void
pop_state(DrawingContext* view)
pop_state(DrawingContext* context)
{
view->PopState();
context->PopState();
BPoint p(0, 0);
view->ConvertToScreenForDrawing(&p);
view->GetDrawingEngine()->SetDrawState(view->CurrentState(), (int32)p.x,
(int32)p.y);
context->ConvertToScreenForDrawing(&p);
context->GetDrawingEngine()->SetDrawState(context->CurrentState(),
(int32)p.x, (int32)p.y);
}
// TODO: Be smart and actually take advantage of these methods:
// only apply state changes when they are called
static void
enter_state_change(DrawingContext* view)
enter_state_change(DrawingContext* context)
{
}
static void
exit_state_change(DrawingContext* view)
exit_state_change(DrawingContext* context)
{
view->ResyncDrawState();
context->ResyncDrawState();
}
static void
enter_font_state(DrawingContext* view)
enter_font_state(DrawingContext* context)
{
}
static void
exit_font_state(DrawingContext* view)
exit_font_state(DrawingContext* context)
{
view->GetDrawingEngine()->SetFont(view->CurrentState()->Font());
context->GetDrawingEngine()->SetFont(context->CurrentState()->Font());
}
static void
set_origin(DrawingContext* view, BPoint pt)
set_origin(DrawingContext* context, BPoint pt)
{
view->CurrentState()->SetOrigin(pt);
context->CurrentState()->SetOrigin(pt);
}
static void
set_pen_location(DrawingContext* view, BPoint pt)
set_pen_location(DrawingContext* context, BPoint pt)
{
view->CurrentState()->SetPenLocation(pt);
context->CurrentState()->SetPenLocation(pt);
// the DrawingEngine/Painter does not need to be updated, since this
// effects only the view->screen coord conversion, which is handled
// by the view only
@@ -614,64 +615,65 @@ set_pen_location(DrawingContext* view, BPoint pt)
static void
set_drawing_mode(DrawingContext* view, drawing_mode mode)
set_drawing_mode(DrawingContext* context, drawing_mode mode)
{
view->CurrentState()->SetDrawingMode(mode);
view->GetDrawingEngine()->SetDrawingMode(mode);
context->CurrentState()->SetDrawingMode(mode);
context->GetDrawingEngine()->SetDrawingMode(mode);
}
static void
set_line_mode(DrawingContext* view, cap_mode capMode, join_mode joinMode,
set_line_mode(DrawingContext* context, cap_mode capMode, join_mode joinMode,
float miterLimit)
{
DrawState* state = view->CurrentState();
DrawState* state = context->CurrentState();
state->SetLineCapMode(capMode);
state->SetLineJoinMode(joinMode);
state->SetMiterLimit(miterLimit);
view->GetDrawingEngine()->SetStrokeMode(capMode, joinMode, miterLimit);
context->GetDrawingEngine()->SetStrokeMode(capMode, joinMode, miterLimit);
}
static void
set_pen_size(DrawingContext* view, float size)
set_pen_size(DrawingContext* context, float size)
{
view->CurrentState()->SetPenSize(size);
view->GetDrawingEngine()->SetPenSize(view->CurrentState()->PenSize());
context->CurrentState()->SetPenSize(size);
context->GetDrawingEngine()->SetPenSize(
context->CurrentState()->PenSize());
// DrawState::PenSize() returns the scaled pen size, so we
// need to use that value to set the drawing engine pen size.
}
static void
set_fore_color(DrawingContext* view, rgb_color color)
set_fore_color(DrawingContext* context, rgb_color color)
{
view->CurrentState()->SetHighColor(color);
view->GetDrawingEngine()->SetHighColor(color);
context->CurrentState()->SetHighColor(color);
context->GetDrawingEngine()->SetHighColor(color);
}
static void
set_back_color(DrawingContext* view, rgb_color color)
set_back_color(DrawingContext* context, rgb_color color)
{
view->CurrentState()->SetLowColor(color);
view->GetDrawingEngine()->SetLowColor(color);
context->CurrentState()->SetLowColor(color);
context->GetDrawingEngine()->SetLowColor(color);
}
static void
set_stipple_pattern(DrawingContext* view, pattern p)
set_stipple_pattern(DrawingContext* context, pattern p)
{
view->CurrentState()->SetPattern(Pattern(p));
view->GetDrawingEngine()->SetPattern(p);
context->CurrentState()->SetPattern(Pattern(p));
context->GetDrawingEngine()->SetPattern(p);
}
static void
set_scale(DrawingContext* view, float scale)
set_scale(DrawingContext* context, float scale)
{
view->CurrentState()->SetScale(scale);
view->ResyncDrawState();
context->CurrentState()->SetScale(scale);
context->ResyncDrawState();
// Update the drawing engine draw state, since some stuff
// (for example the pen size) needs to be recalculated.
@@ -679,94 +681,94 @@ set_scale(DrawingContext* view, float scale)
static void
set_font_family(DrawingContext* view, const char* family)
set_font_family(DrawingContext* context, const char* family)
{
FontStyle* fontStyle = gFontManager->GetStyleByIndex(family, 0);
ServerFont font;
font.SetStyle(fontStyle);
view->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
context->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
}
static void
set_font_style(DrawingContext* view, const char* style)
set_font_style(DrawingContext* context, const char* style)
{
ServerFont font(view->CurrentState()->Font());
ServerFont font(context->CurrentState()->Font());
FontStyle* fontStyle = gFontManager->GetStyle(font.Family(), style);
font.SetStyle(fontStyle);
view->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
context->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
}
static void
set_font_spacing(DrawingContext* view, int32 spacing)
set_font_spacing(DrawingContext* context, int32 spacing)
{
ServerFont font;
font.SetSpacing(spacing);
view->CurrentState()->SetFont(font, B_FONT_SPACING);
context->CurrentState()->SetFont(font, B_FONT_SPACING);
}
static void
set_font_size(DrawingContext* view, float size)
set_font_size(DrawingContext* context, float size)
{
ServerFont font;
font.SetSize(size);
view->CurrentState()->SetFont(font, B_FONT_SIZE);
context->CurrentState()->SetFont(font, B_FONT_SIZE);
}
static void
set_font_rotate(DrawingContext* view, float rotation)
set_font_rotate(DrawingContext* context, float rotation)
{
ServerFont font;
font.SetRotation(rotation);
view->CurrentState()->SetFont(font, B_FONT_ROTATION);
context->CurrentState()->SetFont(font, B_FONT_ROTATION);
}
static void
set_font_encoding(DrawingContext* view, int32 encoding)
set_font_encoding(DrawingContext* context, int32 encoding)
{
ServerFont font;
font.SetEncoding(encoding);
view->CurrentState()->SetFont(font, B_FONT_ENCODING);
context->CurrentState()->SetFont(font, B_FONT_ENCODING);
}
static void
set_font_flags(DrawingContext* view, int32 flags)
set_font_flags(DrawingContext* context, int32 flags)
{
ServerFont font;
font.SetFlags(flags);
view->CurrentState()->SetFont(font, B_FONT_FLAGS);
context->CurrentState()->SetFont(font, B_FONT_FLAGS);
}
static void
set_font_shear(DrawingContext* view, float shear)
set_font_shear(DrawingContext* context, float shear)
{
ServerFont font;
font.SetShear(shear);
view->CurrentState()->SetFont(font, B_FONT_SHEAR);
context->CurrentState()->SetFont(font, B_FONT_SHEAR);
}
static void
set_font_face(DrawingContext* view, int32 face)
set_font_face(DrawingContext* context, int32 face)
{
ServerFont font;
font.SetFace(face);
view->CurrentState()->SetFont(font, B_FONT_FACE);
context->CurrentState()->SetFont(font, B_FONT_FACE);
}
static void
set_blending_mode(DrawingContext* view, int16 alphaSrcMode, int16 alphaFncMode)
set_blending_mode(DrawingContext* context, int16 alphaSrcMode, int16 alphaFncMode)
{
view->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode,
context->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode,
(alpha_function)alphaFncMode);
}
-10
View File
@@ -150,16 +150,6 @@ View::~View()
}
status_t
View::InitCheck() const
{
if (fDrawState == NULL)
return B_NO_MEMORY;
return B_OK;
}
IntRect
View::Bounds() const
{
-1
View File
@@ -43,7 +43,6 @@ class View: public DrawingContext {
const char* name, int32 token,
uint32 resizeMode, uint32 flags);
virtual ~View();
status_t InitCheck() const;
int32 Token() const
{ return fToken; }