Removed PicturePlayer, it only contains code duplicated from TPicture. Some cleanups for BPicture. This commit also completes previous commit for BMenu

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16002 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-01-17 21:39:07 +00:00
parent ffa2503b55
commit 9e8d2dd28b
6 changed files with 607 additions and 619 deletions
+107 -118
View File
@@ -1,118 +1,107 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS // Copyright (c) 2001-2002, OpenBeOS
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, // the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the // and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: // Software is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included in // The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software. // all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
// File Name: TPicture.h // File Name: TPicture.h
// Author: Marc Flerackers ([email protected]) // Author: Marc Flerackers ([email protected])
// Description: TPicture is used to create and play picture data. // Description: TPicture is used to create and play picture data.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef _TPICTURE_H
#ifndef _TPICTURE_H #define _TPICTURE_H
#define _TPICTURE_H
// Standard Includes ----------------------------------------------------------- #include <GraphicsDefs.h>
#include <Point.h>
// System Includes ------------------------------------------------------------- #include <Rect.h>
#include <GraphicsDefs.h> #include <DataIO.h>
#include <Point.h>
#include <Rect.h>
#include <DataIO.h> class TPicture {
public:
// Project Includes ------------------------------------------------------------ TPicture();
TPicture(void *data, int32 size, BList *pictures);
// Local Includes -------------------------------------------------------------- virtual ~TPicture();
// Local Defines --------------------------------------------------------------- int16 GetOp();
bool GetBool();
// Globals --------------------------------------------------------------------- int16 GetInt8();
int16 GetInt16();
// TPicture class -------------------------------------------------------------- int32 GetInt32();
class TPicture { int64 GetInt64();
public: float GetFloat();
TPicture(); BPoint GetCoord();
TPicture(void *data, int32 size, BList &pictures); BRect GetRect();
virtual ~TPicture(); rgb_color GetColor();
//void GetString(char *);
int16 GetOp();
bool GetBool(); void *GetData(int32);
int16 GetInt8(); void GetData(void *data, int32 size);
int16 GetInt16();
int32 GetInt32(); void AddInt8(int8);
int64 GetInt64(); void AddInt16(int16);
float GetFloat(); void AddInt32(int32);
BPoint GetCoord(); void AddInt64(int64);
BRect GetRect(); void AddFloat(float);
rgb_color GetColor(); void AddCoord(BPoint);
//void GetString(char *); void AddRect(BRect);
void AddColor(rgb_color);
void *GetData(int32); void AddString(char *);
void GetData(void *data, int32 size);
void AddData(void *data, int32 size);
void AddInt8(int8);
void AddInt16(int16); // SwapOp();
void AddInt32(int32); // SwapInt8();
void AddInt64(int64); // SwapInt16();
void AddFloat(float); // SwapInt32();
void AddCoord(BPoint); // SwapInt64();
void AddRect(BRect); // SwapFloat();
void AddColor(rgb_color); // SwapCoord();
void AddString(char *); // SwapRect();
// SwapIRect();
void AddData(void *data, int32 size); // SwapColor();
// SwapString();
// SwapOp();
// SwapInt8(); // Swap();
// SwapInt16();
// SwapInt32(); // CheckPattern();
// SwapInt64();
// SwapFloat(); void BeginOp(int32);
// SwapCoord(); void EndOp();
// SwapRect();
// SwapIRect(); void EnterStateChange();
// SwapColor(); void ExitStateChange();
// SwapString();
void EnterFontChange();
// Swap(); void ExitFontChange();
// CheckPattern(); status_t Play(void **callBackTable, int32 tableEntries,
void *userData);
void BeginOp(int32); status_t Rewind();
void EndOp();
private:
void EnterStateChange(); BMemoryIO fData;
void ExitStateChange(); int32 fSize;
BList *fPictures;
void EnterFontChange(); };
void ExitFontChange(); //------------------------------------------------------------------------------
status_t Play(void **callBackTable, int32 tableEntries, status_t do_playback(void *, long, BList *, void **, long, void *);
void *userData);
status_t Rewind(); #endif // _TPICTURE_H
private:
BMemoryIO fData;
int32 fSize;
BList &fPictures;
};
//------------------------------------------------------------------------------
//status_t do_playback(void *, long, BArray<BPicture *> &, void **, long, void *)
#endif // _TPICTURE_H
+5 -2
View File
@@ -196,11 +196,14 @@ BMenuItem::SetLabel(const char *string)
void void
BMenuItem::SetEnabled(bool state) BMenuItem::SetEnabled(bool state)
{ {
if (fSubmenu != NULL) if (fEnabled == state)
fSubmenu->SetEnabled(state); return;
fEnabled = state; fEnabled = state;
if (fSubmenu != NULL)
fSubmenu->SetEnabled(state);
BMenu *menu = Menu(); BMenu *menu = Menu();
if (menu != NULL && menu->LockLooper()) { if (menu != NULL && menu->LockLooper()) {
menu->Invalidate(fBounds); menu->Invalidate(fBounds);
+3 -6
View File
@@ -71,10 +71,6 @@ private:
}; };
status_t do_playback(void * data, int32 size, BList& pictures,
void **callBackTable, int32 tableEntries, void *user);
BPicture::BPicture() BPicture::BPicture()
: :
token(-1), token(-1),
@@ -265,7 +261,8 @@ BPicture::Play(void **callBackTable, int32 tableEntries, void *user)
if (!assert_local_copy()) if (!assert_local_copy())
return B_ERROR; return B_ERROR;
return do_playback(const_cast<void *>(extent->Data()), extent->Size(), extent->Pictures(), BList &pictures = extent->Pictures();
return do_playback(const_cast<void *>(extent->Data()), extent->Size(), &pictures,
callBackTable, tableEntries, user); callBackTable, tableEntries, user);
} }
@@ -584,7 +581,7 @@ BPicture::step_down()
status_t status_t
do_playback(void * data, int32 size, BList& pictures, do_playback(void * data, int32 size, BList* pictures,
void **callBackTable, int32 tableEntries, void *user) void **callBackTable, int32 tableEntries, void *user)
{ {
TPicture picture(data, size, pictures); TPicture picture(data, size, pictures);
+490 -490
View File
@@ -1,490 +1,490 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS // Copyright (c) 2001-2002, OpenBeOS
// //
// Permission is hereby granted, free of charge, to any person obtaining a // Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"), // copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation // to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, // the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the // and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions: // Software is furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included in // The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software. // all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
// File Name: TPicture.cpp // File Name: TPicture.cpp
// Author: Marc Flerackers ([email protected]) // Author: Marc Flerackers ([email protected])
// Description: TPicture is used to create and play picture data. // Description: TPicture is used to create and play picture data.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Standard Includes ----------------------------------------------------------- // Standard Includes -----------------------------------------------------------
#include <stdio.h> #include <stdio.h>
// System Includes ------------------------------------------------------------- // System Includes -------------------------------------------------------------
#include <TPicture.h> #include <TPicture.h>
#include <PictureProtocol.h> #include <PictureProtocol.h>
// Project Includes ------------------------------------------------------------ // Project Includes ------------------------------------------------------------
// Local Includes -------------------------------------------------------------- // Local Includes --------------------------------------------------------------
// Local Defines --------------------------------------------------------------- // Local Defines ---------------------------------------------------------------
// Globals --------------------------------------------------------------------- // Globals ---------------------------------------------------------------------
typedef void (*fnc)(void*); typedef void (*fnc)(void*);
typedef void (*fnc_BPoint)(void*, BPoint); typedef void (*fnc_BPoint)(void*, BPoint);
typedef void (*fnc_BPointBPoint)(void*, BPoint, BPoint); typedef void (*fnc_BPointBPoint)(void*, BPoint, BPoint);
typedef void (*fnc_BRect)(void*, BRect); typedef void (*fnc_BRect)(void*, BRect);
typedef void (*fnc_BRectBPoint)(void*, BRect, BPoint); typedef void (*fnc_BRectBPoint)(void*, BRect, BPoint);
typedef void (*fnc_PBPoint)(void*, BPoint*); typedef void (*fnc_PBPoint)(void*, BPoint*);
typedef void (*fnc_i)(void*, int32); typedef void (*fnc_i)(void*, int32);
typedef void (*fnc_iPBPointb)(void*, int32, BPoint*, bool); typedef void (*fnc_iPBPointb)(void*, int32, BPoint*, bool);
typedef void (*fnc_iPBPoint)(void*, int32, BPoint*); typedef void (*fnc_iPBPoint)(void*, int32, BPoint*);
typedef void (*fnc_Pc)(void*, char*); typedef void (*fnc_Pc)(void*, char*);
typedef void (*fnc_Pcff)(void*, char*, float, float); typedef void (*fnc_Pcff)(void*, char*, float, float);
typedef void (*fnc_BPointBPointff)(void*, BPoint, BPoint, float, float); typedef void (*fnc_BPointBPointff)(void*, BPoint, BPoint, float, float);
typedef void (*fnc_s)(void*, int16); typedef void (*fnc_s)(void*, int16);
typedef void (*fnc_ssf)(void*, int16, int16, float); typedef void (*fnc_ssf)(void*, int16, int16, float);
typedef void (*fnc_f)(void*, float); typedef void (*fnc_f)(void*, float);
typedef void (*fnc_Color)(void*, rgb_color); typedef void (*fnc_Color)(void*, rgb_color);
typedef void (*fnc_Pattern)(void*, pattern); typedef void (*fnc_Pattern)(void*, pattern);
typedef void (*fnc_PBRecti)(void*, BRect*, int32); typedef void (*fnc_PBRecti)(void*, BRect*, int32);
typedef void (*fnc_DrawPixels)(void *, BRect, BRect, int32, int32, int32, typedef void (*fnc_DrawPixels)(void *, BRect, BRect, int32, int32, int32,
int32, int32, void*); int32, int32, void*);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
TPicture::TPicture(void *data, int32 size, BList &pictures) TPicture::TPicture(void *data, int32 size, BList *pictures)
: fData(data, size), : fData(data, size),
fPictures(pictures) fPictures(pictures)
{ {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
TPicture::~TPicture() TPicture::~TPicture()
{ {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int16 TPicture::GetOp() int16 TPicture::GetOp()
{ {
int16 data; int16 data;
fData.Read(&data, sizeof(int16)); fData.Read(&data, sizeof(int16));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool TPicture::GetBool() bool TPicture::GetBool()
{ {
bool data; bool data;
fData.Read(&data, sizeof(bool)); fData.Read(&data, sizeof(bool));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int16 TPicture::GetInt16() int16 TPicture::GetInt16()
{ {
int16 data; int16 data;
fData.Read(&data, sizeof(int16)); fData.Read(&data, sizeof(int16));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int32 TPicture::GetInt32() int32 TPicture::GetInt32()
{ {
int32 data; int32 data;
fData.Read(&data, sizeof(int32)); fData.Read(&data, sizeof(int32));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
float TPicture::GetFloat() float TPicture::GetFloat()
{ {
float data; float data;
fData.Read(&data, sizeof(float)); fData.Read(&data, sizeof(float));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
BPoint TPicture::GetCoord() BPoint TPicture::GetCoord()
{ {
BPoint data; BPoint data;
fData.Read(&data, sizeof(BPoint)); fData.Read(&data, sizeof(BPoint));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
BRect TPicture::GetRect() BRect TPicture::GetRect()
{ {
BRect data; BRect data;
fData.Read(&data, sizeof(BRect)); fData.Read(&data, sizeof(BRect));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
rgb_color TPicture::GetColor() rgb_color TPicture::GetColor()
{ {
rgb_color data; rgb_color data;
fData.Read(&data, sizeof(rgb_color)); fData.Read(&data, sizeof(rgb_color));
return data; return data;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TPicture::GetData(void *data, int32 size) void TPicture::GetData(void *data, int32 size)
{ {
fData.Read(data, size); fData.Read(data, size);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
status_t TPicture::Play(void **callBackTable, int32 tableEntries, status_t TPicture::Play(void **callBackTable, int32 tableEntries,
void *userData) void *userData)
{ {
// TODO: we should probably check if the functions in the table are not 0 // TODO: we should probably check if the functions in the table are not 0
// before calling them. // before calling them.
int16 op=0; int16 op=0;
int32 size=0; int32 size=0;
off_t pos=0; off_t pos=0;
while (fData.Position() < size) while (fData.Position() < size)
{ {
op = GetOp(); op = GetOp();
size = GetInt32(); size = GetInt32();
pos = fData.Position(); pos = fData.Position();
switch (op) switch (op)
{ {
case B_PIC_MOVE_PEN_BY: case B_PIC_MOVE_PEN_BY:
{ {
BPoint where = GetCoord(); BPoint where = GetCoord();
((fnc_BPoint)callBackTable[1])(userData, where); ((fnc_BPoint)callBackTable[1])(userData, where);
break; break;
} }
case B_PIC_STROKE_LINE: case B_PIC_STROKE_LINE:
{ {
BPoint start = GetCoord(); BPoint start = GetCoord();
BPoint end = GetCoord(); BPoint end = GetCoord();
((fnc_BPointBPoint)callBackTable[2])(userData, start, end); ((fnc_BPointBPoint)callBackTable[2])(userData, start, end);
break; break;
} }
case B_PIC_STROKE_RECT: case B_PIC_STROKE_RECT:
{ {
BRect rect = GetRect(); BRect rect = GetRect();
((fnc_BRect)callBackTable[3])(userData, rect); ((fnc_BRect)callBackTable[3])(userData, rect);
break; break;
} }
case B_PIC_FILL_RECT: case B_PIC_FILL_RECT:
{ {
BRect rect = GetRect(); BRect rect = GetRect();
((fnc_BRect)callBackTable[4])(userData, rect); ((fnc_BRect)callBackTable[4])(userData, rect);
break; break;
} }
case B_PIC_STROKE_ROUND_RECT: case B_PIC_STROKE_ROUND_RECT:
{ {
BRect rect = GetRect(); BRect rect = GetRect();
BPoint radii = GetCoord(); BPoint radii = GetCoord();
((fnc_BRectBPoint)callBackTable[5])(userData, rect, radii); ((fnc_BRectBPoint)callBackTable[5])(userData, rect, radii);
break; break;
} }
case B_PIC_FILL_ROUND_RECT: case B_PIC_FILL_ROUND_RECT:
{ {
BRect rect = GetRect(); BRect rect = GetRect();
BPoint radii = GetCoord(); BPoint radii = GetCoord();
((fnc_BRectBPoint)callBackTable[6])(userData, rect, radii); ((fnc_BRectBPoint)callBackTable[6])(userData, rect, radii);
break; break;
} }
case B_PIC_STROKE_BEZIER: case B_PIC_STROKE_BEZIER:
{ {
BPoint control[4]; BPoint control[4];
GetData(control, sizeof(control)); GetData(control, sizeof(control));
((fnc_PBPoint)callBackTable[7])(userData, control); ((fnc_PBPoint)callBackTable[7])(userData, control);
break; break;
} }
case B_PIC_FILL_BEZIER: case B_PIC_FILL_BEZIER:
{ {
BPoint control[4]; BPoint control[4];
GetData(control, sizeof(control)); GetData(control, sizeof(control));
((fnc_PBPoint)callBackTable[8])(userData, control); ((fnc_PBPoint)callBackTable[8])(userData, control);
break; break;
} }
case B_PIC_STROKE_POLYGON: case B_PIC_STROKE_POLYGON:
{ {
int32 numPoints = GetInt32(); int32 numPoints = GetInt32();
BPoint *points = new BPoint[numPoints]; BPoint *points = new BPoint[numPoints];
GetData(points, numPoints * sizeof(BPoint)); GetData(points, numPoints * sizeof(BPoint));
bool isClosed = GetBool(); bool isClosed = GetBool();
((fnc_iPBPointb)callBackTable[13])(userData, numPoints, points, isClosed); ((fnc_iPBPointb)callBackTable[13])(userData, numPoints, points, isClosed);
delete points; delete points;
break; break;
} }
case B_PIC_FILL_POLYGON: case B_PIC_FILL_POLYGON:
{ {
int32 numPoints = GetInt32(); int32 numPoints = GetInt32();
BPoint *points = new BPoint[numPoints]; BPoint *points = new BPoint[numPoints];
GetData(points, numPoints * sizeof(BPoint)); GetData(points, numPoints * sizeof(BPoint));
((fnc_iPBPoint)callBackTable[14])(userData, numPoints, points); ((fnc_iPBPoint)callBackTable[14])(userData, numPoints, points);
delete points; delete points;
break; break;
} }
case B_PIC_STROKE_SHAPE: case B_PIC_STROKE_SHAPE:
case B_PIC_FILL_SHAPE: case B_PIC_FILL_SHAPE:
break; break;
case B_PIC_DRAW_STRING: case B_PIC_DRAW_STRING:
{ {
int32 len = GetInt32(); int32 len = GetInt32();
char *string = new char[len + 1]; char *string = new char[len + 1];
GetData(string, len); GetData(string, len);
string[len] = '\0'; string[len] = '\0';
float deltax = GetFloat(); float deltax = GetFloat();
float deltay = GetFloat(); float deltay = GetFloat();
((fnc_Pcff)callBackTable[17])(userData, string, deltax, deltay); ((fnc_Pcff)callBackTable[17])(userData, string, deltax, deltay);
delete string; delete string;
break; break;
} }
case B_PIC_DRAW_PIXELS: case B_PIC_DRAW_PIXELS:
{ {
BRect src = GetRect(); BRect src = GetRect();
BRect dest = GetRect(); BRect dest = GetRect();
int32 width = GetInt32(); int32 width = GetInt32();
int32 height = GetInt32(); int32 height = GetInt32();
int32 bytesPerRow = GetInt32(); int32 bytesPerRow = GetInt32();
int32 pixelFormat = GetInt32(); int32 pixelFormat = GetInt32();
int32 flags = GetInt32(); int32 flags = GetInt32();
char *data = new char[size - (fData.Position() - pos)]; char *data = new char[size - (fData.Position() - pos)];
GetData(data, size - (fData.Position() - pos)); GetData(data, size - (fData.Position() - pos));
((fnc_DrawPixels)callBackTable[18])(userData, src, dest, ((fnc_DrawPixels)callBackTable[18])(userData, src, dest,
width, height, bytesPerRow, pixelFormat, flags, data); width, height, bytesPerRow, pixelFormat, flags, data);
delete data; delete data;
break; break;
} }
case B_PIC_DRAW_PICTURE: case B_PIC_DRAW_PICTURE:
{ {
break; break;
} }
case B_PIC_STROKE_ARC: case B_PIC_STROKE_ARC:
{ {
BPoint center = GetCoord(); BPoint center = GetCoord();
BPoint radii = GetCoord(); BPoint radii = GetCoord();
float startTheta = GetFloat(); float startTheta = GetFloat();
float arcTheta = GetFloat(); float arcTheta = GetFloat();
((fnc_BPointBPointff)callBackTable[9])(userData, center, radii, ((fnc_BPointBPointff)callBackTable[9])(userData, center, radii,
startTheta, arcTheta); startTheta, arcTheta);
break; break;
} }
case B_PIC_FILL_ARC: case B_PIC_FILL_ARC:
{ {
BPoint center = GetCoord(); BPoint center = GetCoord();
BPoint radii = GetCoord(); BPoint radii = GetCoord();
float startTheta = GetFloat(); float startTheta = GetFloat();
float arcTheta = GetFloat(); float arcTheta = GetFloat();
((fnc_BPointBPointff)callBackTable[10])(userData, center, radii, ((fnc_BPointBPointff)callBackTable[10])(userData, center, radii,
startTheta, arcTheta); startTheta, arcTheta);
break; break;
} }
case B_PIC_STROKE_ELLIPSE: case B_PIC_STROKE_ELLIPSE:
{ {
BRect rect = GetRect(); BRect rect = GetRect();
BPoint center; BPoint center;
BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f); BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f);
center = rect.LeftTop() + radii; center = rect.LeftTop() + radii;
((fnc_BPointBPoint)callBackTable[11])(userData, center, radii); ((fnc_BPointBPoint)callBackTable[11])(userData, center, radii);
break; break;
} }
case B_PIC_FILL_ELLIPSE: case B_PIC_FILL_ELLIPSE:
{ {
BRect rect = GetRect(); BRect rect = GetRect();
BPoint center; BPoint center;
BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f); BPoint radii((rect.Width() + 1) / 2.0f, (rect.Height() + 1) / 2.0f);
center = rect.LeftTop() + radii; center = rect.LeftTop() + radii;
((fnc_BPointBPoint)callBackTable[12])(userData, center, radii); ((fnc_BPointBPoint)callBackTable[12])(userData, center, radii);
break; break;
} }
case B_PIC_ENTER_STATE_CHANGE: case B_PIC_ENTER_STATE_CHANGE:
{ {
break; break;
} }
case B_PIC_SET_CLIPPING_RECTS: case B_PIC_SET_CLIPPING_RECTS:
{ {
break; break;
} }
case B_PIC_CLIP_TO_PICTURE: case B_PIC_CLIP_TO_PICTURE:
{ {
break; break;
} }
case B_PIC_PUSH_STATE: case B_PIC_PUSH_STATE:
{ {
((fnc)callBackTable[22])(userData); ((fnc)callBackTable[22])(userData);
break; break;
} }
case B_PIC_POP_STATE: case B_PIC_POP_STATE:
{ {
((fnc)callBackTable[23])(userData); ((fnc)callBackTable[23])(userData);
break; break;
} }
case B_PIC_CLEAR_CLIPPING_RECTS: case B_PIC_CLEAR_CLIPPING_RECTS:
{ {
((fnc_PBRecti)callBackTable[20])(userData, NULL, 0); ((fnc_PBRecti)callBackTable[20])(userData, NULL, 0);
break; break;
} }
case B_PIC_SET_ORIGIN: case B_PIC_SET_ORIGIN:
{ {
BPoint pt = GetCoord(); BPoint pt = GetCoord();
((fnc_BPoint)callBackTable[28])(userData, pt); ((fnc_BPoint)callBackTable[28])(userData, pt);
break; break;
} }
case B_PIC_SET_PEN_LOCATION: case B_PIC_SET_PEN_LOCATION:
{ {
BPoint pt = GetCoord(); BPoint pt = GetCoord();
((fnc_BPoint)callBackTable[29])(userData, pt); ((fnc_BPoint)callBackTable[29])(userData, pt);
break; break;
} }
case B_PIC_SET_DRAWING_MODE: case B_PIC_SET_DRAWING_MODE:
{ {
int16 mode = GetInt16(); int16 mode = GetInt16();
((fnc_s)callBackTable[30])(userData, mode); ((fnc_s)callBackTable[30])(userData, mode);
break; break;
} }
case B_PIC_SET_LINE_MODE: case B_PIC_SET_LINE_MODE:
{ {
int16 capMode = GetInt16(); int16 capMode = GetInt16();
int16 joinMode = GetInt16(); int16 joinMode = GetInt16();
float miterLimit = GetFloat(); float miterLimit = GetFloat();
((fnc_ssf)callBackTable[31])(userData, capMode, joinMode, miterLimit); ((fnc_ssf)callBackTable[31])(userData, capMode, joinMode, miterLimit);
break; break;
} }
case B_PIC_SET_PEN_SIZE: case B_PIC_SET_PEN_SIZE:
{ {
float size = GetFloat(); float size = GetFloat();
((fnc_f)callBackTable[32])(userData, size); ((fnc_f)callBackTable[32])(userData, size);
break; break;
} }
case B_PIC_SET_SCALE: case B_PIC_SET_SCALE:
{ {
float scale = GetFloat(); float scale = GetFloat();
((fnc_f)callBackTable[36])(userData, scale); ((fnc_f)callBackTable[36])(userData, scale);
break; break;
} }
case B_PIC_SET_FORE_COLOR: case B_PIC_SET_FORE_COLOR:
{ {
rgb_color color = GetColor(); rgb_color color = GetColor();
((fnc_Color)callBackTable[33])(userData, color); ((fnc_Color)callBackTable[33])(userData, color);
break; break;
} }
case B_PIC_SET_BACK_COLOR: case B_PIC_SET_BACK_COLOR:
{ {
rgb_color color = GetColor(); rgb_color color = GetColor();
((fnc_Color)callBackTable[34])(userData, color); ((fnc_Color)callBackTable[34])(userData, color);
break; break;
} }
case B_PIC_SET_STIPLE_PATTERN: case B_PIC_SET_STIPLE_PATTERN:
{ {
pattern p; pattern p;
GetData(&p, sizeof(p)); GetData(&p, sizeof(p));
((fnc_Pattern)callBackTable[35])(userData, p); ((fnc_Pattern)callBackTable[35])(userData, p);
break; break;
} }
case B_PIC_ENTER_FONT_STATE: case B_PIC_ENTER_FONT_STATE:
{ {
((fnc)callBackTable[26])(userData); ((fnc)callBackTable[26])(userData);
break; break;
} }
case B_PIC_SET_BLENDING_MODE: case B_PIC_SET_BLENDING_MODE:
{ {
//int16 alphaSrcMode = GetInt16(); //int16 alphaSrcMode = GetInt16();
//int16 alphaFncMode = GetInt16(); //int16 alphaFncMode = GetInt16();
//((fnc_Pattern)callBackTable[??])(userData, alphaSrcMode, //((fnc_Pattern)callBackTable[??])(userData, alphaSrcMode,
// alphaFncMode); // alphaFncMode);
break; break;
} }
case B_PIC_SET_FONT_FAMILY: case B_PIC_SET_FONT_FAMILY:
{ {
int32 len = GetInt32(); int32 len = GetInt32();
char *string = new char[len + 1]; char *string = new char[len + 1];
GetData(string, len); GetData(string, len);
string[len] = '\0'; string[len] = '\0';
((fnc_Pc)callBackTable[37])(userData, string); ((fnc_Pc)callBackTable[37])(userData, string);
delete string; delete string;
break; break;
} }
case B_PIC_SET_FONT_STYLE: case B_PIC_SET_FONT_STYLE:
{ {
int32 len = GetInt32(); int32 len = GetInt32();
char *string = new char[len + 1]; char *string = new char[len + 1];
GetData(string, len); GetData(string, len);
string[len] = '\0'; string[len] = '\0';
((fnc_Pc)callBackTable[38])(userData, string); ((fnc_Pc)callBackTable[38])(userData, string);
delete string; delete string;
break; break;
} }
case B_PIC_SET_FONT_SPACING: case B_PIC_SET_FONT_SPACING:
{ {
int32 spacing = GetInt32(); int32 spacing = GetInt32();
((fnc_i)callBackTable[39])(userData, spacing); ((fnc_i)callBackTable[39])(userData, spacing);
break; break;
} }
case B_PIC_SET_FONT_ENCODING: case B_PIC_SET_FONT_ENCODING:
{ {
int32 encoding = GetInt32(); int32 encoding = GetInt32();
((fnc_i)callBackTable[42])(userData, encoding); ((fnc_i)callBackTable[42])(userData, encoding);
break; break;
} }
case B_PIC_SET_FONT_FLAGS: case B_PIC_SET_FONT_FLAGS:
{ {
int32 flags = GetInt32(); int32 flags = GetInt32();
((fnc_i)callBackTable[43])(userData, flags); ((fnc_i)callBackTable[43])(userData, flags);
break; break;
} }
case B_PIC_SET_FONT_SIZE: case B_PIC_SET_FONT_SIZE:
{ {
float size = GetFloat(); float size = GetFloat();
((fnc_f)callBackTable[40])(userData, size); ((fnc_f)callBackTable[40])(userData, size);
break; break;
} }
case B_PIC_SET_FONT_ROTATE: case B_PIC_SET_FONT_ROTATE:
{ {
float rotation = GetFloat(); float rotation = GetFloat();
((fnc_f)callBackTable[41])(userData, rotation); ((fnc_f)callBackTable[41])(userData, rotation);
break; break;
} }
case B_PIC_SET_FONT_SHEAR: case B_PIC_SET_FONT_SHEAR:
{ {
float shear = GetFloat(); float shear = GetFloat();
((fnc_f)callBackTable[44])(userData, shear); ((fnc_f)callBackTable[44])(userData, shear);
break; break;
} }
case B_PIC_SET_FONT_FACE: case B_PIC_SET_FONT_FACE:
{ {
int32 flags = GetInt32(); int32 flags = GetInt32();
((fnc_i)callBackTable[46])(userData, flags); ((fnc_i)callBackTable[46])(userData, flags);
break; break;
} }
default: default:
break; break;
} }
// If we didn't read enough bytes, skip them. This is not a error // If we didn't read enough bytes, skip them. This is not a error
// since the instructions can change over time. // since the instructions can change over time.
if (fData.Position() - pos < size) if (fData.Position() - pos < size)
fData.Seek(size - (fData.Position() - pos), SEEK_CUR); fData.Seek(size - (fData.Position() - pos), SEEK_CUR);
// TODO: what if too much was read, should we return B_ERROR? // TODO: what if too much was read, should we return B_ERROR?
} }
return B_OK; return B_OK;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
-1
View File
@@ -36,7 +36,6 @@ Server app_server :
OffscreenServerWindow.cpp OffscreenServerWindow.cpp
OffscreenWindowLayer.cpp OffscreenWindowLayer.cpp
PNGDump.cpp PNGDump.cpp
PicturePlayer.cpp
RAMLinkMsgReader.cpp RAMLinkMsgReader.cpp
RGBColor.cpp RGBColor.cpp
ScreenManager.cpp ScreenManager.cpp
+2 -2
View File
@@ -611,6 +611,6 @@ ServerPicture::SyncState(ViewLayer *view)
void void
ServerPicture::Play(ViewLayer *view) ServerPicture::Play(ViewLayer *view)
{ {
//TPicture picture((void *)fData.Buffer(), fData.BufferLength(), NULL); TPicture picture(const_cast<void *>(fData.Buffer()), fData.BufferLength(), NULL);
//picture.Play((void *)tableEntries, sizeof(tableEntries) / sizeof(void*), view); picture.Play(const_cast<void **>(tableEntries), sizeof(tableEntries) / sizeof(void *), view);
} }