diff options
author | Eugene Sandulenko | 2010-08-10 12:16:31 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 22:38:23 +0000 |
commit | ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e (patch) | |
tree | 8e2591e31c02ba29ad6c6927fbf1a0a4292973e0 /engines/sword25/gfx/image | |
parent | ab85540a1bb59d7f69b89868805d1fe2a2adc89c (diff) | |
download | scummvm-rg350-ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e.tar.gz scummvm-rg350-ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e.tar.bz2 scummvm-rg350-ad5b74c9de1eb3d6eda91e1bf21b24c87a78391e.zip |
SWORD25: Clean compile!
Under MinGW, with OpenGL and tinyxml.
svn-id: r53225
Diffstat (limited to 'engines/sword25/gfx/image')
-rw-r--r-- | engines/sword25/gfx/image/image.h | 2 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimage.cpp | 31 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimage.h | 46 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimagerenderer.cpp | 28 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimagerenderer.h | 7 |
5 files changed, 72 insertions, 42 deletions
diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h index 1489af97b3..805a4b80a5 100644 --- a/engines/sword25/gfx/image/image.h +++ b/engines/sword25/gfx/image/image.h @@ -165,7 +165,7 @@ public: @return Gibt false zurück, falls der Aufruf fehlgeschlagen ist. @remark Ein Aufruf dieser Methode ist nur erlaubt, wenn IsSetContentAllowed() true zurückgibt. */ - virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) = 0; + virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) = 0; /** @brief Liest einen Pixel des Bildes. diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp index 9e3e2fef71..549ef96d39 100644 --- a/engines/sword25/gfx/image/vectorimage.cpp +++ b/engines/sword25/gfx/image/vectorimage.cpp @@ -38,12 +38,8 @@ #include "sword25/kernel/bs_stdint.h" #include "sword25/gfx/image/vectorimage.h" -#include <vector> -#include <stdexcept> -#include "agg_bounding_rect.h" - -using namespace std; +#include "graphics/colormasks.h" namespace Sword25 { @@ -195,9 +191,9 @@ BS_Rect FlashRectToBSRect(BS_VectorImage::SWFBitStream &bs) { // Konvertiert SWF-Farben in AntiGrain Farben // ----------------------------------------------------------------------------- -agg::rgba8 FlashColorToAGGRGBA8(unsigned int FlashColor) { - agg::rgba8 ResultColor((FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff, FlashColor >> 24); - ResultColor.premultiply(); +uint32 FlashColorToAGGRGBA8(unsigned int FlashColor) { + uint32 ResultColor = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(FlashColor >> 24, (FlashColor >> 16) & 0xff, (FlashColor >> 8) & 0xff, FlashColor & 0xff); + return ResultColor; } @@ -215,12 +211,16 @@ struct CBBGetId { }; BS_Rect CalculateBoundingBox(const BS_VectorImageElement &VectorImageElement) { +#if 0 // TODO agg::path_storage Path = VectorImageElement.GetPaths(); CBBGetId IdSource(VectorImageElement); double x1, x2, y1, y2; agg::bounding_rect(Path, IdSource, 0, VectorImageElement.GetPathCount(), &x1, &y1, &x2, &y2); - +#else + double x1, x2, y1, y2; + x1 = x2 = y1 = y2 = 0; +#endif return BS_Rect(static_cast<int>(x1), static_cast<int>(y1), static_cast<int>(x2) + 1, static_cast<int>(y2) + 1); } } @@ -388,6 +388,7 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) // Ein neuen Pfad erzeugen, es sei denn, es wurden nur neue Styles definiert if (StateLineStyle || StateFillStyle0 || StateFillStyle1 || StateMoveTo) { // Letzte Zeichenposition merken, beim Aufruf von start_new_path() wird die Zeichenpostionen auf 0, 0 zurückgesetzt +#if 0 // TODO double LastX = m_Elements.back().m_Paths.last_x(); double LastY = m_Elements.back().m_Paths.last_y(); @@ -400,6 +401,7 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) m_Elements.back().m_Paths.move_to(MoveDeltaX, MoveDeltaY); else m_Elements.back().m_Paths.move_to(LastX, LastY); +#endif } } } else { @@ -414,11 +416,13 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) s32 AnchorDeltaX = bs.GetSignedBits(NumBits); s32 AnchorDeltaY = bs.GetSignedBits(NumBits); +#if 0 // TODO double ControlX = m_Elements.back().m_Paths.last_x() + ControlDeltaX; double ControlY = m_Elements.back().m_Paths.last_y() + ControlDeltaY; double AnchorX = ControlX + AnchorDeltaX; double AnchorY = ControlY + AnchorDeltaY; m_Elements.back().m_Paths.curve3(ControlX, ControlY, AnchorX, AnchorY); +#endif } else { // Staight edge s32 DeltaX = 0; @@ -436,13 +440,15 @@ bool BS_VectorImage::ParseDefineShape(unsigned int ShapeType, SWFBitStream &bs) DeltaX = bs.GetSignedBits(NumBits); } +#if 0 // TODO m_Elements.back().m_Paths.line_rel(DeltaX, DeltaY); +#endif } } } // Bounding-Boxes der einzelnen Elemente berechnen - vector<BS_VectorImageElement>::iterator it = m_Elements.begin(); + Common::Array<BS_VectorImageElement>::iterator it = m_Elements.begin(); for (; it != m_Elements.end(); ++it) it->m_BoundingBox = CalculateBoundingBox(*it); return true; @@ -481,7 +487,8 @@ bool BS_VectorImage::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsig // Anzahl an Linestyles bestimmen unsigned int LineStyleCount = bs.GetU8(); - if (LineStyleCount == 0xff) LineStyleCount = bs.GetU16(); + if (LineStyleCount == 0xff) + LineStyleCount = bs.GetU16(); // Alle Linestyles einlesen m_Elements.back().m_LineStyles.reserve(LineStyleCount); @@ -521,7 +528,7 @@ unsigned int BS_VectorImage::GetPixel(int X, int Y) { // ----------------------------------------------------------------------------- -bool BS_VectorImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) { +bool BS_VectorImage::SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride) { BS_LOG_ERRORLN("SetContent() is not supported."); return 0; } diff --git a/engines/sword25/gfx/image/vectorimage.h b/engines/sword25/gfx/image/vectorimage.h index f791a36f03..b17951bbdf 100644 --- a/engines/sword25/gfx/image/vectorimage.h +++ b/engines/sword25/gfx/image/vectorimage.h @@ -43,10 +43,10 @@ #include "sword25/gfx/image/image.h" #include "sword25/math/rect.h" +#if 0 #include <vector> #include "agg_path_storage.h" -#include "agg_color_rgba.h" - +#endif namespace Sword25 { @@ -62,7 +62,11 @@ class BS_VectorImage; class BS_VectorPathInfo { public: BS_VectorPathInfo(unsigned int ID, unsigned int LineStyle, unsigned int FillStyle0, unsigned int FillStyle1) : - m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {}; + m_ID(ID), m_LineStyle(LineStyle), m_FillStyle0(FillStyle0), m_FillStyle1(FillStyle1) {} + + BS_VectorPathInfo() { + m_ID = m_LineStyle = m_FillStyle0 = m_FillStyle1 = 0; + } unsigned int GetID() const { return m_ID; @@ -90,15 +94,18 @@ private: Werden alle Elemente eines Vektorbildes übereinandergelegt, ergibt sich das komplette Bild. */ class BS_VectorImageElement { - friend BS_VectorImage; + friend class BS_VectorImage; public: - const agg::path_storage &GetPaths() const { +#if 0 // TODO + const agg::path_storage &GetPaths() const { return m_Paths; } - unsigned int GetPathCount() const { +#endif + + unsigned int GetPathCount() const { return m_PathInfos.size(); } - const BS_VectorPathInfo &GetPathInfo(unsigned int PathNr) const { + const BS_VectorPathInfo &GetPathInfo(unsigned int PathNr) const { BS_ASSERT(PathNr < GetPathCount()); return m_PathInfos[PathNr]; } @@ -112,7 +119,7 @@ public: return m_LineStyles.size(); } - const agg::rgba8 &GetLineStyleColor(unsigned int LineStyle) const { + uint32 GetLineStyleColor(unsigned int LineStyle) const { BS_ASSERT(LineStyle < m_LineStyles.size()); return m_LineStyles[LineStyle].Color; } @@ -121,7 +128,7 @@ public: return m_FillStyles.size(); } - const agg::rgba8 &GetFillStyleColor(unsigned int FillStyle) const { + uint32 GetFillStyleColor(unsigned int FillStyle) const { BS_ASSERT(FillStyle < m_FillStyles.size()); return m_FillStyles[FillStyle]; } @@ -132,16 +139,19 @@ public: private: struct LineStyleType { - LineStyleType(double Width_, const agg::rgba8 &Color_) : Width(Width_), Color(Color_) {}; - double Width; - agg::rgba8 Color; + LineStyleType(double Width_, uint32 Color_) : Width(Width_), Color(Color_) {} + LineStyleType() { Width = 0; Color = 0; } + double Width; + uint32 Color; }; - agg::path_storage m_Paths; - Common::Array<BS_VectorPathInfo> m_PathInfos; - Common::Array<LineStyleType> m_LineStyles; - Common::Array<agg::rgba8> m_FillStyles; - BS_Rect m_BoundingBox; +#if 0 // TODO + agg::path_storage m_Paths; +#endif + Common::Array<BS_VectorPathInfo> m_PathInfos; + Common::Array<LineStyleType> m_LineStyles; + Common::Array<uint32> m_FillStyles; + BS_Rect m_BoundingBox; }; @@ -201,7 +211,7 @@ public: virtual bool IsSetContentAllowed() const { return false; } - virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride); + virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride); virtual bool Blit(int PosX = 0, int PosY = 0, int Flipping = FLIP_NONE, BS_Rect *pPartRect = NULL, diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp index 0c7f93c130..1b7fe29cdf 100644 --- a/engines/sword25/gfx/image/vectorimagerenderer.cpp +++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp @@ -38,13 +38,16 @@ #include "sword25/gfx/image/vectorimagerenderer.h" #include "sword25/gfx/image/vectorimage.h" + +#if 0 // TODO #include "agg_conv_curve.h" #include "agg_path_storage.h" #include "agg_conv_stroke.h" - +#endif namespace Sword25 { +#if 0 // TODO // ----------------------------------------------------------------------------- // CompoundShape // ----------------------------------------------------------------------------- @@ -109,23 +112,16 @@ private: const BS_VectorImageElement &m_ImageElement; }; - -// ----------------------------------------------------------------------------- -// Konstruktion -// ----------------------------------------------------------------------------- - BS_VectorImageRenderer::BS_VectorImageRenderer() : PixelFormat(rbuf) { } -// ----------------------------------------------------------------------------- - bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage, float ScaleFactorX, float ScaleFactorY, unsigned int &Width, unsigned int &Height, - Common::Array<char> & ImageData, + byte *ImageData, float LineScaleFactor, bool NoAlphaShapes) { Width = static_cast<unsigned int>(VectorImage.GetWidth() * ScaleFactorX); @@ -200,4 +196,18 @@ bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage, return true; } +#else + +BS_VectorImageRenderer::BS_VectorImageRenderer() {} + +bool BS_VectorImageRenderer::Render(const BS_VectorImage &VectorImage, + float ScaleFactorX, float ScaleFactorY, + unsigned int &Width, unsigned int &Height, + byte *ImageData, + float LineScaleFactor, + bool NoAlphaShapes) { + return true; +} +#endif + } // End of namespace Sword25 diff --git a/engines/sword25/gfx/image/vectorimagerenderer.h b/engines/sword25/gfx/image/vectorimagerenderer.h index ed073abb56..41e633ba76 100644 --- a/engines/sword25/gfx/image/vectorimagerenderer.h +++ b/engines/sword25/gfx/image/vectorimagerenderer.h @@ -40,8 +40,8 @@ // ----------------------------------------------------------------------------- #include "sword25/kernel/common.h" -#include <vector> +#if 0 // TODO #include "agg_rendering_buffer.h" #include "agg_pixfmt_rgba.h" #include "agg_renderer_scanline.h" @@ -51,6 +51,7 @@ #include "agg_scanline_bin.h" #include "agg_trans_affine.h" #include "agg_span_allocator.h" +#endif namespace Sword25 { @@ -68,11 +69,12 @@ public: bool Render(const BS_VectorImage &VectorImage, float ScaleFactorX, float ScaleFactorY, unsigned int &Width, unsigned int &Height, - Common::Array<char> & ImageData, + byte *ImageData, float LineScaleFactor = 1.0f, bool NoAlphaShapes = false); private: +#if 0 typedef agg::pixfmt_rgba32_pre PixelFormatType; typedef agg::renderer_base<PixelFormatType> BaseRendererType; typedef agg::renderer_scanline_aa_solid<BaseRendererType> ScanlineRendererType; @@ -87,6 +89,7 @@ private: agg::scanline_bin ScanlineBin; agg::trans_affine Scale; agg::span_allocator<agg::rgba8> Alloc; +#endif }; } // End of namespace Sword25 |