Fixed some coding style violations
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31657 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -38,22 +38,22 @@
|
|||||||
using std::stack;
|
using std::stack;
|
||||||
|
|
||||||
class ShapePainter : public BShapeIterator {
|
class ShapePainter : public BShapeIterator {
|
||||||
public:
|
public:
|
||||||
ShapePainter();
|
ShapePainter();
|
||||||
virtual ~ShapePainter();
|
virtual ~ShapePainter();
|
||||||
|
|
||||||
status_t Iterate(const BShape *shape);
|
status_t Iterate(const BShape *shape);
|
||||||
|
|
||||||
virtual status_t IterateMoveTo(BPoint *point);
|
virtual status_t IterateMoveTo(BPoint *point);
|
||||||
virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts);
|
virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts);
|
||||||
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
|
virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts);
|
||||||
virtual status_t IterateClose();
|
virtual status_t IterateClose();
|
||||||
|
|
||||||
void Draw(View *view, BRect frame, bool filled);
|
void Draw(View *view, BRect frame, bool filled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
stack<uint32> fOpStack;
|
stack<uint32> fOpStack;
|
||||||
stack<BPoint> fPtStack;
|
stack<BPoint> fPtStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -148,8 +148,8 @@ ShapePainter::Draw(View *view, BRect frame, bool filled)
|
|||||||
view->ConvertToScreenForDrawing(&ptList[i]);
|
view->ConvertToScreenForDrawing(&ptList[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
view->Window()->GetDrawingEngine()->DrawShape(frame, opCount, opList, ptCount, ptList,
|
view->Window()->GetDrawingEngine()->DrawShape(frame, opCount,
|
||||||
filled);
|
opList, ptCount, ptList, filled);
|
||||||
|
|
||||||
delete[] opList;
|
delete[] opList;
|
||||||
delete[] ptList;
|
delete[] ptList;
|
||||||
@@ -161,29 +161,29 @@ ShapePainter::Draw(View *view, BRect frame, bool filled)
|
|||||||
static void
|
static void
|
||||||
get_polygon_frame(const BPoint *points, int32 numPoints, BRect *_frame)
|
get_polygon_frame(const BPoint *points, int32 numPoints, BRect *_frame)
|
||||||
{
|
{
|
||||||
float l, t, r, b;
|
|
||||||
|
|
||||||
ASSERT(numPoints > 0);
|
ASSERT(numPoints > 0);
|
||||||
|
|
||||||
l = r = points->x;
|
float left = points->x;
|
||||||
t = b = points->y;
|
float top = points->y;
|
||||||
|
float right = left;
|
||||||
|
float bottom = top;
|
||||||
|
|
||||||
points++;
|
points++;
|
||||||
numPoints--;
|
numPoints--;
|
||||||
|
|
||||||
while (numPoints--) {
|
while (numPoints--) {
|
||||||
if (points->x < l)
|
if (points->x < left)
|
||||||
l = points->x;
|
left = points->x;
|
||||||
if (points->x > r)
|
if (points->x > right)
|
||||||
r = points->x;
|
right = points->x;
|
||||||
if (points->y < t)
|
if (points->y < top)
|
||||||
t = points->y;
|
top = points->y;
|
||||||
if (points->y > b)
|
if (points->y > bottom)
|
||||||
b = points->y;
|
bottom = points->y;
|
||||||
points++;
|
points++;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame->Set(l, t, r, b);
|
_frame->Set(left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -196,7 +196,8 @@ nop()
|
|||||||
static void
|
static void
|
||||||
move_pen_by(View *view, BPoint delta)
|
move_pen_by(View *view, BPoint delta)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetPenLocation(view->CurrentState()->PenLocation() + delta);
|
view->CurrentState()->SetPenLocation(
|
||||||
|
view->CurrentState()->PenLocation() + delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -236,8 +237,8 @@ static void
|
|||||||
stroke_round_rect(View *view, BRect rect, BPoint radii)
|
stroke_round_rect(View *view, BRect rect, BPoint radii)
|
||||||
{
|
{
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y,
|
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x,
|
||||||
false);
|
radii.y, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -245,8 +246,8 @@ static void
|
|||||||
fill_round_rect(View *view, BRect rect, BPoint radii)
|
fill_round_rect(View *view, BRect rect, BPoint radii)
|
||||||
{
|
{
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x, radii.y,
|
view->Window()->GetDrawingEngine()->DrawRoundRect(rect, radii.x,
|
||||||
true);
|
radii.y, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -274,10 +275,11 @@ static void
|
|||||||
stroke_arc(View *view, BPoint center, BPoint radii, float startTheta,
|
stroke_arc(View *view, BPoint center, BPoint radii, float startTheta,
|
||||||
float arcTheta)
|
float arcTheta)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y,
|
||||||
center.y + radii.y - 1);
|
center.x + radii.x - 1, center.y + radii.y - 1);
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, false);
|
view->Window()->GetDrawingEngine()->DrawArc(rect, startTheta,
|
||||||
|
arcTheta, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -285,18 +287,19 @@ static void
|
|||||||
fill_arc(View *view, BPoint center, BPoint radii, float startTheta,
|
fill_arc(View *view, BPoint center, BPoint radii, float startTheta,
|
||||||
float arcTheta)
|
float arcTheta)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y,
|
||||||
center.y + radii.y - 1);
|
center.x + radii.x - 1, center.y + radii.y - 1);
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, true);
|
view->Window()->GetDrawingEngine()->DrawArc(rect, startTheta,
|
||||||
|
arcTheta, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stroke_ellipse(View *view, BPoint center, BPoint radii)
|
stroke_ellipse(View *view, BPoint center, BPoint radii)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y,
|
||||||
center.y + radii.y - 1);
|
center.x + radii.x - 1, center.y + radii.y - 1);
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawEllipse(rect, false);
|
view->Window()->GetDrawingEngine()->DrawEllipse(rect, false);
|
||||||
}
|
}
|
||||||
@@ -305,8 +308,8 @@ stroke_ellipse(View *view, BPoint center, BPoint radii)
|
|||||||
static void
|
static void
|
||||||
fill_ellipse(View *view, BPoint center, BPoint radii)
|
fill_ellipse(View *view, BPoint center, BPoint radii)
|
||||||
{
|
{
|
||||||
BRect rect(center.x - radii.x, center.y - radii.y, center.x + radii.x - 1,
|
BRect rect(center.x - radii.x, center.y - radii.y,
|
||||||
center.y + radii.y - 1);
|
center.x + radii.x - 1, center.y + radii.y - 1);
|
||||||
view->ConvertToScreenForDrawing(&rect);
|
view->ConvertToScreenForDrawing(&rect);
|
||||||
view->Window()->GetDrawingEngine()->DrawEllipse(rect, true);
|
view->Window()->GetDrawingEngine()->DrawEllipse(rect, true);
|
||||||
}
|
}
|
||||||
@@ -320,7 +323,8 @@ stroke_polygon(View *view, int32 numPoints, const BPoint *viewPoints,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (numPoints <= 200) {
|
if (numPoints <= 200) {
|
||||||
// fast path: no malloc/free, also avoid constructor/destructor calls
|
// fast path: no malloc/free, also avoid
|
||||||
|
// constructor/destructor calls
|
||||||
char data[200 * sizeof(BPoint)];
|
char data[200 * sizeof(BPoint)];
|
||||||
BPoint *points = (BPoint *)data;
|
BPoint *points = (BPoint *)data;
|
||||||
|
|
||||||
@@ -329,10 +333,11 @@ stroke_polygon(View *view, int32 numPoints, const BPoint *viewPoints,
|
|||||||
BRect polyFrame;
|
BRect polyFrame;
|
||||||
get_polygon_frame(points, numPoints, &polyFrame);
|
get_polygon_frame(points, numPoints, &polyFrame);
|
||||||
|
|
||||||
view->Window()->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
|
view->Window()->GetDrawingEngine()->DrawPolygon(points,
|
||||||
false, isClosed && numPoints > 2);
|
numPoints, polyFrame, false, isClosed && numPoints > 2);
|
||||||
} else {
|
} else {
|
||||||
// avoid constructor/destructor calls by using malloc instead of new []
|
// avoid constructor/destructor calls by
|
||||||
|
// using malloc instead of new []
|
||||||
BPoint *points = (BPoint *)malloc(numPoints * sizeof(BPoint));
|
BPoint *points = (BPoint *)malloc(numPoints * sizeof(BPoint));
|
||||||
if (!points)
|
if (!points)
|
||||||
return;
|
return;
|
||||||
@@ -342,8 +347,8 @@ stroke_polygon(View *view, int32 numPoints, const BPoint *viewPoints,
|
|||||||
BRect polyFrame;
|
BRect polyFrame;
|
||||||
get_polygon_frame(points, numPoints, &polyFrame);
|
get_polygon_frame(points, numPoints, &polyFrame);
|
||||||
|
|
||||||
view->Window()->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
|
view->Window()->GetDrawingEngine()->DrawPolygon(points,
|
||||||
false, isClosed && numPoints > 2);
|
numPoints, polyFrame, false, isClosed && numPoints > 2);
|
||||||
free(points);
|
free(points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,7 +361,8 @@ fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (numPoints <= 200) {
|
if (numPoints <= 200) {
|
||||||
// fast path: no malloc/free, also avoid constructor/destructor calls
|
// fast path: no malloc/free, also avoid
|
||||||
|
// constructor/destructor calls
|
||||||
char data[200 * sizeof(BPoint)];
|
char data[200 * sizeof(BPoint)];
|
||||||
BPoint *points = (BPoint *)data;
|
BPoint *points = (BPoint *)data;
|
||||||
|
|
||||||
@@ -365,10 +371,11 @@ fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints)
|
|||||||
BRect polyFrame;
|
BRect polyFrame;
|
||||||
get_polygon_frame(points, numPoints, &polyFrame);
|
get_polygon_frame(points, numPoints, &polyFrame);
|
||||||
|
|
||||||
view->Window()->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
|
view->Window()->GetDrawingEngine()->DrawPolygon(points,
|
||||||
true, true);
|
numPoints, polyFrame, true, true);
|
||||||
} else {
|
} else {
|
||||||
// avoid constructor/destructor calls by using malloc instead of new []
|
// avoid constructor/destructor calls by
|
||||||
|
// using malloc instead of new []
|
||||||
BPoint *points = (BPoint *)malloc(numPoints * sizeof(BPoint));
|
BPoint *points = (BPoint *)malloc(numPoints * sizeof(BPoint));
|
||||||
if (!points)
|
if (!points)
|
||||||
return;
|
return;
|
||||||
@@ -378,8 +385,8 @@ fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints)
|
|||||||
BRect polyFrame;
|
BRect polyFrame;
|
||||||
get_polygon_frame(points, numPoints, &polyFrame);
|
get_polygon_frame(points, numPoints, &polyFrame);
|
||||||
|
|
||||||
view->Window()->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
|
view->Window()->GetDrawingEngine()->DrawPolygon(points,
|
||||||
true, true);
|
numPoints, polyFrame, true, true);
|
||||||
free(points);
|
free(points);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,14 +416,15 @@ static void
|
|||||||
draw_string(View *view, const char *string, float deltaSpace,
|
draw_string(View *view, const char *string, float deltaSpace,
|
||||||
float deltaNonSpace)
|
float deltaNonSpace)
|
||||||
{
|
{
|
||||||
// NOTE: the picture data was recorded with a "set pen location" command
|
// NOTE: the picture data was recorded with a "set pen location"
|
||||||
// inserted before the "draw string" command, so we can use PenLocation()
|
// command inserted before the "draw string" command, so we can
|
||||||
|
// use PenLocation()
|
||||||
BPoint location = view->CurrentState()->PenLocation();
|
BPoint location = view->CurrentState()->PenLocation();
|
||||||
|
|
||||||
escapement_delta delta = {deltaSpace, deltaNonSpace };
|
escapement_delta delta = {deltaSpace, deltaNonSpace };
|
||||||
view->ConvertToScreenForDrawing(&location);
|
view->ConvertToScreenForDrawing(&location);
|
||||||
view->Window()->GetDrawingEngine()->DrawString(string, strlen(string),
|
view->Window()->GetDrawingEngine()->DrawString(string,
|
||||||
location, &delta);
|
strlen(string), location, &delta);
|
||||||
|
|
||||||
view->ConvertFromScreenForDrawing(&location);
|
view->ConvertFromScreenForDrawing(&location);
|
||||||
view->CurrentState()->SetPenLocation(location);
|
view->CurrentState()->SetPenLocation(location);
|
||||||
@@ -427,8 +435,9 @@ draw_string(View *view, const char *string, float deltaSpace,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_pixels(View *view, BRect src, BRect dest, int32 width, int32 height,
|
draw_pixels(View *view, BRect src, BRect dest, int32 width,
|
||||||
int32 bytesPerRow, int32 pixelFormat, int32 options, const void *data)
|
int32 height, int32 bytesPerRow, int32 pixelFormat, int32 options,
|
||||||
|
const void *data)
|
||||||
{
|
{
|
||||||
UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1),
|
UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1),
|
||||||
(color_space)pixelFormat, 0, bytesPerRow);
|
(color_space)pixelFormat, 0, bytesPerRow);
|
||||||
@@ -448,7 +457,8 @@ draw_pixels(View *view, BRect src, BRect dest, int32 width, int32 height,
|
|||||||
static void
|
static void
|
||||||
draw_picture(View *view, BPoint where, int32 token)
|
draw_picture(View *view, BPoint where, int32 token)
|
||||||
{
|
{
|
||||||
ServerPicture *picture = view->Window()->ServerWindow()->App()->FindPicture(token);
|
ServerPicture *picture =
|
||||||
|
view->Window()->ServerWindow()->App()->FindPicture(token);
|
||||||
if (picture != NULL) {
|
if (picture != NULL) {
|
||||||
view->SetDrawingOrigin(where);
|
view->SetDrawingOrigin(where);
|
||||||
view->PushState();
|
view->PushState();
|
||||||
@@ -474,8 +484,8 @@ static void
|
|||||||
clip_to_picture(View *view, BPicture *picture, BPoint pt,
|
clip_to_picture(View *view, BPicture *picture, BPoint pt,
|
||||||
bool clip_to_inverse_picture)
|
bool clip_to_inverse_picture)
|
||||||
{
|
{
|
||||||
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n", pt.x, pt.y,
|
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n",
|
||||||
clip_to_inverse_picture ? "inverse" : "");
|
pt.x, pt.y, clip_to_inverse_picture ? "inverse" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -522,7 +532,8 @@ enter_font_state(View *view)
|
|||||||
static void
|
static void
|
||||||
exit_font_state(View *view)
|
exit_font_state(View *view)
|
||||||
{
|
{
|
||||||
view->Window()->GetDrawingEngine()->SetFont(view->CurrentState()->Font());
|
view->Window()->GetDrawingEngine()->SetFont(
|
||||||
|
view->CurrentState()->Font());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -552,13 +563,15 @@ set_drawing_mode(View *view, drawing_mode mode)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_line_mode(View *view, cap_mode capMode, join_mode joinMode, float miterLimit)
|
set_line_mode(View *view, cap_mode capMode, join_mode joinMode,
|
||||||
|
float miterLimit)
|
||||||
{
|
{
|
||||||
DrawState *state = view->CurrentState();
|
DrawState *state = view->CurrentState();
|
||||||
state->SetLineCapMode(capMode);
|
state->SetLineCapMode(capMode);
|
||||||
state->SetLineJoinMode(joinMode);
|
state->SetLineJoinMode(joinMode);
|
||||||
state->SetMiterLimit(miterLimit);
|
state->SetMiterLimit(miterLimit);
|
||||||
view->Window()->GetDrawingEngine()->SetStrokeMode(capMode, joinMode, miterLimit);
|
view->Window()->GetDrawingEngine()->SetStrokeMode(capMode, joinMode,
|
||||||
|
miterLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -566,9 +579,10 @@ static void
|
|||||||
set_pen_size(View *view, float size)
|
set_pen_size(View *view, float size)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetPenSize(size);
|
view->CurrentState()->SetPenSize(size);
|
||||||
view->Window()->GetDrawingEngine()->SetPenSize(view->CurrentState()->PenSize());
|
view->Window()->GetDrawingEngine()->SetPenSize(
|
||||||
// DrawState::PenSize() returns the scaled pen size, so we need to
|
view->CurrentState()->PenSize());
|
||||||
// use that value to set the drawing engine pen size.
|
// DrawState::PenSize() returns the scaled pen size, so we
|
||||||
|
// need to use that value to set the drawing engine pen size.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -602,8 +616,8 @@ set_scale(View *view, float scale)
|
|||||||
view->CurrentState()->SetScale(scale);
|
view->CurrentState()->SetScale(scale);
|
||||||
view->Window()->ServerWindow()->ResyncDrawState();
|
view->Window()->ServerWindow()->ResyncDrawState();
|
||||||
|
|
||||||
// Update the drawing engine draw state, since some stuff (for example
|
// Update the drawing engine draw state, since some stuff
|
||||||
// the pen size) needs to be recalculated.
|
// (for example the pen size) needs to be recalculated.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -611,7 +625,7 @@ static void
|
|||||||
set_font_family(View *view, const char *family)
|
set_font_family(View *view, const char *family)
|
||||||
{
|
{
|
||||||
FontStyle *fontStyle = gFontManager->GetStyle(family, NULL,
|
FontStyle *fontStyle = gFontManager->GetStyle(family, NULL,
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetStyle(fontStyle);
|
font.SetStyle(fontStyle);
|
||||||
view->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
view->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
||||||
@@ -622,7 +636,7 @@ static void
|
|||||||
set_font_style(View *view, const char *style)
|
set_font_style(View *view, const char *style)
|
||||||
{
|
{
|
||||||
FontStyle *fontStyle = gFontManager->GetStyle(NULL, style,
|
FontStyle *fontStyle = gFontManager->GetStyle(NULL, style,
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
font.SetStyle(fontStyle);
|
font.SetStyle(fontStyle);
|
||||||
view->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
view->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
|
||||||
@@ -695,7 +709,8 @@ set_font_face(View *view, int32 face)
|
|||||||
static void
|
static void
|
||||||
set_blending_mode(View *view, int16 alphaSrcMode, int16 alphaFncMode)
|
set_blending_mode(View *view, int16 alphaSrcMode, int16 alphaFncMode)
|
||||||
{
|
{
|
||||||
view->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode, (alpha_function)alphaFncMode);
|
view->CurrentState()->SetBlendingMode((source_alpha)alphaSrcMode,
|
||||||
|
(alpha_function)alphaFncMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -751,7 +766,7 @@ const static void *kTableEntries[] = {
|
|||||||
(const void *)set_font_encoding,
|
(const void *)set_font_encoding,
|
||||||
(const void *)set_font_flags,
|
(const void *)set_font_flags,
|
||||||
(const void *)set_font_shear,
|
(const void *)set_font_shear,
|
||||||
(const void *)reserved, // TODO: Marc Flerackers calls this "set_font_bpp". Investigate
|
(const void *)reserved,
|
||||||
(const void *)set_font_face,
|
(const void *)set_font_face,
|
||||||
(const void *)set_blending_mode
|
(const void *)set_blending_mode
|
||||||
};
|
};
|
||||||
@@ -793,7 +808,8 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
|||||||
if (mallocIO->SetSize(size) < B_OK)
|
if (mallocIO->SetSize(size) < B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()), size);
|
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()),
|
||||||
|
size);
|
||||||
|
|
||||||
PictureDataWriter::SetTo(fData);
|
PictureDataWriter::SetTo(fData);
|
||||||
}
|
}
|
||||||
@@ -814,7 +830,8 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BPrivate::Storage::OffsetFile *offsetFile =
|
BPrivate::Storage::OffsetFile *offsetFile =
|
||||||
new (std::nothrow) BPrivate::Storage::OffsetFile(fFile, (off_t)offset);
|
new (std::nothrow) BPrivate::Storage::OffsetFile(fFile,
|
||||||
|
(off_t)offset);
|
||||||
if (offsetFile == NULL || offsetFile->InitCheck() != B_OK) {
|
if (offsetFile == NULL || offsetFile->InitCheck() != B_OK) {
|
||||||
delete offsetFile;
|
delete offsetFile;
|
||||||
return;
|
return;
|
||||||
@@ -832,8 +849,9 @@ ServerPicture::~ServerPicture()
|
|||||||
delete fFile;
|
delete fFile;
|
||||||
gTokenSpace.RemoveToken(fToken);
|
gTokenSpace.RemoveToken(fToken);
|
||||||
|
|
||||||
// We only delete the subpictures list, not the subpictures themselves,
|
// We only delete the subpictures list, not the subpictures
|
||||||
// since the ServerApp keeps them in a list and will delete them on quit.
|
// themselves, since the ServerApp keeps them in a list and
|
||||||
|
// will delete them on quit.
|
||||||
delete fPictures;
|
delete fPictures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,7 +880,8 @@ ServerPicture::SyncState(View *view)
|
|||||||
WriteSetPenLocation(view->CurrentState()->PenLocation());
|
WriteSetPenLocation(view->CurrentState()->PenLocation());
|
||||||
WriteSetPenSize(view->CurrentState()->PenSize());
|
WriteSetPenSize(view->CurrentState()->PenSize());
|
||||||
WriteSetScale(view->CurrentState()->Scale());
|
WriteSetScale(view->CurrentState()->Scale());
|
||||||
WriteSetLineMode(view->CurrentState()->LineCapMode(), view->CurrentState()->LineJoinMode(),
|
WriteSetLineMode(view->CurrentState()->LineCapMode(),
|
||||||
|
view->CurrentState()->LineJoinMode(),
|
||||||
view->CurrentState()->MiterLimit());
|
view->CurrentState()->MiterLimit());
|
||||||
//WriteSetPattern(*view->CurrentState()->GetPattern().GetInt8());
|
//WriteSetPattern(*view->CurrentState()->GetPattern().GetInt8());
|
||||||
WriteSetDrawingMode(view->CurrentState()->GetDrawingMode());
|
WriteSetDrawingMode(view->CurrentState()->GetDrawingMode());
|
||||||
@@ -945,13 +964,17 @@ ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link)
|
|||||||
void
|
void
|
||||||
ServerPicture::Play(View *view)
|
ServerPicture::Play(View *view)
|
||||||
{
|
{
|
||||||
// TODO: for now: then change PicturePlayer to accept a BPositionIO object
|
// TODO: for now: then change PicturePlayer
|
||||||
|
// to accept a BPositionIO object
|
||||||
BMallocIO *mallocIO = dynamic_cast<BMallocIO *>(fData);
|
BMallocIO *mallocIO = dynamic_cast<BMallocIO *>(fData);
|
||||||
if (mallocIO == NULL)
|
if (mallocIO == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BPrivate::PicturePlayer player(mallocIO->Buffer(), mallocIO->BufferLength(), fPictures);
|
BPrivate::PicturePlayer player(mallocIO->Buffer(),
|
||||||
player.Play(const_cast<void **>(kTableEntries), sizeof(kTableEntries) / sizeof(void *), view);
|
mallocIO->BufferLength(), fPictures);
|
||||||
|
player.Play(const_cast<void **>(kTableEntries),
|
||||||
|
sizeof(kTableEntries) / sizeof(void *), view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1034,7 +1057,8 @@ ServerPicture::ExportData(BPrivate::PortLink &link)
|
|||||||
link.Attach<int32>(subPicturesCount);
|
link.Attach<int32>(subPicturesCount);
|
||||||
if (subPicturesCount > 0) {
|
if (subPicturesCount > 0) {
|
||||||
for (int32 i = 0; i < subPicturesCount; i++) {
|
for (int32 i = 0; i < subPicturesCount; i++) {
|
||||||
ServerPicture *subPic = static_cast<ServerPicture *>(fPictures->ItemAtFast(i));
|
ServerPicture *subPic =
|
||||||
|
static_cast<ServerPicture *>(fPictures->ItemAtFast(i));
|
||||||
link.Attach<int32>(subPic->Token());
|
link.Attach<int32>(subPic->Token());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user