Moved the dummy table local to the PicturePlayer::Play() function since,
as Marcus pointed out, having it outside wasn't thread safe. Moved PicturePlayer into the BPrivate namespace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21982 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0f8ae3ead7
commit
422fadc829
@ -11,6 +11,7 @@
|
||||
|
||||
namespace BPrivate {
|
||||
class ServerLink;
|
||||
class PicturePlayer;
|
||||
};
|
||||
|
||||
|
||||
@ -75,9 +76,9 @@ virtual void _ReservedShape3();
|
||||
virtual void _ReservedShape4();
|
||||
|
||||
friend class BShapeIterator;
|
||||
friend class PicturePlayer;
|
||||
friend class BView;
|
||||
friend class BFont;
|
||||
friend class BPrivate::PicturePlayer;
|
||||
friend class BPrivate::ServerLink;
|
||||
|
||||
void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList);
|
||||
|
@ -4,14 +4,14 @@
|
||||
*
|
||||
* Authors:
|
||||
* Marc Flerackers (mflerackers@androme.be)
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
|
||||
* Marcus Overhagen (marcus@overhagen.de)
|
||||
*/
|
||||
|
||||
/** PicturePlayer is used to play picture data. */
|
||||
|
||||
#ifndef _TPICTURE_H
|
||||
#define _TPICTURE_H
|
||||
#ifndef _PICTUREPLAYER_H
|
||||
#define _PICTUREPLAYER_H
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
@ -20,21 +20,14 @@
|
||||
#include <DataIO.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class PicturePlayer {
|
||||
public:
|
||||
PicturePlayer();
|
||||
PicturePlayer(const void *data, size_t size, BList *pictures);
|
||||
virtual ~PicturePlayer();
|
||||
|
||||
void BeginOp(int32);
|
||||
void EndOp();
|
||||
|
||||
void EnterStateChange();
|
||||
void ExitStateChange();
|
||||
|
||||
void EnterFontChange();
|
||||
void ExitFontChange();
|
||||
|
||||
status_t Play(void **callBackTable, int32 tableEntries,
|
||||
void *userData);
|
||||
|
||||
@ -44,4 +37,6 @@ private:
|
||||
BList *fPictures;
|
||||
};
|
||||
|
||||
#endif // _TPICTURE_H
|
||||
}; // namespace BPrivate
|
||||
|
||||
#endif // _PICTUREPLAYER_H
|
||||
|
@ -252,7 +252,7 @@ BPicture::Play(void **callBackTable, int32 tableEntries, void *user)
|
||||
if (!_AssertLocalCopy())
|
||||
return B_ERROR;
|
||||
|
||||
PicturePlayer player(extent->Data(), extent->Size(), extent->Pictures());
|
||||
BPrivate::PicturePlayer player(extent->Data(), extent->Size(), extent->Pictures());
|
||||
|
||||
return player.Play(callBackTable, tableEntries, user);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include <Shape.h>
|
||||
|
||||
using BPrivate::PicturePlayer;
|
||||
|
||||
typedef void (*fnc)(void*);
|
||||
typedef void (*fnc_BPoint)(void*, BPoint);
|
||||
typedef void (*fnc_BPointBPoint)(void*, BPoint, BPoint);
|
||||
@ -49,59 +51,6 @@ nop()
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
kDummyTable[kOpsTableSize] = {
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop,
|
||||
(void *)nop
|
||||
};
|
||||
|
||||
|
||||
#if DEBUG
|
||||
static const char *
|
||||
PictureOpToString(int op)
|
||||
@ -193,11 +142,26 @@ PicturePlayer::Play(void **callBackTable, int32 tableEntries, void *userData)
|
||||
// If the caller supplied a function table smaller than needed,
|
||||
// we use our dummy table, and copy the supported ops from the supplied one.
|
||||
void **functionTable = callBackTable;
|
||||
void *dummyTable[kOpsTableSize] = {
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop,
|
||||
(void *)nop, (void *)nop, (void *)nop, (void *)nop
|
||||
};
|
||||
|
||||
if ((uint32)tableEntries < kOpsTableSize) {
|
||||
#if DEBUG
|
||||
fprintf(file, "A smaller than needed function table was supplied.\n");
|
||||
#endif
|
||||
functionTable = kDummyTable;
|
||||
functionTable = dummyTable;
|
||||
memcpy(functionTable, callBackTable, (kOpsTableSize - tableEntries) * sizeof(void *));
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,7 @@ ServerPicture::Play(ViewLayer *view)
|
||||
if (mallocIO == NULL)
|
||||
return;
|
||||
|
||||
PicturePlayer player(mallocIO->Buffer(), mallocIO->BufferLength(), fPictures);
|
||||
BPrivate::PicturePlayer player(mallocIO->Buffer(), mallocIO->BufferLength(), fPictures);
|
||||
player.Play(const_cast<void **>(kTableEntries), sizeof(kTableEntries) / sizeof(void *), view);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user