* Coding style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33871 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -9,11 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ServerPicture.h"
|
||||||
|
|
||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
#include "ServerFont.h"
|
#include "ServerFont.h"
|
||||||
#include "ServerPicture.h"
|
|
||||||
#include "ServerTokenSpace.h"
|
#include "ServerTokenSpace.h"
|
||||||
#include "View.h"
|
#include "View.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
@@ -35,8 +36,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
|
|
||||||
using std::stack;
|
using std::stack;
|
||||||
|
|
||||||
|
|
||||||
class ShapePainter : public BShapeIterator {
|
class ShapePainter : public BShapeIterator {
|
||||||
public:
|
public:
|
||||||
ShapePainter();
|
ShapePainter();
|
||||||
@@ -58,7 +61,6 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
ShapePainter::ShapePainter()
|
ShapePainter::ShapePainter()
|
||||||
: BShapeIterator()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +139,7 @@ ShapePainter::Draw(View *view, BRect frame, bool filled)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = (opCount - 1); i >= 0; i--) {
|
for (i = opCount - 1; i >= 0; i--) {
|
||||||
opList[i] = fOpStack.top();
|
opList[i] = fOpStack.top();
|
||||||
fOpStack.pop();
|
fOpStack.pop();
|
||||||
}
|
}
|
||||||
@@ -157,7 +159,9 @@ ShapePainter::Draw(View *view, BRect frame, bool filled)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// drawing functions
|
// #pragma mark - drawing functions
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_polygon_frame(const BPoint* points, int32 numPoints, BRect* _frame)
|
get_polygon_frame(const BPoint* points, int32 numPoints, BRect* _frame)
|
||||||
{
|
{
|
||||||
@@ -339,7 +343,7 @@ stroke_polygon(View *view, int32 numPoints, const BPoint *viewPoints,
|
|||||||
// avoid constructor/destructor calls by
|
// avoid constructor/destructor calls by
|
||||||
// using malloc instead of new []
|
// using malloc instead of new []
|
||||||
BPoint* points = (BPoint*)malloc(numPoints * sizeof(BPoint));
|
BPoint* points = (BPoint*)malloc(numPoints * sizeof(BPoint));
|
||||||
if (!points)
|
if (points == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
|
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
|
||||||
@@ -377,7 +381,7 @@ fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints)
|
|||||||
// avoid constructor/destructor calls by
|
// avoid constructor/destructor calls by
|
||||||
// using malloc instead of new []
|
// using malloc instead of new []
|
||||||
BPoint* points = (BPoint*)malloc(numPoints * sizeof(BPoint));
|
BPoint* points = (BPoint*)malloc(numPoints * sizeof(BPoint));
|
||||||
if (!points)
|
if (points == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
|
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
|
||||||
@@ -448,17 +452,15 @@ draw_pixels(View *view, BRect src, BRect dest, int32 width,
|
|||||||
memcpy(bitmap.Bits(), data, height * bytesPerRow);
|
memcpy(bitmap.Bits(), data, height * bytesPerRow);
|
||||||
|
|
||||||
view->ConvertToScreenForDrawing(&dest);
|
view->ConvertToScreenForDrawing(&dest);
|
||||||
|
view->Window()->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest, options);
|
||||||
view->Window()->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest,
|
|
||||||
options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_picture(View* view, BPoint where, int32 token)
|
draw_picture(View* view, BPoint where, int32 token)
|
||||||
{
|
{
|
||||||
ServerPicture *picture =
|
ServerPicture* picture
|
||||||
view->Window()->ServerWindow()->App()->FindPicture(token);
|
= view->Window()->ServerWindow()->App()->FindPicture(token);
|
||||||
if (picture != NULL) {
|
if (picture != NULL) {
|
||||||
view->SetDrawingOrigin(where);
|
view->SetDrawingOrigin(where);
|
||||||
view->PushState();
|
view->PushState();
|
||||||
@@ -482,11 +484,10 @@ set_clipping_rects(View *view, const BRect *rects, uint32 numRects)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clip_to_picture(View *view, BPicture *picture, BPoint pt,
|
clip_to_picture(View* view, BPicture* picture, BPoint pt, bool clipToInverse)
|
||||||
bool clip_to_inverse_picture)
|
|
||||||
{
|
{
|
||||||
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n",
|
printf("ClipToPicture(picture, BPoint(%.2f, %.2f), %s)\n",
|
||||||
pt.x, pt.y, clip_to_inverse_picture ? "inverse" : "");
|
pt.x, pt.y, clipToInverse ? "inverse" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -773,12 +774,12 @@ const static void *kTableEntries[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ServerPicture
|
// #pragma mark - ServerPicture
|
||||||
|
|
||||||
|
|
||||||
ServerPicture::ServerPicture()
|
ServerPicture::ServerPicture()
|
||||||
:
|
:
|
||||||
PictureDataWriter(),
|
|
||||||
fFile(NULL),
|
fFile(NULL),
|
||||||
fData(NULL),
|
|
||||||
fPictures(NULL),
|
fPictures(NULL),
|
||||||
fUsurped(NULL)
|
fUsurped(NULL)
|
||||||
{
|
{
|
||||||
@@ -791,7 +792,6 @@ ServerPicture::ServerPicture()
|
|||||||
|
|
||||||
ServerPicture::ServerPicture(const ServerPicture& picture)
|
ServerPicture::ServerPicture(const ServerPicture& picture)
|
||||||
:
|
:
|
||||||
PictureDataWriter(),
|
|
||||||
fFile(NULL),
|
fFile(NULL),
|
||||||
fData(NULL),
|
fData(NULL),
|
||||||
fPictures(NULL),
|
fPictures(NULL),
|
||||||
@@ -816,9 +816,8 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
ServerPicture::ServerPicture(const char* fileName, int32 offset)
|
||||||
:
|
:
|
||||||
PictureDataWriter(),
|
|
||||||
fFile(NULL),
|
fFile(NULL),
|
||||||
fData(NULL),
|
fData(NULL),
|
||||||
fPictures(NULL),
|
fPictures(NULL),
|
||||||
@@ -830,9 +829,8 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
|||||||
if (fFile == NULL)
|
if (fFile == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BPrivate::Storage::OffsetFile *offsetFile =
|
BPrivate::Storage::OffsetFile* offsetFile
|
||||||
new (std::nothrow) BPrivate::Storage::OffsetFile(fFile,
|
= new(std::nothrow) BPrivate::Storage::OffsetFile(fFile, offset);
|
||||||
(off_t)offset);
|
|
||||||
if (offsetFile == NULL || offsetFile->InitCheck() != B_OK) {
|
if (offsetFile == NULL || offsetFile->InitCheck() != B_OK) {
|
||||||
delete offsetFile;
|
delete offsetFile;
|
||||||
return;
|
return;
|
||||||
@@ -893,6 +891,7 @@ ServerPicture::SyncState(View *view)
|
|||||||
ExitStateChange();
|
ExitStateChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link)
|
ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link)
|
||||||
{
|
{
|
||||||
@@ -968,12 +967,11 @@ ServerPicture::Play(View *view)
|
|||||||
// TODO: for now: then change PicturePlayer
|
// TODO: for now: then change PicturePlayer
|
||||||
// to accept a BPositionIO object
|
// 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(),
|
BPrivate::PicturePlayer player(mallocIO->Buffer(),
|
||||||
mallocIO->BufferLength(), fPictures);
|
mallocIO->BufferLength(), fPictures->AsBList());
|
||||||
player.Play(const_cast<void**>(kTableEntries),
|
player.Play(const_cast<void**>(kTableEntries),
|
||||||
sizeof(kTableEntries) / sizeof(void*), view);
|
sizeof(kTableEntries) / sizeof(void*), view);
|
||||||
}
|
}
|
||||||
@@ -999,10 +997,9 @@ bool
|
|||||||
ServerPicture::NestPicture(ServerPicture* picture)
|
ServerPicture::NestPicture(ServerPicture* picture)
|
||||||
{
|
{
|
||||||
if (fPictures == NULL)
|
if (fPictures == NULL)
|
||||||
fPictures = new (std::nothrow) BList;
|
fPictures = new(std::nothrow) PictureList;
|
||||||
|
|
||||||
if (fPictures == NULL
|
if (fPictures == NULL || !fPictures->AddItem(picture))
|
||||||
|| !fPictures->AddItem(picture))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1058,9 +1055,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 =
|
ServerPicture* subPicture = fPictures->ItemAt(i);
|
||||||
static_cast<ServerPicture *>(fPictures->ItemAtFast(i));
|
link.Attach<int32>(subPicture->Token());
|
||||||
link.Attach<int32>(subPic->Token());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1078,7 +1074,7 @@ ServerPicture::ExportData(BPrivate::PortLink &link)
|
|||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status != B_OK) {
|
||||||
link.CancelMessage();
|
link.CancelMessage();
|
||||||
link.StartMessage(B_ERROR);
|
link.StartMessage(B_ERROR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -9,8 +9,10 @@
|
|||||||
#ifndef SERVER_PICTURE_H
|
#ifndef SERVER_PICTURE_H
|
||||||
#define SERVER_PICTURE_H
|
#define SERVER_PICTURE_H
|
||||||
|
|
||||||
|
|
||||||
#include <DataIO.h>
|
#include <DataIO.h>
|
||||||
|
|
||||||
|
#include <ObjectList.h>
|
||||||
#include <PictureDataWriter.h>
|
#include <PictureDataWriter.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -24,8 +26,15 @@ namespace BPrivate {
|
|||||||
}
|
}
|
||||||
class BList;
|
class BList;
|
||||||
|
|
||||||
|
|
||||||
class ServerPicture : public PictureDataWriter {
|
class ServerPicture : public PictureDataWriter {
|
||||||
public:
|
public:
|
||||||
|
ServerPicture();
|
||||||
|
ServerPicture(const ServerPicture& other);
|
||||||
|
ServerPicture(const char* fileName,
|
||||||
|
int32 offset);
|
||||||
|
~ServerPicture();
|
||||||
|
|
||||||
int32 Token() { return fToken; }
|
int32 Token() { return fToken; }
|
||||||
|
|
||||||
void EnterStateChange();
|
void EnterStateChange();
|
||||||
@@ -47,18 +56,12 @@ public:
|
|||||||
status_t ExportData(BPrivate::PortLink& link);
|
status_t ExportData(BPrivate::PortLink& link);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ServerApp;
|
typedef BObjectList<ServerPicture> PictureList;
|
||||||
|
|
||||||
ServerPicture();
|
|
||||||
ServerPicture(const ServerPicture &);
|
|
||||||
ServerPicture(const char *fileName, const int32 &offset);
|
|
||||||
~ServerPicture();
|
|
||||||
|
|
||||||
int32 fToken;
|
int32 fToken;
|
||||||
BFile* fFile;
|
BFile* fFile;
|
||||||
BPositionIO* fData;
|
BPositionIO* fData;
|
||||||
// DrawState *fState;
|
PictureList* fPictures;
|
||||||
BList *fPictures;
|
|
||||||
ServerPicture* fUsurped;
|
ServerPicture* fUsurped;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user