* 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.
|
||||
*
|
||||
* Authors:
|
||||
@@ -9,11 +9,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "ServerPicture.h"
|
||||
|
||||
#include "DrawingEngine.h"
|
||||
#include "ServerApp.h"
|
||||
#include "ServerBitmap.h"
|
||||
#include "ServerFont.h"
|
||||
#include "ServerPicture.h"
|
||||
#include "ServerTokenSpace.h"
|
||||
#include "View.h"
|
||||
#include "Window.h"
|
||||
@@ -35,8 +36,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stack>
|
||||
|
||||
|
||||
using std::stack;
|
||||
|
||||
|
||||
class ShapePainter : public BShapeIterator {
|
||||
public:
|
||||
ShapePainter();
|
||||
@@ -58,7 +61,6 @@ private:
|
||||
|
||||
|
||||
ShapePainter::ShapePainter()
|
||||
: BShapeIterator()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -137,7 +139,7 @@ ShapePainter::Draw(View *view, BRect frame, bool filled)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = (opCount - 1); i >= 0; i--) {
|
||||
for (i = opCount - 1; i >= 0; i--) {
|
||||
opList[i] = fOpStack.top();
|
||||
fOpStack.pop();
|
||||
}
|
||||
@@ -157,7 +159,9 @@ ShapePainter::Draw(View *view, BRect frame, bool filled)
|
||||
}
|
||||
|
||||
|
||||
// drawing functions
|
||||
// #pragma mark - drawing functions
|
||||
|
||||
|
||||
static void
|
||||
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
|
||||
// using malloc instead of new []
|
||||
BPoint* points = (BPoint*)malloc(numPoints * sizeof(BPoint));
|
||||
if (!points)
|
||||
if (points == NULL)
|
||||
return;
|
||||
|
||||
view->ConvertToScreenForDrawing(points, viewPoints, numPoints);
|
||||
@@ -377,7 +381,7 @@ fill_polygon(View *view, int32 numPoints, const BPoint *viewPoints)
|
||||
// avoid constructor/destructor calls by
|
||||
// using malloc instead of new []
|
||||
BPoint* points = (BPoint*)malloc(numPoints * sizeof(BPoint));
|
||||
if (!points)
|
||||
if (points == NULL)
|
||||
return;
|
||||
|
||||
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);
|
||||
|
||||
view->ConvertToScreenForDrawing(&dest);
|
||||
|
||||
view->Window()->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest,
|
||||
options);
|
||||
view->Window()->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest, options);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
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) {
|
||||
view->SetDrawingOrigin(where);
|
||||
view->PushState();
|
||||
@@ -482,11 +484,10 @@ set_clipping_rects(View *view, const BRect *rects, uint32 numRects)
|
||||
|
||||
|
||||
static void
|
||||
clip_to_picture(View *view, BPicture *picture, BPoint pt,
|
||||
bool clip_to_inverse_picture)
|
||||
clip_to_picture(View* view, BPicture* picture, BPoint pt, bool clipToInverse)
|
||||
{
|
||||
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()
|
||||
:
|
||||
PictureDataWriter(),
|
||||
fFile(NULL),
|
||||
fData(NULL),
|
||||
fPictures(NULL),
|
||||
fUsurped(NULL)
|
||||
{
|
||||
@@ -791,7 +792,6 @@ ServerPicture::ServerPicture()
|
||||
|
||||
ServerPicture::ServerPicture(const ServerPicture& picture)
|
||||
:
|
||||
PictureDataWriter(),
|
||||
fFile(NULL),
|
||||
fData(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),
|
||||
fData(NULL),
|
||||
fPictures(NULL),
|
||||
@@ -830,9 +829,8 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
||||
if (fFile == NULL)
|
||||
return;
|
||||
|
||||
BPrivate::Storage::OffsetFile *offsetFile =
|
||||
new (std::nothrow) BPrivate::Storage::OffsetFile(fFile,
|
||||
(off_t)offset);
|
||||
BPrivate::Storage::OffsetFile* offsetFile
|
||||
= new(std::nothrow) BPrivate::Storage::OffsetFile(fFile, offset);
|
||||
if (offsetFile == NULL || offsetFile->InitCheck() != B_OK) {
|
||||
delete offsetFile;
|
||||
return;
|
||||
@@ -893,6 +891,7 @@ ServerPicture::SyncState(View *view)
|
||||
ExitStateChange();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ServerPicture::SetFontFromLink(BPrivate::LinkReceiver& link)
|
||||
{
|
||||
@@ -968,12 +967,11 @@ ServerPicture::Play(View *view)
|
||||
// TODO: for now: then change PicturePlayer
|
||||
// to accept a BPositionIO object
|
||||
BMallocIO* mallocIO = dynamic_cast<BMallocIO*>(fData);
|
||||
if (mallocIO == NULL) {
|
||||
if (mallocIO == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
BPrivate::PicturePlayer player(mallocIO->Buffer(),
|
||||
mallocIO->BufferLength(), fPictures);
|
||||
mallocIO->BufferLength(), fPictures->AsBList());
|
||||
player.Play(const_cast<void**>(kTableEntries),
|
||||
sizeof(kTableEntries) / sizeof(void*), view);
|
||||
}
|
||||
@@ -999,10 +997,9 @@ bool
|
||||
ServerPicture::NestPicture(ServerPicture* picture)
|
||||
{
|
||||
if (fPictures == NULL)
|
||||
fPictures = new (std::nothrow) BList;
|
||||
fPictures = new(std::nothrow) PictureList;
|
||||
|
||||
if (fPictures == NULL
|
||||
|| !fPictures->AddItem(picture))
|
||||
if (fPictures == NULL || !fPictures->AddItem(picture))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1058,9 +1055,8 @@ ServerPicture::ExportData(BPrivate::PortLink &link)
|
||||
link.Attach<int32>(subPicturesCount);
|
||||
if (subPicturesCount > 0) {
|
||||
for (int32 i = 0; i < subPicturesCount; i++) {
|
||||
ServerPicture *subPic =
|
||||
static_cast<ServerPicture *>(fPictures->ItemAtFast(i));
|
||||
link.Attach<int32>(subPic->Token());
|
||||
ServerPicture* subPicture = fPictures->ItemAt(i);
|
||||
link.Attach<int32>(subPicture->Token());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1078,7 +1074,7 @@ ServerPicture::ExportData(BPrivate::PortLink &link)
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
if (status < B_OK) {
|
||||
if (status != B_OK) {
|
||||
link.CancelMessage();
|
||||
link.StartMessage(B_ERROR);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2008, Haiku.
|
||||
* Copyright 2001-2009, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -9,8 +9,10 @@
|
||||
#ifndef SERVER_PICTURE_H
|
||||
#define SERVER_PICTURE_H
|
||||
|
||||
|
||||
#include <DataIO.h>
|
||||
|
||||
#include <ObjectList.h>
|
||||
#include <PictureDataWriter.h>
|
||||
|
||||
|
||||
@@ -24,8 +26,15 @@ namespace BPrivate {
|
||||
}
|
||||
class BList;
|
||||
|
||||
|
||||
class ServerPicture : public PictureDataWriter {
|
||||
public:
|
||||
ServerPicture();
|
||||
ServerPicture(const ServerPicture& other);
|
||||
ServerPicture(const char* fileName,
|
||||
int32 offset);
|
||||
~ServerPicture();
|
||||
|
||||
int32 Token() { return fToken; }
|
||||
|
||||
void EnterStateChange();
|
||||
@@ -47,18 +56,12 @@ public:
|
||||
status_t ExportData(BPrivate::PortLink& link);
|
||||
|
||||
private:
|
||||
friend class ServerApp;
|
||||
|
||||
ServerPicture();
|
||||
ServerPicture(const ServerPicture &);
|
||||
ServerPicture(const char *fileName, const int32 &offset);
|
||||
~ServerPicture();
|
||||
typedef BObjectList<ServerPicture> PictureList;
|
||||
|
||||
int32 fToken;
|
||||
BFile* fFile;
|
||||
BPositionIO* fData;
|
||||
// DrawState *fState;
|
||||
BList *fPictures;
|
||||
PictureList* fPictures;
|
||||
ServerPicture* fUsurped;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user