Skip to content

Commit

Permalink
WAGE: Stub for Design::paint()
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 27, 2015
1 parent 076a667 commit 8e82969
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 9 deletions.
50 changes: 45 additions & 5 deletions engines/wage/design.cpp
Expand Up @@ -49,19 +49,59 @@
#include "wage/design.h"

#include "common/stream.h"
#include "common/memstream.h"

namespace Wage {

Design::Design(Common::SeekableReadStream *data) {
int len = data->readUint16BE() - 2;

_data = (byte *)malloc(len);
for (int i = 0; i < len; i++)
_data[i] = data->readByte();
_len = data->readUint16BE() - 2;
_data = (byte *)malloc(_len);
data->read(_data, _len);
}

Design::~Design() {
free(_data);
}

void Design::paint(Graphics::Surface *canvas, TexturePaint *patterns, bool mask) {
Common::MemoryReadStream in(_data, _len);

if (mask) {
//canvas.setColor(Color.WHITE);
canvas->fillRect(Common::Rect(0, 0, _bounds->width(), _bounds->height()), 0xff);
//canvas.setColor(Color.BLACK);
}

while (!in.eos()) {
byte fillType = in.readByte();
byte borderThickness = in.readByte();
byte borderFillType = in.readByte();
int type = in.readByte();
switch (type) {
/*
case 4:
drawRect(canvas, in, mask, patterns, fillType, borderThickness, borderFillType);
break;
case 8:
drawRoundRect(canvas, in, mask, patterns, fillType, borderThickness, borderFillType);
break;
case 12:
drawOval(canvas, in, mask, patterns, fillType, borderThickness, borderFillType);
break;
case 16:
case 20:
drawPolygon(canvas, in, mask, patterns, fillType, borderThickness, borderFillType);
break;
case 24:
drawBitmap(canvas, in, mask);
break;
*/
default:
error("Unknown type => %d", type);
return;
}
}
}


} // End of namespace Wage
14 changes: 10 additions & 4 deletions engines/wage/design.h
Expand Up @@ -48,10 +48,13 @@
#ifndef WAGE_DESIGN_H
#define WAGE_DESIGN_H

#include "graphics/surface.h"
#include "common/rect.h"

namespace Wage {

struct TexturePaint;

class Design {
public:
Design(Common::SeekableReadStream *data);
Expand All @@ -60,16 +63,19 @@ class Design {
void setBounds(Common::Rect *bounds) {
_bounds = new Common::Rect(*bounds);
}

Common::Rect *getBounds() {
return new Common::Rect(*_bounds);
}


void paint(Graphics::Surface *canvas, TexturePaint *patterns, bool mask);

private:
byte *_data;
int _len;
Common::Rect *_bounds;
};

} // End of namespace Wage

#endif

0 comments on commit 8e82969

Please sign in to comment.