Renamed TPicture class to PicturePlayer

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16342 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-02-10 21:38:53 +00:00
parent 2c2773c4c3
commit 38690d41b0
4 changed files with 74 additions and 95 deletions
+15 -29
View File
@@ -1,28 +1,14 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2002, OpenBeOS * Copyright 2001-2006, Haiku Inc.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a *
// copy of this software and associated documentation files (the "Software"), * Authors:
// to deal in the Software without restriction, including without limitation * Marc Flerackers ([email protected])
// the rights to use, copy, modify, merge, publish, distribute, sublicense, * Stefano Ceccherini ([email protected])
// 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:
// /** PicturePlayer is used to create and play picture data. */
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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
// DEALINGS IN THE SOFTWARE.
//
// File Name: TPicture.h
// Author: Marc Flerackers ([email protected])
// Description: TPicture is used to create and play picture data.
//------------------------------------------------------------------------------
#ifndef _TPICTURE_H #ifndef _TPICTURE_H
#define _TPICTURE_H #define _TPICTURE_H
@@ -33,11 +19,11 @@
#include <DataIO.h> #include <DataIO.h>
class TPicture { class PicturePlayer {
public: public:
TPicture(); PicturePlayer();
TPicture(void *data, int32 size, BList *pictures); PicturePlayer(void *data, int32 size, BList *pictures);
virtual ~TPicture(); virtual ~PicturePlayer();
int16 GetOp(); int16 GetOp();
bool GetBool(); bool GetBool();
+2 -2
View File
@@ -584,9 +584,9 @@ 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); PicturePlayer player(data, size, pictures);
return picture.Play(callBackTable, tableEntries, user); return player.Play(callBackTable, tableEntries, user);
} }
+55 -62
View File
@@ -1,43 +1,19 @@
//------------------------------------------------------------------------------ /*
// Copyright (c) 2001-2002, OpenBeOS * Copyright 2001-2006, Haiku Inc.
// * Distributed under the terms of the MIT License.
// Permission is hereby granted, free of charge, to any person obtaining a *
// copy of this software and associated documentation files (the "Software"), * Authors:
// to deal in the Software without restriction, including without limitation * Marc Flerackers ([email protected])
// the rights to use, copy, modify, merge, publish, distribute, sublicense, * Stefano Ceccherini ([email protected])
// 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:
// /** PicturePlayer is used to create and play picture data. */
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// 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
// DEALINGS IN THE SOFTWARE.
//
// File Name: TPicture.cpp
// Author: Marc Flerackers ([email protected])
// Description: TPicture is used to create and play picture data.
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
#include <stdio.h> #include <stdio.h>
// System Includes -------------------------------------------------------------
#include <TPicture.h> #include <TPicture.h>
#include <PictureProtocol.h> #include <PictureProtocol.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
typedef void (*fnc)(void*); typedef void (*fnc)(void*);
typedef void (*fnc_BPoint)(void*, BPoint); typedef void (*fnc_BPoint)(void*, BPoint);
@@ -60,19 +36,21 @@ 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) PicturePlayer::PicturePlayer(void *data, int32 size, BList *pictures)
: fData(data, size), : fData(data, size),
fPictures(pictures) fPictures(pictures)
{ {
} }
//------------------------------------------------------------------------------
TPicture::~TPicture()
PicturePlayer::~PicturePlayer()
{ {
} }
//------------------------------------------------------------------------------
int16 TPicture::GetOp()
int16
PicturePlayer::GetOp()
{ {
int16 data; int16 data;
@@ -80,8 +58,10 @@ int16 TPicture::GetOp()
return data; return data;
} }
//------------------------------------------------------------------------------
bool TPicture::GetBool()
bool
PicturePlayer::GetBool()
{ {
bool data; bool data;
@@ -89,8 +69,10 @@ bool TPicture::GetBool()
return data; return data;
} }
//------------------------------------------------------------------------------
int16 TPicture::GetInt16()
int16
PicturePlayer::GetInt16()
{ {
int16 data; int16 data;
@@ -98,8 +80,10 @@ int16 TPicture::GetInt16()
return data; return data;
} }
//------------------------------------------------------------------------------
int32 TPicture::GetInt32()
int32
PicturePlayer::GetInt32()
{ {
int32 data; int32 data;
@@ -107,8 +91,10 @@ int32 TPicture::GetInt32()
return data; return data;
} }
//------------------------------------------------------------------------------
float TPicture::GetFloat()
float
PicturePlayer::GetFloat()
{ {
float data; float data;
@@ -116,8 +102,10 @@ float TPicture::GetFloat()
return data; return data;
} }
//------------------------------------------------------------------------------
BPoint TPicture::GetCoord()
BPoint
PicturePlayer::GetCoord()
{ {
BPoint data; BPoint data;
@@ -125,8 +113,10 @@ BPoint TPicture::GetCoord()
return data; return data;
} }
//------------------------------------------------------------------------------
BRect TPicture::GetRect()
BRect
PicturePlayer::GetRect()
{ {
BRect data; BRect data;
@@ -134,8 +124,10 @@ BRect TPicture::GetRect()
return data; return data;
} }
//------------------------------------------------------------------------------
rgb_color TPicture::GetColor()
rgb_color
PicturePlayer::GetColor()
{ {
rgb_color data; rgb_color data;
@@ -143,13 +135,17 @@ rgb_color TPicture::GetColor()
return data; return data;
} }
//------------------------------------------------------------------------------
void TPicture::GetData(void *data, int32 size)
void
PicturePlayer::GetData(void *data, int32 size)
{ {
fData.Read(data, size); fData.Read(data, size);
} }
//------------------------------------------------------------------------------
status_t TPicture::Play(void **callBackTable, int32 tableEntries, void *userData)
status_t
PicturePlayer::Play(void **callBackTable, int32 tableEntries, 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.
@@ -482,6 +478,3 @@ status_t TPicture::Play(void **callBackTable, int32 tableEntries, void *userData
return B_OK; return B_OK;
} }
//------------------------------------------------------------------------------
+2 -2
View File
@@ -611,6 +611,6 @@ ServerPicture::SyncState(ViewLayer *view)
void void
ServerPicture::Play(ViewLayer *view) ServerPicture::Play(ViewLayer *view)
{ {
TPicture picture(const_cast<void *>(fData.Buffer()), fData.BufferLength(), NULL); PicturePlayer player(const_cast<void *>(fData.Buffer()), fData.BufferLength(), NULL);
picture.Play(const_cast<void **>(tableEntries), sizeof(tableEntries) / sizeof(void *), view); player.Play(const_cast<void **>(tableEntries), sizeof(tableEntries) / sizeof(void *), view);
} }