aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/image/vectorimagerenderer.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-06 13:13:25 +0000
committerEugene Sandulenko2010-10-12 22:35:55 +0000
commit47904bc7b2992189bb554833f00a79ff0fea9fb8 (patch)
tree1cec51758c6741b970bd064fafee77607b9f884f /engines/sword25/gfx/image/vectorimagerenderer.cpp
parentca17def625154e5f758b797e4fc48c76b0566320 (diff)
downloadscummvm-rg350-47904bc7b2992189bb554833f00a79ff0fea9fb8.tar.gz
scummvm-rg350-47904bc7b2992189bb554833f00a79ff0fea9fb8.tar.bz2
scummvm-rg350-47904bc7b2992189bb554833f00a79ff0fea9fb8.zip
SWORD25: Mass-astyle.
svn-id: r53222
Diffstat (limited to 'engines/sword25/gfx/image/vectorimagerenderer.cpp')
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.cpp90
1 files changed, 38 insertions, 52 deletions
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index fa776578e3..0c7f93c130 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -49,10 +49,9 @@ namespace Sword25 {
// CompoundShape
// -----------------------------------------------------------------------------
-class CompoundShape
-{
+class CompoundShape {
public:
- CompoundShape(const BS_VectorImageElement & VectorImageElement) :
+ CompoundShape(const BS_VectorImageElement &VectorImageElement) :
m_ImageElement(VectorImageElement),
m_Path(VectorImageElement.GetPaths()),
m_Affine(),
@@ -60,29 +59,28 @@ public:
m_Trans(m_Curve, m_Affine)
{}
- unsigned operator [] (unsigned i) const
- {
+ unsigned operator [](unsigned i) const {
return m_ImageElement.GetPathInfo(i).GetID();
}
- unsigned paths() const { return m_ImageElement.GetPathCount(); }
+ unsigned paths() const {
+ return m_ImageElement.GetPathCount();
+ }
- void rewind(unsigned path_id)
- {
+ void rewind(unsigned path_id) {
m_Trans.rewind(path_id);
}
- unsigned vertex(double* x, double* y)
- {
+ unsigned vertex(double *x, double *y) {
return m_Trans.vertex(x, y);
}
private:
- const BS_VectorImageElement & m_ImageElement;
- agg::path_storage m_Path;
- agg::trans_affine m_Affine;
- agg::conv_curve<agg::path_storage> m_Curve;
- agg::conv_transform< agg::conv_curve<agg::path_storage> > m_Trans;
+ const BS_VectorImageElement &m_ImageElement;
+ agg::path_storage m_Path;
+ agg::trans_affine m_Affine;
+ agg::conv_curve<agg::path_storage> m_Curve;
+ agg::conv_transform< agg::conv_curve<agg::path_storage> > m_Trans;
};
@@ -90,29 +88,25 @@ private:
// StyleHandler
// -----------------------------------------------------------------------------
-class StyleHandler
-{
+class StyleHandler {
public:
- StyleHandler(const BS_VectorImageElement & VectorImageElement) : m_ImageElement(VectorImageElement) {}
+ StyleHandler(const BS_VectorImageElement &VectorImageElement) : m_ImageElement(VectorImageElement) {}
- bool is_solid(unsigned int style) const
- {
+ bool is_solid(unsigned int style) const {
return true;
}
- const agg::rgba8 & color(unsigned style) const
- {
+ const agg::rgba8 &color(unsigned style) const {
return m_ImageElement.GetFillStyleColor(style);
}
- void generate_span(agg::rgba8 * span, int x, int y, unsigned len, unsigned style)
- {
+ void generate_span(agg::rgba8 *span, int x, int y, unsigned len, unsigned style) {
// Wird nicht benutzt
return;
}
private:
- const BS_VectorImageElement & m_ImageElement;
+ const BS_VectorImageElement &m_ImageElement;
};
@@ -121,21 +115,19 @@ private:
// -----------------------------------------------------------------------------
BS_VectorImageRenderer::BS_VectorImageRenderer() :
- PixelFormat(rbuf)
-{
+ PixelFormat(rbuf) {
}
// -----------------------------------------------------------------------------
-bool BS_VectorImageRenderer::Render(const BS_VectorImage & VectorImage,
- float ScaleFactorX, float ScaleFactorY,
- unsigned int & Width, unsigned int & Height,
- Common::Array<char> & ImageData,
- float LineScaleFactor,
- bool NoAlphaShapes)
-{
+bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage,
+ float ScaleFactorX, float ScaleFactorY,
+ unsigned int &Width, unsigned int &Height,
+ Common::Array<char> & ImageData,
+ float LineScaleFactor,
+ bool NoAlphaShapes) {
Width = static_cast<unsigned int>(VectorImage.GetWidth() * ScaleFactorX);
Height = static_cast<unsigned int>(VectorImage.GetHeight() * ScaleFactorY);
@@ -151,9 +143,8 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage & VectorImage,
Scale = agg::trans_affine_translation(- VectorImage.GetBoundingBox().left, - VectorImage.GetBoundingBox().top);
Scale *= agg::trans_affine_scaling(ScaleFactorX, ScaleFactorY);
- for (unsigned int element = 0; element < VectorImage.GetElementCount(); ++element)
- {
- const BS_VectorImageElement & CurImageElement = VectorImage.GetElement(element);
+ for (unsigned int element = 0; element < VectorImage.GetElementCount(); ++element) {
+ const BS_VectorImageElement &CurImageElement = VectorImage.GetElement(element);
CompoundShape ImageCompoundShape(CurImageElement);
StyleHandler ImageStyleHandler(CurImageElement);
@@ -164,19 +155,16 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage & VectorImage,
//----------------------
CompoundRasterizer.clip_box(0, 0, Width, Height);
CompoundRasterizer.reset();
- for(unsigned int i = 0; i < CurImageElement.GetPathCount(); ++i)
- {
+ for (unsigned int i = 0; i < CurImageElement.GetPathCount(); ++i) {
unsigned int FillStyle0 = CurImageElement.GetPathInfo(i).GetFillStyle0();
unsigned int FillStyle1 = CurImageElement.GetPathInfo(i).GetFillStyle1();
- if (NoAlphaShapes)
- {
+ if (NoAlphaShapes) {
if (FillStyle0 != 0 && CurImageElement.GetFillStyleColor(FillStyle0 - 1).a != 255) FillStyle0 = 0;
if (FillStyle1 != 0 && CurImageElement.GetFillStyleColor(FillStyle1 - 1).a != 255) FillStyle1 = 0;
}
- if(FillStyle0 != 0 || FillStyle1 != 0)
- {
+ if (FillStyle0 != 0 || FillStyle1 != 0) {
CompoundRasterizer.styles(FillStyle0 - 1, FillStyle1 - 1);
CompoundRasterizer.add_path(Shape, CurImageElement.GetPathInfo(i).GetID());
}
@@ -189,13 +177,11 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage & VectorImage,
Rasterizer.clip_box(0, 0, Width, Height);
Stroke.line_join(agg::round_join);
Stroke.line_cap(agg::round_cap);
- for(unsigned int i = 0; i < CurImageElement.GetPathCount(); ++i)
- {
+ for (unsigned int i = 0; i < CurImageElement.GetPathCount(); ++i) {
Rasterizer.reset();
-
+
unsigned int CurrentLineStyle = CurImageElement.GetPathInfo(i).GetLineStyle();
- if (CurrentLineStyle != 0)
- {
+ if (CurrentLineStyle != 0) {
Stroke.width(ScaleFactorX * CurImageElement.GetLineStyleWidth(CurrentLineStyle - 1) * LineScaleFactor);
Rasterizer.add_path(Stroke, CurImageElement.GetPathInfo(i).GetID());
ScanlineRenderer.color(CurImageElement.GetLineStyleColor(CurrentLineStyle - 1));
@@ -203,9 +189,9 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage & VectorImage,
// Die SWF-Frames enthalten zum Teil Reste von grünen Linien, die wohl von Bernd als Umriss benutzt wurden.
// Damit diese Reste nicht störend auffallen werden grüne Linien schlichtweg ignoriert.
if (!(CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).a == 255 &&
- CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).r == 0 &&
- CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).g == 255 &&
- CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).b == 0))
+ CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).r == 0 &&
+ CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).g == 255 &&
+ CurImageElement.GetLineStyleColor(CurrentLineStyle - 1).b == 0))
agg::render_scanlines(Rasterizer, Scanline, ScanlineRenderer);
}
}