pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1646884 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingContext.java
Date Fri, 19 Dec 2014 21:42:26 GMT
Author: tilman
Date: Fri Dec 19 21:42:26 2014
New Revision: 1646884

URL: http://svn.apache.org/r1646884
Log:
PDFBOX-2576: DRY refactoring of double code in triangle building

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingContext.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingContext.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingContext.java?rev=1646884&r1=1646883&r2=1646884&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingContext.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingContext.java
Fri Dec 19 21:42:26 2014
@@ -128,27 +128,6 @@ class Type4ShadingContext extends Gourau
                         flag = (byte) (mciis.readBits(bitsPerFlag) & 3);
                         break;
                     case 1:
-                        lastIndex = list.size() - 1;
-                        if (lastIndex < 0)
-                        {
-                            LOG.error("broken data stream: " + list.size());
-                        }
-                        else
-                        {
-                            ShadedTriangle preTri = list.get(lastIndex);
-                            p2 = readVertex(mciis, maxSrcCoord, maxSrcColor, rangeX, rangeY,
colRange, ctm, xform);
-                            ps = new Point2D[]
-                            {
-                                preTri.corner[1], preTri.corner[2], p2.point
-                            };
-                            cs = new float[][]
-                            {
-                                preTri.color[1], preTri.color[2], p2.color
-                            };
-                            list.add(new ShadedTriangle(ps, cs));
-                            flag = (byte) (mciis.readBits(bitsPerFlag) & 3);
-                        }
-                        break;
                     case 2:
                         lastIndex = list.size() - 1;
                         if (lastIndex < 0)
@@ -161,11 +140,15 @@ class Type4ShadingContext extends Gourau
                             p2 = readVertex(mciis, maxSrcCoord, maxSrcColor, rangeX, rangeY,
colRange, ctm, xform);
                             ps = new Point2D[]
                             {
-                                preTri.corner[0], preTri.corner[2], p2.point
+                                flag == 1 ? preTri.corner[1] : preTri.corner[0],
+                                preTri.corner[2],
+                                p2.point
                             };
                             cs = new float[][]
                             {
-                                preTri.color[0], preTri.color[2], p2.color
+                                flag == 1 ? preTri.color[1] : preTri.color[0],
+                                preTri.color[2],
+                                p2.color
                             };
                             list.add(new ShadedTriangle(ps, cs));
                             flag = (byte) (mciis.readBits(bitsPerFlag) & 3);



Mime
View raw message