Bug Marks with null size were not correctly exported in vectorial formats 23/16223/2
Calixte DENIZET [Mon, 23 Mar 2015 17:39:15 +0000 (18:39 +0100)]
Change-Id: I5094c94d0bf6351c4a750135b410dc11d360704f

scilab/CHANGES_5.5.X
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/mark/MarkSpriteFactory.java
scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/texture/BufferedImageTextureDrawingTools.java

index cfc6a22..66fcdb6 100644 (file)
@@ -72,6 +72,8 @@ Scilab Bug Fixes
 
 * Bug #13549 fixed - Slider uicontrols triggered three callbacks instead of one.
 
+* Bug #13551 fixed - Marks with null size were not correctly exported in vectorial formats.
+
 * Bug #13586 fixed - Scilab compilation failed with recent versions of JoGL package.
 
 * Bug #13605 fixed - harmean returned an inverted result when called with parameters "r" or "c".
index 716690b..7c9b9e2 100644 (file)
@@ -85,6 +85,12 @@ public class MarkSpriteFactory {
             appearance.setLineWidth(usedAppearance.getLineWidth());
         }
 
+        if (finalSize == 0) {
+            // when finalSize is 0 then a dot is drawn so we draw a dot with a PlusSpriteDrawer
+            // which is well exported with size equal to 1 (see bug 13551)
+            finalSize = 1;
+        }
+
         if (finalSize != 1) {
             switch (mark.getStyle()) {
                 case  0:
index 573cb61..3fa9f82 100644 (file)
@@ -83,10 +83,12 @@ public class BufferedImageTextureDrawingTools implements TextureDrawingTools {
     public void drawPlus(int size, Appearance appearance) {
         int r = size / 2;
         int[] coords1 = new int[] { -r, 0, r, 0};
-        int[] coords2 = new int[] {0, -r, 0, r};
-
-        drawPolyline(coords1, appearance);
-        drawPolyline(coords2, appearance);
+        if (r == 0) {
+            drawPolyline(coords1, appearance);
+        } else {
+            int[] coords2 = new int[] {0, -r, 0, r};
+            drawPolyline(coords2, appearance);
+        }
     }
 
     @Override