[Scummvm-cvs-logs] SF.net SVN: scummvm:[53320] scummvm/trunk/engines/sword25/gfx

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 01:36:52 CEST 2010


Revision: 53320
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53320&view=rev
Author:   sev
Date:     2010-10-12 23:36:52 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: fix line drawing in vector images

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp
    scummvm/trunk/engines/sword25/gfx/image/vectorimage.h
    scummvm/trunk/engines/sword25/gfx/image/vectorimagerenderer.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp

Modified: scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp	2010-10-12 23:36:25 UTC (rev 53319)
+++ scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp	2010-10-12 23:36:52 UTC (rev 53320)
@@ -222,7 +222,7 @@
 // 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

Modified: scummvm/trunk/engines/sword25/gfx/image/vectorimage.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/vectorimage.h	2010-10-12 23:36:25 UTC (rev 53319)
+++ scummvm/trunk/engines/sword25/gfx/image/vectorimage.h	2010-10-12 23:36:52 UTC (rev 53320)
@@ -157,7 +157,7 @@
 
 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 @@
 	Common::Rect                         _boundingBox;
 
 	byte *_pixelData;
+
+	Common::String _fname;
 };
 
 } // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/gfx/image/vectorimagerenderer.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/vectorimagerenderer.cpp	2010-10-12 23:36:25 UTC (rev 53319)
+++ scummvm/trunk/engines/sword25/gfx/image/vectorimagerenderer.cpp	2010-10-12 23:36:52 UTC (rev 53320)
@@ -303,6 +303,8 @@
 	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 @@
 			// 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 @@
 
 			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 @@
 			(*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 @@
 
 		//// Draw strokes
 		for (uint s = 0; s < _elements[e].getLineStyleCount(); s++) {
-			int strokelen = 0;
+			double penWidth = _elements[e].getLineStyleWidth(s);
+			penWidth *= sqrt(fabs(scaleX * scaleY));
 
-			// 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;
-
-			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);
 		}
 	}
-
 }
 
 

Modified: scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp	2010-10-12 23:36:25 UTC (rev 53319)
+++ scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp	2010-10-12 23:36:52 UTC (rev 53320)
@@ -341,7 +341,7 @@
 		}
 
 		bool Result = false;
-		VectorImage *pImage = new VectorImage(pFileData, FileSize, Result);
+		VectorImage *pImage = new VectorImage(pFileData, FileSize, Result, FileName);
 		if (!Result) {
 			delete pImage;
 			delete [] pFileData;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list