aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/design.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wage/design.cpp')
-rw-r--r--engines/wage/design.cpp81
1 files changed, 40 insertions, 41 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index f2a8aba812..9bb3693be5 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -47,20 +47,20 @@
#include "graphics/managed_surface.h"
#include "graphics/primitives.h"
+#include "graphics/macgui/macwindowmanager.h"
-#include "wage/macwindowmanager.h"
#include "wage/design.h"
namespace Wage {
struct PlotData {
Graphics::ManagedSurface *surface;
- Patterns *patterns;
+ Graphics::MacPatterns *patterns;
uint fillType;
int thickness;
Design *design;
- PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t, Design *d) :
+ PlotData(Graphics::ManagedSurface *s, Graphics::MacPatterns *p, int f, int t, Design *d) :
surface(s), patterns(p), fillType(f), thickness(t), design(d) {}
};
@@ -85,7 +85,7 @@ Design::~Design() {
delete _surface;
}
-void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, int y) {
+void Design::paint(Graphics::ManagedSurface *surface, Graphics::MacPatterns &patterns, int x, int y) {
bool needRender = false;
if (_surface == NULL) {
@@ -141,7 +141,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x,
}
}
-void Design::render(Patterns &patterns) {
+void Design::render(Graphics::MacPatterns &patterns) {
Common::MemoryReadStream in(_data, _len);
bool needRender = true;
@@ -235,9 +235,9 @@ void drawPixel(int x, int y, int color, void *data) {
color : kColorWhite;
}
} else {
- int x1 = x;
+ int x1 = x - p->thickness / 2;
int x2 = x1 + p->thickness;
- int y1 = y;
+ int y1 = y - p->thickness / 2;
int y2 = y1 + p->thickness;
for (y = y1; y < y2; y++)
@@ -265,7 +265,7 @@ void drawPixelPlain(int x, int y, int color, void *data) {
}
void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE();
@@ -294,7 +294,7 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
}
void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE();
@@ -320,7 +320,7 @@ void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream
}
void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
byte ignored = in.readSint16BE(); // ignored
@@ -397,7 +397,7 @@ void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &
}
void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
+ Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) {
int16 y1 = in.readSint16BE();
int16 x1 = in.readSint16BE();
int16 y2 = in.readSint16BE();
@@ -474,39 +474,38 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS
in.skip(numBytes);
- if (_boundsCalculationMode)
- return;
-
- Graphics::FloodFill ff(&tmp, kColorWhite, kColorGreen);
- for (int yy = 0; yy < h; yy++) {
- ff.addSeed(0, yy);
- ff.addSeed(w - 1, yy);
- }
- for (int xx = 0; xx < w; xx++) {
- ff.addSeed(xx, 0);
- ff.addSeed(xx, h - 1);
- }
- ff.fill();
-
- for (y = 0; y < h && y1 + y < surface->h; y++) {
- byte *src = (byte *)tmp.getBasePtr(0, y);
- byte *dst = (byte *)surface->getBasePtr(x1, y1 + y);
- for (x = 0; x < w; x++) {
- if (*src != kColorGreen)
- *dst = *src;
- src++;
- dst++;
+ if (!_boundsCalculationMode) {
+ Graphics::FloodFill ff(&tmp, kColorWhite, kColorGreen);
+ for (int yy = 0; yy < h; yy++) {
+ ff.addSeed(0, yy);
+ ff.addSeed(w - 1, yy);
+ }
+ for (int xx = 0; xx < w; xx++) {
+ ff.addSeed(xx, 0);
+ ff.addSeed(xx, h - 1);
+ }
+ ff.fill();
+
+ for (y = 0; y < h && y1 + y < surface->h; y++) {
+ byte *src = (byte *)tmp.getBasePtr(0, y);
+ byte *dst = (byte *)surface->getBasePtr(x1, y1 + y);
+ for (x = 0; x < w; x++) {
+ if (*src != kColorGreen)
+ *dst = *src;
+ src++;
+ dst++;
+ }
}
}
tmp.free();
}
-void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
drawRect(surface, rect.left, rect.top, rect.right, rect.bottom, thickness, color, patterns, fillType);
}
-void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, thickness, nullptr);
Graphics::drawLine(x1, y1, x2, y1, kColorBlack, drawPixel, &pd);
@@ -516,26 +515,26 @@ void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2,
}
-void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType) {
+void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, 1, nullptr);
for (int y = rect.top; y <= rect.bottom; y++)
Graphics::drawHLine(rect.left, rect.right, y, color, drawPixel, &pd);
}
-void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType) {
+void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, 1, nullptr);
Graphics::drawRoundRect(rect, arc, color, true, drawPixel, &pd);
}
-void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, thickness, nullptr);
Graphics::drawHLine(x1, x2, y, color, drawPixel, &pd);
}
-void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType) {
+void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) {
PlotData pd(surface, &patterns, fillType, thickness, nullptr);
Graphics::drawVLine(x, y1, y2, color, drawPixel, &pd);