diff options
Diffstat (limited to 'engines/sword25')
-rw-r--r-- | engines/sword25/gfx/image/vectorimage.cpp | 2 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimage.h | 4 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimagerenderer.cpp | 44 | ||||
-rw-r--r-- | engines/sword25/gfx/opengl/openglgfx.cpp | 2 |
4 files changed, 16 insertions, 36 deletions
diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp index 6c79c3043a..6b8c2bb8be 100644 --- a/engines/sword25/gfx/image/vectorimage.cpp +++ b/engines/sword25/gfx/image/vectorimage.cpp @@ -222,7 +222,7 @@ Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement) // Konstruktion // ----------------------------------------------------------------------------- -VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success) : _pixelData(0) { +VectorImage::VectorImage(const byte *pFileData, uint fileSize, bool &success, const Common::String &fname) : _pixelData(0), _fname(fname) { success = false; // Bitstream-Objekt erzeugen diff --git a/engines/sword25/gfx/image/vectorimage.h b/engines/sword25/gfx/image/vectorimage.h index ac53f031c5..b3cc34e25c 100644 --- a/engines/sword25/gfx/image/vectorimage.h +++ b/engines/sword25/gfx/image/vectorimage.h @@ -157,7 +157,7 @@ private: class VectorImage : public Image { public: - VectorImage(const byte *pFileData, uint fileSize, bool &success); + VectorImage(const byte *pFileData, uint fileSize, bool &success, const Common::String &fname); ~VectorImage(); uint getElementCount() const { @@ -227,6 +227,8 @@ private: Common::Rect _boundingBox; byte *_pixelData; + + Common::String _fname; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp index 2549f8c5d1..22feaaf8b4 100644 --- a/engines/sword25/gfx/image/vectorimagerenderer.cpp +++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp @@ -303,6 +303,8 @@ void VectorImage::render(int width, int height) { double scaleX = (width == - 1) ? 1 : static_cast<double>(width) / static_cast<double>(getWidth()); double scaleY = (height == - 1) ? 1 : static_cast<double>(height) / static_cast<double>(getHeight()); + debug(0, "VectorImage::render(%d, %d) %s", width, height, _fname.c_str()); + if (_pixelData) free(_pixelData); @@ -319,10 +321,10 @@ void VectorImage::render(int width, int height) { // Count vector sizes in order to minimize memory // fragmentation for (uint p = 0; p < _elements[e].getPathCount(); p++) { - if (_elements[e].getPathInfo(p).getFillStyle0() == s + 1) + if (_elements[e].getPathInfo(p).getFillStyle1() == s + 1) fill1len += _elements[e].getPathInfo(p).getVecLen(); - if (_elements[e].getPathInfo(p).getFillStyle1() == s + 1) + if (_elements[e].getPathInfo(p).getFillStyle0() == s + 1) fill0len += _elements[e].getPathInfo(p).getVecLen(); } @@ -334,13 +336,13 @@ void VectorImage::render(int width, int height) { for (uint p = 0; p < _elements[e].getPathCount(); p++) { // Normal order - if (_elements[e].getPathInfo(p).getFillStyle0() == s + 1) { + if (_elements[e].getPathInfo(p).getFillStyle1() == s + 1) { for (int i = 0; i < _elements[e].getPathInfo(p).getVecLen(); i++) *fill1pos++ = _elements[e].getPathInfo(p).getVec()[i]; } // Reverse order - if (_elements[e].getPathInfo(p).getFillStyle1() == s + 1) { + if (_elements[e].getPathInfo(p).getFillStyle0() == s + 1) { for (int i = _elements[e].getPathInfo(p).getVecLen() - 1; i >= 0; i--) *fill0pos++ = _elements[e].getPathInfo(p).getVec()[i]; } @@ -350,11 +352,13 @@ void VectorImage::render(int width, int height) { (*fill1pos).code = ART_END; (*fill0pos).code = ART_END; + #if 0 if (fill1len) drawBez(fill1, _pixelData, width, height, scaleX, scaleY, -1, _elements[e].getFillStyleColor(s)); if (fill0len) drawBez(fill0, _pixelData, width, height, scaleX, scaleY, -1, _elements[e].getFillStyleColor(s)); + #endif art_free(fill0); art_free(fill1); @@ -362,42 +366,16 @@ void VectorImage::render(int width, int height) { //// Draw strokes for (uint s = 0; s < _elements[e].getLineStyleCount(); s++) { - int strokelen = 0; - - // Count vector sizes in order to minimize memory - // fragmentation - for (uint p = 0; p < _elements[e].getPathCount(); p++) { - if (_elements[e].getPathInfo(p).getLineStyle() == s + 1) - strokelen += _elements[e].getPathInfo(p).getVecLen(); - } - - if (strokelen == 0) - continue; - - // Now lump together vectors - ArtBpath *stroke = art_new(ArtBpath, strokelen + 1); - ArtBpath *strokepos = stroke; + double penWidth = _elements[e].getLineStyleWidth(s); + penWidth *= sqrt(fabs(scaleX * scaleY)); for (uint p = 0; p < _elements[e].getPathCount(); p++) { - // Normal order if (_elements[e].getPathInfo(p).getLineStyle() == s + 1) { - for (int i = 0; i < _elements[e].getPathInfo(p).getVecLen(); i++) - *strokepos++ = _elements[e].getPathInfo(p).getVec()[i]; + drawBez(_elements[e].getPathInfo(p).getVec(), _pixelData, width, height, scaleX, scaleY, penWidth, _elements[e].getLineStyleColor(s)); } } - - // Close vector - (*strokepos).code = ART_END; - - double penWidth = _elements[e].getLineStyleWidth(s); - penWidth *= sqrt(fabs(scaleX * scaleY)); - - drawBez(stroke, _pixelData, width, height, scaleX, scaleY, penWidth, _elements[e].getLineStyleColor(s)); - - art_free(stroke); } } - } diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp index 77fc416c77..6ea3072b3a 100644 --- a/engines/sword25/gfx/opengl/openglgfx.cpp +++ b/engines/sword25/gfx/opengl/openglgfx.cpp @@ -341,7 +341,7 @@ Resource *OpenGLGfx::LoadResource(const Common::String &FileName) { } bool Result = false; - VectorImage *pImage = new VectorImage(pFileData, FileSize, Result); + VectorImage *pImage = new VectorImage(pFileData, FileSize, Result, FileName); if (!Result) { delete pImage; delete [] pFileData; |