From 7ad20e33378673b7e4c1c3ebcf602c22cdb95e61 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 5 Sep 2010 21:15:35 +0000 Subject: [PATCH] SWORD25: Further fixes to vector images. Still not finished. svn-id: r53322 --- engines/sword25/gfx/image/vectorimage.cpp | 4 ++-- .../sword25/gfx/image/vectorimagerenderer.cpp | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp index 6b8c2bb8be3..5e955027489 100644 --- a/engines/sword25/gfx/image/vectorimage.cpp +++ b/engines/sword25/gfx/image/vectorimage.cpp @@ -446,8 +446,8 @@ bool VectorImage::parseDefineShape(uint shapeType, SWFBitStream &bs) { double newX = curX + controlDeltaX; double newY = curY + controlDeltaY; - double anchorX = curX + anchorDeltaX; - double anchorY = curY + anchorDeltaY; + double anchorX = newX + anchorDeltaX; + double anchorY = newY + anchorDeltaY; #define WEIGHT (2.0/3.0) diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp index f6013605d01..715d777c837 100644 --- a/engines/sword25/gfx/image/vectorimagerenderer.cpp +++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp @@ -341,9 +341,16 @@ void drawBez(ArtBpath *bez1, ArtBpath *bez2, art_u8 *buffer, int width, int heig #endif vec1 = art_bez_path_to_vec(bez1, 0.5); - vec2 = art_bez_path_to_vec(bez2, 0.5); - vec2 = art_vpath_reverse_free(vec2); - vec = art_vpath_cat(vec1, vec2); + if (bez2 != 0) { + vec2 = art_bez_path_to_vec(bez2, 0.5); + vec2 = art_vpath_reverse_free(vec2); + vec = art_vpath_cat(vec1, vec2); + + art_free(vec1); + art_free(vec2); + } else { + vec = vec1; + } if (scaleX != 1.0 || scaleY != 1.0) { ArtVpath *vect; @@ -363,7 +370,7 @@ void drawBez(ArtBpath *bez1, ArtBpath *bez2, art_u8 *buffer, int width, int heig vec = vect; } - if (penWidth != -1) { + if (bez2 == 0) { // Line drawing svp = art_svp_vpath_stroke(vec, ART_PATH_STROKE_JOIN_ROUND, ART_PATH_STROKE_CAP_ROUND, penWidth, 1.0, 0.5); } else { svp = art_svp_from_vpath(vec); @@ -427,7 +434,7 @@ void VectorImage::render(int width, int height) { (*fill0pos).code = ART_END; (*fill1pos).code = ART_END; - drawBez(fill0, fill1, _pixelData, width, height, scaleX, scaleY, -1, _elements[e].getFillStyleColor(s)); + drawBez(fill1, fill0, _pixelData, width, height, scaleX, scaleY, -1, _elements[e].getFillStyleColor(s)); art_free(fill0); art_free(fill1);